]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Kobold variety - allows kobolds to have random colors and horns (+ allows RandomSprit...
authordeathride58 <deathride58@users.noreply.github.com>
Thu, 4 Jan 2024 00:39:00 +0000 (19:39 -0500)
committerGitHub <noreply@github.com>
Thu, 4 Jan 2024 00:39:00 +0000 (17:39 -0700)
* kobold variety - allows kobolds to have random colors and horns

* hey lets maybe not crash in this case, lets maybe let the color continue being null in this case

* excuse us vscode what the fuck is this

* brightens kob base, makes kob outline more bold, fixes to the prototype because our code spaghett

* okay yeah angler horns just dont work At All. the floppy kobold ears, however? MWAH. chef's kis

* we've been staring at these critters all day - makes base color line up with the base color of some of the markings

Content.Server/Sprite/RandomSpriteSystem.cs
Content.Shared/Sprite/RandomSpriteComponent.cs
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Palettes/critters.yml [new file with mode: 0644]
Resources/Textures/Mobs/Animals/kobold.rsi/kobold.png
Resources/Textures/Mobs/Animals/kobold.rsi/meta.json
Resources/Textures/Mobs/Animals/kobold.rsi/outline.png [new file with mode: 0644]

index 035f7c69034bebd7d8609c64380633bc290ccf35..5d04dd2f5a6ebcc8b35a9bf4618e5d93f304ad1d 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Shared.Decals;
+using Content.Shared.Random.Helpers;
 using Content.Shared.Sprite;
 using Robust.Shared.GameStates;
 using Robust.Shared.Prototypes;
@@ -26,7 +27,7 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
         if (component.Available.Count == 0)
             return;
 
-        var groups = new List<Dictionary<string, (string, string?)>>();
+        var groups = new List<Dictionary<string, Dictionary<string, string?>>>();
         if (component.GetAllGroups)
         {
             groups = component.Available;
@@ -38,16 +39,27 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
 
         component.Selected.EnsureCapacity(groups.Count);
 
+        Color? previousColor = null;
+
         foreach (var group in groups)
         {
             foreach (var layer in group)
             {
                 Color? color = null;
 
-                if (!string.IsNullOrEmpty(layer.Value.Item2))
-                    color = _random.Pick(_prototype.Index<ColorPalettePrototype>(layer.Value.Item2).Colors.Values);
+                var selectedState = _random.Pick(layer.Value);
+                if (!string.IsNullOrEmpty(selectedState.Value))
+                {
+                    if (selectedState.Value == $"Inherit")
+                        color = previousColor;
+                    else
+                    {
+                        color = _random.Pick(_prototype.Index<ColorPalettePrototype>(selectedState.Value).Colors.Values);
+                        previousColor = color;
+                    }
+                }
 
-                component.Selected.Add(layer.Key, (layer.Value.Item1, color));
+                component.Selected.Add(layer.Key, (selectedState.Key, color));
             }
         }
 
index 4082771e9301af8a4f19cbaf8766398b47a61211..0e9133d1c85facb1729faea9f4ee3751fee10018 100644 (file)
@@ -17,7 +17,7 @@ public sealed partial class RandomSpriteComponent : Component
     /// Stored as a list so we can have groups of random sprites (e.g. tech_base + tech_flare for holoparasite)
     /// </summary>
     [ViewVariables(VVAccess.ReadWrite), DataField("available")]
-    public List<Dictionary<string, (string State, string? Color)>> Available = new();
+    public List<Dictionary<string, Dictionary<string, string?>>> Available = new();
 
     /// <summary>
     /// Selected colors
index 36288b1c8324a61b7e2096a4db39eaa2fe2e314a..a78e61f393b5caba4f2c5ddbd1d3dd721fe061d5 100644 (file)
   name: kobold
   id: MobKobold
   parent: MobMonkey
-  description: Cousins to the sentient race of lizard people, kobolds blend in with industrial tiling and are as nasty as monkeys; ready to pull out your hair and stab you to death.
+  description: Cousins to the sentient race of lizard people, kobolds blend in with their natural habitat and are as nasty as monkeys; ready to pull out your hair and stab you to death.
   components:
   - type: LizardAccent
   - type: Speech # I don't know how to get it to work and i want someone to make them speak like a lizard with normal accents (or optionally another language altogether)
     drawdepth: Mobs
     layers:
     - map: ["enum.DamageStateVisualLayers.Base"]
+      sprite: Mobs/Animals/kobold.rsi
       state: kobold
+    - map: [ "outline" ]
       sprite: Mobs/Animals/kobold.rsi
+      state: outline
+    - map: [ "horns" ]
+      sprite: Mobs/Customization/reptilian_parts.rsi
+      state: horns_short
     - map: [ "enum.HumanoidVisualLayers.Handcuffs" ]
       color: "#ffffff"
       sprite: Objects/Misc/handcuffs.rsi
       sprite: "Effects/creampie.rsi"
       state: "creampie_human"
       visible: false
+  - type: RandomSprite
+    getAllGroups: true
+    available:
+      - enum.DamageStateVisualLayers.Base:
+          kobold: KoboldColors
+      - horns:
+          horns_curled: KoboldHornColors
+          horns_ram: KoboldHornColors
+          horns_short: KoboldHornColors
+          horns_myrsore: KoboldHornColors
+          horns_bighorn: KoboldHornColors
+          horns_argali: KoboldHornColors
+          horns_ayrshire: KoboldHornColors
+          horns_floppy_kobold_ears: Inherit
+          horns_double: Inherit
+          horns_kobold_ears: Inherit
   - type: Butcherable
     butcheringType: Spike
     spawned:
diff --git a/Resources/Prototypes/Palettes/critters.yml b/Resources/Prototypes/Palettes/critters.yml
new file mode 100644 (file)
index 0000000..2f027b4
--- /dev/null
@@ -0,0 +1,43 @@
+- type: palette
+  id: KoboldColors
+  name: KoboldColors
+  colors:
+    ForestA: "#71a457"
+    ForestB: "#536f18"
+    ForestC: "#1e5026"
+    ForestD: "#519b71"
+    ForestE: "#61a003"
+    ForestF: "#729953"
+    DesertA: "#999453"
+    DesertB: "#daa976"
+    DesertC: "#a4582f"
+    DesertD: "#af9369"
+    DesertE: "#c27d3b"
+    DesertF: "#ddc3a1"
+    SwampA: "#635033"
+    SwampB: "#455132"
+    SwampC: "#4a4d12"
+    SwampD: "#452d1d"
+    SwampE: "#5f544c"
+    SwampF: "#413b0a"
+    CaveA: "#4a4260"
+    CaveB: "#3f3330"
+    CaveC: "#4a4542"
+    CaveD: "#413d32"
+    CaveE: "#726f6a"
+    CaveF: "#d4c8bf"
+    TechniRed: "#b32828"
+    TechniOrange: "#da8929"
+    TechniGreen: "#28df58"
+    TechniBlue: "#144bb3"
+    TechniCyan: "#1ddfbe"
+    TechniPurple: "#792da9"
+    TechniFuchsia: "#d11a82"
+
+- type: palette
+  id: KoboldHornColors
+  name: KoboldHornColors
+  colors:
+    HornA: "#d4c8bf"
+    hornB: "#eec7ab"
+    hornC: "#ad9584"
index 1abd0e22eb9515dfb379152e9bfc1a246590c971..4be7d2591e14555ebc01585ffe422ba7f93494b7 100644 (file)
Binary files a/Resources/Textures/Mobs/Animals/kobold.rsi/kobold.png and b/Resources/Textures/Mobs/Animals/kobold.rsi/kobold.png differ
index 33b5878391ad3231e0faac460196ced7c2815894..05e21930b6bae8f2d0bb9ccae29ac8c972c0025d 100644 (file)
@@ -5,11 +5,15 @@
     "y": 32
   },
   "license": "CC-BY-SA-3.0",
-  "copyright": "Drawn by Ubaser",
+  "copyright": "Drawn by Ubaser, modified by Bhijn and Myr",
   "states": [
     {
       "name": "kobold",
       "directions": 4
+    },
+    {
+      "name": "outline",
+      "directions": 4
     }
   ]
 }
diff --git a/Resources/Textures/Mobs/Animals/kobold.rsi/outline.png b/Resources/Textures/Mobs/Animals/kobold.rsi/outline.png
new file mode 100644 (file)
index 0000000..c1a62aa
Binary files /dev/null and b/Resources/Textures/Mobs/Animals/kobold.rsi/outline.png differ