From a25b641f2b2a810477026fa53f2a9b722359a4f9 Mon Sep 17 00:00:00 2001 From: Adrien Burgun Date: Sat, 30 Jul 2022 15:24:18 +0200 Subject: [PATCH] :sparkles: Species variables --- clean.sh | 4 + species/blobamber/assets/owo.svg | 46 ++++ species/blobamber/species.toml | 7 + species/blobamber/templates/eyes.mustache | 15 +- species/blobamber/templates/hands.mustache | 4 +- species/blobcat/species.toml | 7 + species/blobcat/templates/body-snug.mustache | 5 +- species/blobcat/templates/hands.mustache | 2 +- species/blobcat/templates/tail.mustache | 5 +- species/blobfox/species.toml | 7 + src/parse.rs | 8 + src/template.rs | 2 + vector/blobamber_owo.svg | 250 +++++++++++++++++++ 13 files changed, 354 insertions(+), 8 deletions(-) create mode 100755 clean.sh create mode 100644 species/blobamber/assets/owo.svg create mode 100644 vector/blobamber_owo.svg diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..6698dca --- /dev/null +++ b/clean.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cargo run --bin clean -- "$1" +xmllint "$1" --format --output "$1" diff --git a/species/blobamber/assets/owo.svg b/species/blobamber/assets/owo.svg new file mode 100644 index 0000000..482e06e --- /dev/null +++ b/species/blobamber/assets/owo.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/species/blobamber/species.toml b/species/blobamber/species.toml index c6009b3..acb5569 100644 --- a/species/blobamber/species.toml +++ b/species/blobamber/species.toml @@ -1,2 +1,9 @@ name = "blobamber" base = "../blobcat/" + +[vars] +body_color = "#6a6862" +ear_color = "#313131" +ear_fluff_color = "#474747" +hand_color = "#6a6862" +tail_color = "#6a6862" diff --git a/species/blobamber/templates/eyes.mustache b/species/blobamber/templates/eyes.mustache index cff1a5f..b9efa84 100644 --- a/species/blobamber/templates/eyes.mustache +++ b/species/blobamber/templates/eyes.mustache @@ -1,3 +1,14 @@ + + +{{#blobamber.owo}}#blobamber-owo-defs{{/blobamber.owo}} {{#blobamber.base}}#blobamber-defs{{/blobamber.base}} - -{{>blobcat.eyes}} + +{{#tags.eyes-owo}} + + {{#owo}}#left-eye{{/owo}} + {{#owo}}#right-eye{{/owo}} + +{{/tags.eyes-owo}} +{{^tags.eyes-owo}} + {{>blobcat.eyes}} +{{/tags.eyes-owo}} diff --git a/species/blobamber/templates/hands.mustache b/species/blobamber/templates/hands.mustache index 342d878..1371796 100644 --- a/species/blobamber/templates/hands.mustache +++ b/species/blobamber/templates/hands.mustache @@ -7,9 +7,7 @@ {{/tags.holding}} {{/tags.hand-3c}} -{{#set-fill}} - #6a6862 | {{>blobfox.hands}} -{{/set-fill}} +{{>blobcat.hands}} {{#tags.hand-3c}} diff --git a/species/blobcat/species.toml b/species/blobcat/species.toml index 5e598ca..b712f45 100644 --- a/species/blobcat/species.toml +++ b/species/blobcat/species.toml @@ -1,2 +1,9 @@ name = "blobcat" base = "../blobfox/" + +[vars] +body_color = "#fcc21b" +ear_color = "#e9ae20" +ear_fluff_color = "#8a6135" +hand_color = "#fcc21b" +tail_color = "#fcc21b" diff --git a/species/blobcat/templates/body-snug.mustache b/species/blobcat/templates/body-snug.mustache index 6d06a08..aa2ab12 100644 --- a/species/blobcat/templates/body-snug.mustache +++ b/species/blobcat/templates/body-snug.mustache @@ -3,7 +3,10 @@ {{#base}}#left-ear{{/base}} - {{#set-fill}}#fcc21b|{{#snug}}#body{{/snug}}{{/set-fill}} + {{#set-fill}} + {{vars.body_color}} + | {{#snug}}#body{{/snug}} + {{/set-fill}} {{#base}}#right-ear{{/base}} diff --git a/species/blobcat/templates/hands.mustache b/species/blobcat/templates/hands.mustache index c49edc3..d4457ed 100644 --- a/species/blobcat/templates/hands.mustache +++ b/species/blobcat/templates/hands.mustache @@ -1,3 +1,3 @@ {{#set-fill}} - #fcc21b | {{>blobfox.hands}} + {{vars.hand_color}} | {{>blobfox.hands}} {{/set-fill}} diff --git a/species/blobcat/templates/tail.mustache b/species/blobcat/templates/tail.mustache index 21ef72c..640f6fe 100644 --- a/species/blobcat/templates/tail.mustache +++ b/species/blobcat/templates/tail.mustache @@ -1 +1,4 @@ -{{#set-fill}}#fcc21b|{{>blobfox.tail}}{{/set-fill}} +{{#set-fill}} + {{vars.tail_color}} + | {{>blobfox.tail}} +{{/set-fill}} diff --git a/species/blobfox/species.toml b/species/blobfox/species.toml index bad6c59..7a9949e 100644 --- a/species/blobfox/species.toml +++ b/species/blobfox/species.toml @@ -1,6 +1,13 @@ # Add options in here as needs be name = "blobfox" +[vars] +body_color = "#ff8702" +ear_color = "#313131" +ear_fluff_color = "#3bdccc" +hand_color = "#ff8702" +tail_color = "#ff8702" + [variants] base = ["body-basic", "eyes-basic", "mouth-w"] happy = ["body-basic", "eyes-happy", "mouth-w"] diff --git a/src/parse.rs b/src/parse.rs index 3567cbd..a4aef5c 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -34,6 +34,9 @@ pub struct SpeciesDecl { #[serde(default)] pub variants: HashMap>, + #[serde(default)] + pub vars: HashMap, + #[serde(skip)] pub template_paths: HashMap, @@ -73,6 +76,11 @@ pub fn load_species(path: impl AsRef) -> Result { res.variant_paths = base.variant_paths.clone(); res.asset_paths = base.asset_paths.clone(); res.variants = base.variants.clone(); + for (key, value) in base.vars.iter() { + if !res.vars.contains_key(key) { + res.vars.insert(key.clone(), value.clone()); + } + } res.parent = Some(Box::new(base)); } diff --git a/src/template.rs b/src/template.rs index 58013cc..471efa9 100644 --- a/src/template.rs +++ b/src/template.rs @@ -124,6 +124,8 @@ impl RenderingContext { } }); + builder = builder.insert("vars", &self.species.vars).unwrap(); + if include_parent { let mut this = self.clone(); diff --git a/vector/blobamber_owo.svg b/vector/blobamber_owo.svg new file mode 100644 index 0000000..cb524e7 --- /dev/null +++ b/vector/blobamber_owo.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +