Skip to content

Commit

Permalink
add new sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
SkaldetSkaeg committed Dec 10, 2024
1 parent dc900be commit 3ed6a52
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 24 deletions.
49 changes: 49 additions & 0 deletions Content.Client/SS220/CultYogg/MiGo/CultYoggHealVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.SS220.CultYogg.MiGo;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.CultYogg.MiGo;

/// <summary>
/// </summary>
public sealed class CultYoggHealVisualizerSystem : VisualizerSystem<CultYoggHealComponent>
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CultYoggHealComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<CultYoggHealComponent, ComponentShutdown>(OnShutdown);
}

private void OnShutdown(Entity<CultYoggHealComponent> 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<SpriteComponent>(uid, out var sprite) &&
sprite.LayerMapTryGet(HealVisualLayers.Particles, out var layer))
{
sprite.RemoveLayer(layer);
}
}

private void OnComponentInit(Entity<CultYoggHealComponent> uid, ref ComponentInit args)
{
if (!TryComp<SpriteComponent>(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
}
12 changes: 6 additions & 6 deletions Content.Server/SS220/CultYogg/MiGo/CultYoggHealSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()
{
Expand All @@ -33,23 +35,21 @@ public override void Initialize()
}
private void SetupMiGoHeal(Entity<CultYoggHealComponent> 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<CultYoggHealComponent, MobStateComponent>();
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)
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/SS220/CultYogg/Rave/RaveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ private void OnExamined(Entity<RaveComponent> 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<RaveComponent>(uid, EffectKey, TimeSpan.FromSeconds(time), true, status);
_statusEffectsSystem.TryAddStatusEffect<RaveComponent>(uid, EffectKey, time, true, status);
}
else
{
_statusEffectsSystem.TryAddTime(uid, EffectKey, TimeSpan.FromSeconds(time), status);
_statusEffectsSystem.TryAddTime(uid, EffectKey, time, status);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public override void Effect(EntityEffectBaseArgs args)

if (entityManager.HasComponent<HumanoidAppearanceComponent>(args.TargetEntity))
{
entityManager.System<RaveSystem>().TryApplyRavenness(args.TargetEntity, time);
entityManager.System<RaveSystem>().TryApplyRavenness(args.TargetEntity, TimeSpan.FromSeconds(time));
}
}
//ToDo check the guidebook
Expand Down
8 changes: 6 additions & 2 deletions Content.Shared/SS220/CultYogg/MiGo/CultYoggHealComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -33,7 +34,10 @@ public sealed partial class CultYoggHealComponent : Component
/// <summary>
/// Time between each healing incident
/// </summary>
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");
}
2 changes: 1 addition & 1 deletion Content.Shared/SS220/CultYogg/MiGo/MiGoComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public sealed partial class MiGoComponent : Component
/// <summary>
///Erect variables
/// <summary>
public float HealingEffectTime = 15;//How long heal effect will occure
public TimeSpan HealingEffectTime = TimeSpan.FromSeconds(15);//How long heal effect will occure

/// <summary>
///Erect variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CultYoggHealComponent>(uid, EffectkKey, TimeSpan.FromSeconds(time), true, statusComp);
_statusEffectsSystem.TryAddStatusEffect<CultYoggHealComponent>(uid, EffectkKey, time, true, statusComp);
}
else
{
_statusEffectsSystem.TryAddTime(uid, EffectkKey, TimeSpan.FromSeconds(time), statusComp);
_statusEffectsSystem.TryAddTime(uid, EffectkKey, time, statusComp);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/SS220/CultYogg/Pod/CultYoggPodComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed partial class CultYoggPodComponent : Component
/// Time between each healing incident
/// </summary>
[DataField]
public float HealingFreq = 0.5f;
public TimeSpan HealingFreq = TimeSpan.FromSeconds(1);

[DataField]
public DamageSpecifier Heal = new DamageSpecifier // god forgive me for hardcoding values
Expand Down
5 changes: 2 additions & 3 deletions Resources/Prototypes/SS220/CultYogg/pond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions Resources/Textures/SS220/Effects/cult_yogg_healing.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -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
]
]
}
]
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3ed6a52

Please sign in to comment.