From eef3c6a5c7b8d9e36bba42d417eb43f14360ff43 Mon Sep 17 00:00:00 2001 From: Tom Leys Date: Sat, 6 May 2023 17:08:50 +1200 Subject: [PATCH] Meat kudzu (from anomoly) more killable, telegraphs better (#16107) --- .../Spreader/GrowingKudzuComponent.cs | 3 - Content.Server/Spreader/KudzuComponent.cs | 24 +++++++ Content.Server/Spreader/KudzuSystem.cs | 61 ++++++++++++++++-- .../Entities/Objects/Misc/kudzu.yml | 42 +++++++++++- .../Objects/Misc/fleshkudzu.rsi/kudzu_11.png | Bin 0 -> 468 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_12.png | Bin 0 -> 468 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_13.png | Bin 0 -> 468 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_21.png | Bin 0 -> 491 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_22.png | Bin 0 -> 491 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_23.png | Bin 0 -> 491 bytes .../fleshkudzu.rsi/{base.png => kudzu_31.png} | Bin .../Objects/Misc/fleshkudzu.rsi/kudzu_32.png | Bin 0 -> 1047 bytes .../Objects/Misc/fleshkudzu.rsi/kudzu_33.png | Bin 0 -> 1047 bytes .../Objects/Misc/fleshkudzu.rsi/meta.json | 32 +++++++-- 14 files changed, 145 insertions(+), 17 deletions(-) create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_11.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_12.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_13.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_21.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_22.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_23.png rename Resources/Textures/Objects/Misc/fleshkudzu.rsi/{base.png => kudzu_31.png} (100%) create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_32.png create mode 100644 Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_33.png diff --git a/Content.Server/Spreader/GrowingKudzuComponent.cs b/Content.Server/Spreader/GrowingKudzuComponent.cs index 52a122ef19..b3f571dea8 100644 --- a/Content.Server/Spreader/GrowingKudzuComponent.cs +++ b/Content.Server/Spreader/GrowingKudzuComponent.cs @@ -11,9 +11,6 @@ public sealed class GrowingKudzuComponent : Component [DataField("growthLevel")] public int GrowthLevel = 1; - [DataField("growthTickChance")] - public float GrowthTickChance = 1f; - /// /// The next time kudzu will try to tick its growth level. /// diff --git a/Content.Server/Spreader/KudzuComponent.cs b/Content.Server/Spreader/KudzuComponent.cs index ae4aedf650..8fcc56c5dd 100644 --- a/Content.Server/Spreader/KudzuComponent.cs +++ b/Content.Server/Spreader/KudzuComponent.cs @@ -1,3 +1,5 @@ +using Content.Shared.Damage; + namespace Content.Server.Spreader; /// @@ -11,4 +13,26 @@ public sealed class KudzuComponent : Component /// [DataField("spreadChance")] public float SpreadChance = 1f; + + /// + /// How much damage is required to reduce growth level + /// + [DataField("growthHealth")] + public float GrowthHealth = 10.0f; + + /// + /// How much damage is required to prevent growth + /// + [DataField("growthBlock")] + public float GrowthBlock = 20.0f; + + /// + /// How much the kudzu heals each tick + /// + [DataField("damageRecovery")] + public DamageSpecifier? DamageRecovery = null; + + [DataField("growthTickChance")] + public float GrowthTickChance = 1f; + } diff --git a/Content.Server/Spreader/KudzuSystem.cs b/Content.Server/Spreader/KudzuSystem.cs index 407d99e478..fa19783653 100644 --- a/Content.Server/Spreader/KudzuSystem.cs +++ b/Content.Server/Spreader/KudzuSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Damage; using Content.Shared.Spreader; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -9,6 +10,7 @@ public sealed class KudzuSystem : EntitySystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly DamageableSystem _damageable = default!; private const string KudzuGroup = "kudzu"; @@ -19,6 +21,28 @@ public sealed class KudzuSystem : EntitySystem SubscribeLocalEvent(OnKudzuSpread); SubscribeLocalEvent(OnKudzuUnpaused); SubscribeLocalEvent(OnKudzuUpdateRate); + SubscribeLocalEvent(OnDamageChanged); + } + + private void OnDamageChanged(EntityUid uid, KudzuComponent component, DamageChangedEvent args) + { + // Every time we take any damage, we reduce growth depending on all damage over the growth impact + // So the kudzu gets slower growing the more it is hurt. + int growthDamage = (int) (args.Damageable.TotalDamage / component.GrowthHealth); + if (growthDamage > 0) + { + GrowingKudzuComponent? growing; + if (!TryComp(uid, out growing)) + { + growing = AddComp(uid); + growing.GrowthLevel = 3; + } + growing.GrowthLevel = Math.Max(1, growing.GrowthLevel - growthDamage); + if (EntityManager.TryGetComponent(uid, out var appearance)) + { + _appearance.SetData(uid, KudzuVisuals.GrowthLevel, growing.GrowthLevel, appearance); + } + } } private void OnKudzuSpread(EntityUid uid, KudzuComponent component, ref SpreadNeighborsEvent args) @@ -83,32 +107,55 @@ public sealed class KudzuSystem : EntitySystem /// public override void Update(float frameTime) { - var query = EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); var curTime = _timing.CurTime; - while (query.MoveNext(out var uid, out var kudzu, out var appearance)) + while (query.MoveNext(out var uid, out var grow, out var kudzu)) { - if (kudzu.NextTick > curTime) + if (grow.NextTick > curTime) { continue; } - kudzu.NextTick = curTime + TimeSpan.FromSeconds(0.5); + grow.NextTick = curTime + TimeSpan.FromSeconds(0.5); if (!_robustRandom.Prob(kudzu.GrowthTickChance)) { continue; } - kudzu.GrowthLevel += 1; + if (TryComp(uid, out var damage)) + { + if (damage.TotalDamage > 1.0) + { + if (kudzu.DamageRecovery != null) + { + // This kudzu features healing, so Gradually heal + _damageable.TryChangeDamage(uid, kudzu.DamageRecovery, true); + } + if (damage.TotalDamage >= kudzu.GrowthBlock) + { + // Don't grow when quite damaged + if (_robustRandom.Prob(0.95f)) + { + continue; + } + } + } + } - if (kudzu.GrowthLevel >= 3) + grow.GrowthLevel += 1; + + if (grow.GrowthLevel >= 3) { // why cache when you can simply cease to be? Also saves a bit of memory/time. RemCompDeferred(uid); } - _appearance.SetData(uid, KudzuVisuals.GrowthLevel, kudzu.GrowthLevel, appearance); + if (EntityManager.TryGetComponent(uid, out var appearance)) + { + _appearance.SetData(uid, KudzuVisuals.GrowthLevel, grow.GrowthLevel, appearance); + } } } } diff --git a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml index 79d4fc15f5..40fdcab8f8 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml @@ -70,8 +70,8 @@ Heat: 10 - type: AtmosExposed - type: Kudzu - - type: GrowingKudzu growthTickChance: 0.3 + - type: GrowingKudzu - type: SlowContacts walkSpeedModifier: 0.2 sprintSpeedModifier: 0.2 @@ -119,10 +119,11 @@ "/Audio/Weapons/slash.ogg" - type: Sprite sprite: Objects/Misc/fleshkudzu.rsi - state: base + state: kudzu_11 drawdepth: Overdoors netsync: false - type: Appearance + - type: KudzuVisuals - type: Clickable - type: Transform anchored: true @@ -141,7 +142,7 @@ thresholds: - trigger: !type:DamageTrigger - damage: 10 + damage: 40 behaviors: - !type:DoActsBehavior acts: [ "Destruction" ] @@ -154,6 +155,33 @@ tags: - Flesh - type: Kudzu + growthTickChance: 0.3 + # Heals each time it manages to do a growth tick: + damageRecovery: + types: + Slash: -0.5 + Heat: -1.0 + Cold: -1.0 + Blunt: -0.5 # Needs to be balanced (approx 3x) with vacuum damage to stall but not kill Kudzu + - type: Temperature + heatDamage: + types: + Heat: 10 + coldDamage: + types: + Cold: 5 #per second, scales with temperature & other constants + - type: Barotrauma + damage: + types: + Blunt: 0.15 #per second, scales with pressure and other constants. + - type: Flammable + fireSpread: true + damage: + types: + Heat: 1 + - type: GrowingKudzu + growthTickChance: 0.3 + - type: AtmosExposed - type: EdgeSpreader - type: NodeContainer nodes: @@ -174,3 +202,11 @@ reagents: - ReagentId: Protein Quantity: 2 + - type: Respirator + damage: + types: + Asphyxiation: 0.25 + damageRecovery: + types: + Asphyxiation: -0.25 + diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_11.png b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_11.png new file mode 100644 index 0000000000000000000000000000000000000000..afc0e28c568f8ed07fe543e921ab1354b09dbd88 GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCim11AIbUec2VWcy;?EZR$i!fnp33|J($UtR+Ey!T*7P;rBMaV4whJfk$L9 z0|Vb-5N14{zaj-_xUHv)V~B-+>SV@gM-(`m9rym9`CZ*1JKZ=xibqo+Lq=exp!TW0 zt&{A%=M}oR8-dghkK9jnZOg*qc{_y6;90P=ViGo z!Wf8*C`_vX`0=h&22 zE==v6TJ@V(I!kNJao645(O>`TadS%YpSiE*R+wh}shGw$(Qh87 z#`#4opR8Vb#9=??a!6fqUDP%7V>MxZF8UeWEazo$LivzluSQtzP#>K zqfh#**=J<^g0mX)8kQwW`xRgOEjpodx6R#!(odtc&&jX3%QctffPDri)IDAOT-G@y GGywpWx4k3) literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_12.png b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_12.png new file mode 100644 index 0000000000000000000000000000000000000000..afc0e28c568f8ed07fe543e921ab1354b09dbd88 GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCim11AIbUec2VWcy;?EZR$i!fnp33|J($UtR+Ey!T*7P;rBMaV4whJfk$L9 z0|Vb-5N14{zaj-_xUHv)V~B-+>SV@gM-(`m9rym9`CZ*1JKZ=xibqo+Lq=exp!TW0 zt&{A%=M}oR8-dghkK9jnZOg*qc{_y6;90P=ViGo z!Wf8*C`_vX`0=h&22 zE==v6TJ@V(I!kNJao645(O>`TadS%YpSiE*R+wh}shGw$(Qh87 z#`#4opR8Vb#9=??a!6fqUDP%7V>MxZF8UeWEazo$LivzluSQtzP#>K zqfh#**=J<^g0mX)8kQwW`xRgOEjpodx6R#!(odtc&&jX3%QctffPDri)IDAOT-G@y GGywpWx4k3) literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_13.png b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_13.png new file mode 100644 index 0000000000000000000000000000000000000000..afc0e28c568f8ed07fe543e921ab1354b09dbd88 GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCim11AIbUec2VWcy;?EZR$i!fnp33|J($UtR+Ey!T*7P;rBMaV4whJfk$L9 z0|Vb-5N14{zaj-_xUHv)V~B-+>SV@gM-(`m9rym9`CZ*1JKZ=xibqo+Lq=exp!TW0 zt&{A%=M}oR8-dghkK9jnZOg*qc{_y6;90P=ViGo z!Wf8*C`_vX`0=h&22 zE==v6TJ@V(I!kNJao645(O>`TadS%YpSiE*R+wh}shGw$(Qh87 z#`#4opR8Vb#9=??a!6fqUDP%7V>MxZF8UeWEazo$LivzluSQtzP#>K zqfh#**=J<^g0mX)8kQwW`xRgOEjpodx6R#!(odtc&&jX3%QctffPDri)IDAOT-G@y GGywpWx4k3) literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_21.png b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_21.png new file mode 100644 index 0000000000000000000000000000000000000000..8dcb373e1eee219acd86e891c4a8c743a42ba5e8 GIT binary patch literal 491 zcmeAS@N?(olHy`uVBq!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9n&zUhfm@T`&1T^S_Oh&Mu_@xSsR@BOTZ6{}lN3MNsLLZqqAK@gJ%Ko+qZW Rzv=)0002ovPDHLkV1nH{>MQ^N literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_33.png b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/kudzu_33.png new file mode 100644 index 0000000000000000000000000000000000000000..659b2ea9799b7e6a8010a63614d33f974c66d428 GIT binary patch literal 1047 zcmV+y1nB#TP)Px&(Md!>R9J3U@q>01_P*FuR+w6~Qnlw== zDn7u{Hd`QVnT9^HR&Xng>z7iGKBIeAvKrI zOs%jET0UnIn%JRp=R}rw6v>%_io6o9BD1W=lxt8Z8-+Gx3HMdX-`uJz~jj(_=Oy`X2cmCNg@i$5M{F^W*Zi zsJm)yfsjZeG6*^Ibv9)XZj|kqf(cR`u|z;#RA2GIxeIE7Ve#-ffm^w3fKqMeiz#1F zx|wWDndau72q`qNgW0lhDH_TQzzGqYxPY38psUON-2R{g4^8a2@&R={8JCSG=Q!}% zwfh0dd@%)POLi)glIJQ^OpaxpWhaLwcGml(vRctQ3ZBYFwj`%WinsE>$nSi)Y>*=| zr1hv@Y^8b^d{PR4*ozLfxE9-k*0wi?S)lB%V=vJbV=B7liCCNTZH}3VV%M78R8{L(QrrhhLbDLAC!yB{+ z;@pJD4;PmfkN5Att&3*eg+k7+F9Iay03C!)WJ1*Bjl>*yWaM)BRYU5#fpj*A03pRm3w8-s*`k-UDc88td`47KQY4dAp` z>g7^iK9n&zUhfm@T`&1T^S_Oh&Mu_@xSsR@BOTZ6{}lN3MNsLLZqqAK@gJ%Ko+qZW Rzv=)0002ovPDHLkV1nH{>MQ^N literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/meta.json b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/meta.json index fc8bf10c30..66738c8e11 100644 --- a/Resources/Textures/Objects/Misc/fleshkudzu.rsi/meta.json +++ b/Resources/Textures/Objects/Misc/fleshkudzu.rsi/meta.json @@ -1,14 +1,38 @@ { "version": 1, "license": "CC0-1.0", - "copyright": "Created by EmoGarbage404 (github) for space-station-14", + "copyright": "Created by EmoGarbage404 & tom-leys (github) for space-station-14", "size": { "x": 32, "y": 32 }, "states": [ - { - "name": "base" - } + { + "name": "kudzu_33" + }, + { + "name": "kudzu_32" + }, + { + "name": "kudzu_31" + }, + { + "name": "kudzu_23" + }, + { + "name": "kudzu_22" + }, + { + "name": "kudzu_21" + }, + { + "name": "kudzu_13" + }, + { + "name": "kudzu_12" + }, + { + "name": "kudzu_11" + } ] }