diff --git a/Content.Client/SS220/CultYogg/MiGo/CultYoggHealVisualizerSystem.cs b/Content.Client/SS220/CultYogg/MiGo/CultYoggHealVisualizerSystem.cs new file mode 100644 index 00000000000000..cf8abdff46d6ee --- /dev/null +++ b/Content.Client/SS220/CultYogg/MiGo/CultYoggHealVisualizerSystem.cs @@ -0,0 +1,49 @@ +using Content.Shared.SS220.CultYogg.MiGo; +using Robust.Client.GameObjects; + +namespace Content.Client.SS220.CultYogg.MiGo; + +/// +/// +public sealed class CultYoggHealVisualizerSystem : VisualizerSystem +{ + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnComponentInit); + SubscribeLocalEvent(OnShutdown); + } + + private void OnShutdown(Entity uid, ref ComponentShutdown args) + { + // Need LayerMapTryGet because Init fails if there's no existing sprite / appearancecomp + // which means in some setups (most frequently no AppearanceComp) the layer never exists. + if (TryComp(uid, out var sprite) && + sprite.LayerMapTryGet(HealVisualLayers.Particles, out var layer)) + { + sprite.RemoveLayer(layer); + } + } + + private void OnComponentInit(Entity uid, ref ComponentInit args) + { + if (!TryComp(uid, out var sprite) || !TryComp(uid, out AppearanceComponent? appearance)) + return; + + sprite.LayerMapReserveBlank(HealVisualLayers.Particles); + sprite.LayerSetVisible(HealVisualLayers.Particles, true); + sprite.LayerSetShader(HealVisualLayers.Particles, "unshaded"); + + if (uid.Comp.Sprite != null) + { + sprite.LayerSetRSI(HealVisualLayers.Particles, uid.Comp.Sprite.RsiPath); + sprite.LayerSetState(HealVisualLayers.Particles, uid.Comp.Sprite.RsiState); + } + } +} + +public enum HealVisualLayers : byte +{ + Particles +} diff --git a/Content.Server/SS220/CultYogg/MiGo/CultYoggHealSystem.cs b/Content.Server/SS220/CultYogg/MiGo/CultYoggHealSystem.cs index 575f6338819732..b7b4dbc912d259 100644 --- a/Content.Server/SS220/CultYogg/MiGo/CultYoggHealSystem.cs +++ b/Content.Server/SS220/CultYogg/MiGo/CultYoggHealSystem.cs @@ -11,6 +11,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Popups; using Content.Shared.SS220.CultYogg.MiGo; +using Robust.Shared.Timing; namespace Content.Server.SS220.CultYogg.MiGo; @@ -24,6 +25,7 @@ public sealed class CultYoggHealSystem : SharedCultYoggHealSystem [Dependency] private readonly MobThresholdSystem _mobThreshold = default!; [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly SharedMindSystem _mind = default!; + [Dependency] private readonly IGameTiming _time = default!; public override void Initialize() { @@ -33,23 +35,21 @@ public override void Initialize() } private void SetupMiGoHeal(Entity uid, ref ComponentStartup args) { - uid.Comp.NextIncidentTime = uid.Comp.TimeBetweenIncidents; + uid.Comp.NextIncidentTime = _time.CurTime + uid.Comp.TimeBetweenIncidents; } - public override void Update(float frameTime)//ToDo rewrite as Timespan + public override void Update(float frameTime) { base.Update(frameTime); var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var healComp, out var _)) { - healComp.NextIncidentTime -= frameTime; - - if (healComp.NextIncidentTime > 0) + if (healComp.NextIncidentTime > _time.CurTime) continue; Heal(uid, healComp); - healComp.NextIncidentTime += healComp.TimeBetweenIncidents; + healComp.NextIncidentTime = _time.CurTime + healComp.TimeBetweenIncidents; } } public void Heal(EntityUid uid, CultYoggHealComponent component) diff --git a/Content.Server/SS220/CultYogg/Rave/RaveSystem.cs b/Content.Server/SS220/CultYogg/Rave/RaveSystem.cs index e6f062e9593b34..febdfc56ecbe64 100644 --- a/Content.Server/SS220/CultYogg/Rave/RaveSystem.cs +++ b/Content.Server/SS220/CultYogg/Rave/RaveSystem.cs @@ -71,18 +71,18 @@ private void OnExamined(Entity uid, ref ExaminedEvent args) args.PushMarkup($"[color=green]{Loc.GetString("cult-yogg-shroom-markup", ("ent", uid))}[/color]"); } - public void TryApplyRavenness(EntityUid uid, float time, StatusEffectsComponent? status = null) + public void TryApplyRavenness(EntityUid uid, TimeSpan time, StatusEffectsComponent? status = null) { if (!Resolve(uid, ref status, false)) return; if (!_statusEffectsSystem.HasStatusEffect(uid, EffectKey, status)) { - _statusEffectsSystem.TryAddStatusEffect(uid, EffectKey, TimeSpan.FromSeconds(time), true, status); + _statusEffectsSystem.TryAddStatusEffect(uid, EffectKey, time, true, status); } else { - _statusEffectsSystem.TryAddTime(uid, EffectKey, TimeSpan.FromSeconds(time), status); + _statusEffectsSystem.TryAddTime(uid, EffectKey, time, status); } } diff --git a/Content.Server/SS220/EntityEffects/Effects/ChemMiGomicelium.cs b/Content.Server/SS220/EntityEffects/Effects/ChemMiGomicelium.cs index 85eb85902b41af..e1f504518ddb98 100644 --- a/Content.Server/SS220/EntityEffects/Effects/ChemMiGomicelium.cs +++ b/Content.Server/SS220/EntityEffects/Effects/ChemMiGomicelium.cs @@ -50,7 +50,7 @@ public override void Effect(EntityEffectBaseArgs args) if (entityManager.HasComponent(args.TargetEntity)) { - entityManager.System().TryApplyRavenness(args.TargetEntity, time); + entityManager.System().TryApplyRavenness(args.TargetEntity, TimeSpan.FromSeconds(time)); } } //ToDo check the guidebook diff --git a/Content.Shared/SS220/CultYogg/MiGo/CultYoggHealComponent.cs b/Content.Shared/SS220/CultYogg/MiGo/CultYoggHealComponent.cs index 12c43675ccbeca..bcca8c0054a3fc 100644 --- a/Content.Shared/SS220/CultYogg/MiGo/CultYoggHealComponent.cs +++ b/Content.Shared/SS220/CultYogg/MiGo/CultYoggHealComponent.cs @@ -2,6 +2,7 @@ using Robust.Shared.GameStates; using System.Text.Json.Serialization; using Content.Shared.Damage; +using Robust.Shared.Utility; namespace Content.Shared.SS220.CultYogg.MiGo; @@ -33,7 +34,10 @@ public sealed partial class CultYoggHealComponent : Component /// /// Time between each healing incident /// - public float TimeBetweenIncidents = 2.5f; // most balanced value + public TimeSpan TimeBetweenIncidents = TimeSpan.FromSeconds(2.5); // most balanced value - public float NextIncidentTime;//ToDo make it timespan + public TimeSpan? NextIncidentTime; + + [DataField("sprite")] + public SpriteSpecifier.Rsi Sprite = new(new("SS220/Effects/cult_yogg_healing.rsi"), "healingEffect"); } diff --git a/Content.Shared/SS220/CultYogg/MiGo/MiGoComponent.cs b/Content.Shared/SS220/CultYogg/MiGo/MiGoComponent.cs index 81b15ea0f8a121..0fd369064e0f67 100644 --- a/Content.Shared/SS220/CultYogg/MiGo/MiGoComponent.cs +++ b/Content.Shared/SS220/CultYogg/MiGo/MiGoComponent.cs @@ -60,7 +60,7 @@ public sealed partial class MiGoComponent : Component /// ///Erect variables /// - public float HealingEffectTime = 15;//How long heal effect will occure + public TimeSpan HealingEffectTime = TimeSpan.FromSeconds(15);//How long heal effect will occure /// ///Erect variables diff --git a/Content.Shared/SS220/CultYogg/MiGo/SharedCultYoggHealSystem.cs b/Content.Shared/SS220/CultYogg/MiGo/SharedCultYoggHealSystem.cs index bce04731d7d49f..dce9febd961d8e 100644 --- a/Content.Shared/SS220/CultYogg/MiGo/SharedCultYoggHealSystem.cs +++ b/Content.Shared/SS220/CultYogg/MiGo/SharedCultYoggHealSystem.cs @@ -14,18 +14,18 @@ public override void Initialize() { base.Initialize(); } - public void TryApplyMiGoHeal(EntityUid uid, float time, StatusEffectsComponent? statusComp = null) + public void TryApplyMiGoHeal(EntityUid uid, TimeSpan time, StatusEffectsComponent? statusComp = null) { if (!Resolve(uid, ref statusComp, false)) return; if (!_statusEffectsSystem.HasStatusEffect(uid, EffectkKey, statusComp)) { - _statusEffectsSystem.TryAddStatusEffect(uid, EffectkKey, TimeSpan.FromSeconds(time), true, statusComp); + _statusEffectsSystem.TryAddStatusEffect(uid, EffectkKey, time, true, statusComp); } else { - _statusEffectsSystem.TryAddTime(uid, EffectkKey, TimeSpan.FromSeconds(time), statusComp); + _statusEffectsSystem.TryAddTime(uid, EffectkKey, time, statusComp); } } diff --git a/Content.Shared/SS220/CultYogg/Pod/CultYoggPodComponent.cs b/Content.Shared/SS220/CultYogg/Pod/CultYoggPodComponent.cs index e3e26ff0a87c44..49267fcaf27ad5 100644 --- a/Content.Shared/SS220/CultYogg/Pod/CultYoggPodComponent.cs +++ b/Content.Shared/SS220/CultYogg/Pod/CultYoggPodComponent.cs @@ -13,7 +13,7 @@ public sealed partial class CultYoggPodComponent : Component /// Time between each healing incident /// [DataField] - public float HealingFreq = 0.5f; + public TimeSpan HealingFreq = TimeSpan.FromSeconds(1); [DataField] public DamageSpecifier Heal = new DamageSpecifier // god forgive me for hardcoding values diff --git a/Resources/Prototypes/SS220/CultYogg/pond.yml b/Resources/Prototypes/SS220/CultYogg/pond.yml index 5b0b484fb785bf..385a3582c7636f 100644 --- a/Resources/Prototypes/SS220/CultYogg/pond.yml +++ b/Resources/Prototypes/SS220/CultYogg/pond.yml @@ -30,9 +30,8 @@ - type: DrawableSolution solution: drink - type: Sprite - sprite: Structures/Storage/tanks.rsi - layers: - - state: watertank-2 + sprite: SS220/Structures/CultYogg/yoggpond.rsi + state: pond - type: InteractionOutline - type: Transform noRot: true diff --git a/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/healingEffect.png b/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/healingEffect.png new file mode 100644 index 00000000000000..e1798e1caff5ff Binary files /dev/null and b/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/healingEffect.png differ diff --git a/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/meta.json b/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/meta.json new file mode 100644 index 00000000000000..89be0ab87bec5b --- /dev/null +++ b/Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/meta.json @@ -0,0 +1,49 @@ +{ + "version": 1, + "license": "EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt", + "copyright": "Made by ci24v3n for SS220", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "healingEffect", + "directions": 4, + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ], + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ], + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ], + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + } + ] +} diff --git a/Resources/Textures/SS220/Structures/CultYogg/yoggaltar.rsi/meta.json b/Resources/Textures/SS220/Structures/CultYogg/yoggaltar.rsi/meta.json index feb070b3039e89..2a686008e6059b 100644 --- a/Resources/Textures/SS220/Structures/CultYogg/yoggaltar.rsi/meta.json +++ b/Resources/Textures/SS220/Structures/CultYogg/yoggaltar.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, - "license": "CC-BY-SA-3.0", - "copyright": "From Gabka for 220", + "license": "EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt", + "copyright": "From Gabka for SS220", "size": { "x": 32, "y": 32 diff --git a/Resources/Textures/SS220/Structures/CultYogg/yoggpod.rsi/meta.json b/Resources/Textures/SS220/Structures/CultYogg/yoggpod.rsi/meta.json index 08bd483d4b77a9..d4e3a9519e9a29 100644 --- a/Resources/Textures/SS220/Structures/CultYogg/yoggpod.rsi/meta.json +++ b/Resources/Textures/SS220/Structures/CultYogg/yoggpod.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, - "license": "CC-BY-SA-3.0", - "copyright": "From @CANA for 220 with love", + "license": "EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt", + "copyright": "From @CANA for 220", "size": { "x": 32, "y": 32 diff --git a/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/meta.json b/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/meta.json new file mode 100644 index 00000000000000..997f81744e3cdd --- /dev/null +++ b/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt", + "copyright": "From plagexx for 220 with love", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "pond" + } + ] +} diff --git a/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/pond.png b/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/pond.png new file mode 100644 index 00000000000000..5c5829799e7c4a Binary files /dev/null and b/Resources/Textures/SS220/Structures/CultYogg/yoggpond.rsi/pond.png differ