Skip to content

Commit

Permalink
added effects
Browse files Browse the repository at this point in the history
  • Loading branch information
SkaldetSkaeg committed Dec 10, 2024
1 parent 58e91ad commit dc900be
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.SS220.CultYogg.Cultists;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.CultYogg.Cultists;

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

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

private void OnShutdown(Entity<AcsendingComponent> 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(AcsendingVisualLayers.Particles, out var layer))
{
sprite.RemoveLayer(layer);
}
}

private void OnComponentInit(Entity<AcsendingComponent> uid, ref ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) || !TryComp(uid, out AppearanceComponent? appearance))
return;

sprite.LayerMapReserveBlank(AcsendingVisualLayers.Particles);
sprite.LayerSetVisible(AcsendingVisualLayers.Particles, true);
sprite.LayerSetShader(AcsendingVisualLayers.Particles, "unshaded");

if (uid.Comp.Sprite != null)
{
sprite.LayerSetRSI(AcsendingVisualLayers.Particles, uid.Comp.Sprite.RsiPath);
sprite.LayerSetState(AcsendingVisualLayers.Particles, uid.Comp.Sprite.RsiState);
}
}
}

public enum AcsendingVisualLayers : byte
{
Particles
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.SS220.CultYogg.Cultists;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.CultYogg.Cultists;

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

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

private void OnShutdown(Entity<CultYoggCleansedComponent> 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(CleansingVisualLayers.Particles, out var layer))
{
sprite.RemoveLayer(layer);
}
}

private void OnComponentInit(Entity<CultYoggCleansedComponent> uid, ref ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) || !TryComp(uid, out AppearanceComponent? appearance))
return;

sprite.LayerMapReserveBlank(CleansingVisualLayers.Particles);
sprite.LayerSetVisible(CleansingVisualLayers.Particles, true);
sprite.LayerSetShader(CleansingVisualLayers.Particles, "unshaded");

if (uid.Comp.Sprite != null)
{
sprite.LayerSetRSI(CleansingVisualLayers.Particles, uid.Comp.Sprite.RsiPath);
sprite.LayerSetState(CleansingVisualLayers.Particles, uid.Comp.Sprite.RsiState);
}
}
}

public enum CleansingVisualLayers : byte
{
Particles
}
2 changes: 1 addition & 1 deletion Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ private void ForcedAcsending(Entity<CultYoggComponent> uid, ref CultYoggForceAsc
}
public void ModifyEatenShrooms(EntityUid uid, CultYoggComponent comp)//idk if it is canser or no, will be like that for a time
{
RemComp<CultYoggCleansedComponent>(uid);
if (HasComp<AcsendingComponent>(uid))
return;

Expand Down Expand Up @@ -320,7 +321,6 @@ private void OnSaintWaterDrinked(Entity<CultYoggComponent> uid, ref OnSaintWater
{
//After cleansing effect
_audio.PlayEntity(cleansedComp.CleansingCollection, uid, uid);
SpawnAttachedTo(cleansedComp.CleansingEffect, Transform(uid).Coordinates);

//Removing stage visuals, cause later component will be removed
var ev = new CultYoggDeleteVisualsEvent();
Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/SS220/CultYogg/Cultists/AcsendingComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Robust.Shared.GameStates;
using Robust.Shared.Utility;

namespace Content.Shared.SS220.CultYogg.Cultists;

Expand All @@ -16,4 +17,7 @@ public sealed partial class AcsendingComponent : Component
/// Buffer that contains next event
/// </summary>
public TimeSpan AcsendingTime;

[DataField("sprite")]
public SpriteSpecifier.Rsi Sprite = new(new("SS220/Effects/cult_yogg_acsending.rsi"), "acsendingEffect");
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.FixedPoint;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Numerics;
using Robust.Shared.Audio;

Expand All @@ -27,11 +27,8 @@ public sealed partial class CultYoggCleansedComponent : Component
[DataField]
public SoundSpecifier CleansingCollection = new SoundCollectionSpecifier("CultYoggCleansingSounds");

/// <summary>
/// Visual effect to spawn when entity corrupted from this recipe gets reversed back
/// </summary>
[DataField]
public EntProtoId CleansingEffect = "CultYoggCleansingEffect";
[DataField("sprite")]
public SpriteSpecifier.Rsi Sprite = new(new("SS220/Effects/cult_yogg_cleansing.rsi"), "cleansingEffect");

/// <summary>
/// Amount of time requierd to requied for cleansind removal
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions Resources/Textures/SS220/Effects/cult_yogg_acsending.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"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 AftrLite for SS220",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "acsendingEffect",
"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,
0.15,
0.15,
0.15,
0.15,
0.15,
0.15
]
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"states": [
{
"name": "cleansing_effect",
"name": "cleansingEffect",
"delays": [
[
0.15,
Expand Down

0 comments on commit dc900be

Please sign in to comment.