Skip to content

Commit

Permalink
Deconversion system complete.. For now. Minimum-viably complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
AftrLite committed Jan 14, 2025
1 parent 0a5008a commit 3764ab9
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 20 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@
],
"preLaunchTask": "build"
},
{
"name": "Server/2xClient",
"configurations": [
"Server",
"Client",
"Client"
],
"preLaunchTask": "build"
},
{
"name": "Server/Client (Tools Config)",
"configurations": [
Expand All @@ -87,6 +96,14 @@
"Server",
"Client"
],
},
{
"name": "Server/2xClient (No Build)",
"configurations": [
"Server",
"Client",
"Client"
],
}
]
}
41 changes: 29 additions & 12 deletions Content.Server/_Impstation/CosmicCult/CleanseDeconversionSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server._Impstation.CosmicCult.Components;
using Content.Server.Bible.Components;
using Content.Server.Body.Components;
using Content.Server.Medical.Components;
using Content.Server.PowerCell;
Expand All @@ -18,7 +19,9 @@
using Content.Shared.Jittering;
using Content.Shared.MedicalScanner;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
using Content.Shared.Timing;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
Expand All @@ -33,11 +36,10 @@ public sealed class CleanseDeconversionSystem : EntitySystem
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly ItemToggleSystem _toggle = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly UseDelaySystem _delay = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -70,8 +72,20 @@ public override void Update(float frameTime)

private void OnAfterInteract(Entity<CleanseOnUseComponent> uid, ref AfterInteractEvent args)
{
if (args.Target == null || !args.CanReach || !HasComp<MobStateComponent>(args.Target))
if (!TryComp(uid, out UseDelayComponent? useDelay) || _delay.IsDelayed((uid, useDelay)))
return;
if (!args.CanReach || args.Target == null || !_mobState.IsAlive(args.Target.Value))
return;

if (!HasComp<BibleUserComponent>(args.User))
{
_popup.PopupEntity(Loc.GetString("cleanse-item-sizzle", ("target", Identity.Entity(args.Used, EntityManager))), args.User, args.User);

_audio.PlayPvs(uid.Comp.SizzleSound, args.User);
_damageable.TryChangeDamage(args.User, uid.Comp.SelfDamage, origin: uid);
_delay.TryResetDelay((uid, useDelay));
return;
}

_popup.PopupEntity(Loc.GetString("cleanse-deconvert-attempt-begin", ("target", Identity.Entity(args.User, EntityManager))), args.User, args.Target.Value);
_popup.PopupEntity(Loc.GetString("cleanse-deconvert-attempt-begin-user", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.User, args.User);
Expand All @@ -93,20 +107,24 @@ private void OnAfterInteract(Entity<CleanseOnUseComponent> uid, ref AfterInterac

private void OnDoAfter(Entity<CleanseOnUseComponent> uid, ref CleanseOnDoAfterEvent args)
{
if (args.Cancelled || args.Handled)
return;
if (args.Args.Target == null)
return;
var target = args.Args.Target;
if (!TryComp(uid, out UseDelayComponent? useDelay) || args.Cancelled || args.Handled || target == null || !_mobState.IsAlive(target.Value))
return;
//TODO: This could be made more agnostic, but there's only one cult for now, and frankly, i'm fucking tired. This is easy to read and easy to modify code. Expand it at thine leisure.

_popup.PopupEntity(Loc.GetString("cleanse-deconvert-attempt-success", ("target", Identity.Entity(target.Value, EntityManager))), uid, uid);
if (_entMan.HasComponent<CosmicCultComponent>(args.Target))
{
var tgtpos = Transform(target.Value).Coordinates;
// Spawn(uid.Comp.CleanseVFX, tgtpos);
Spawn(uid.Comp.CleanseVFX, tgtpos);
DeconvertCultist(target.Value);
_audio.PlayPvs(uid.Comp.CleanseSound, tgtpos, AudioParams.Default.WithVolume(+6f));
_popup.PopupEntity(Loc.GetString("cleanse-deconvert-attempt-success", ("target", Identity.Entity(target.Value, EntityManager))), args.User, args.User);
}
else
{
_popup.PopupEntity(Loc.GetString("cleanse-deconvert-attempt-notcult", ("target", Identity.Entity(target.Value, EntityManager))), args.User, args.User);
}
_delay.TryResetDelay((uid, useDelay));
args.Handled = true;
}

Expand All @@ -123,5 +141,4 @@ public void DeconvertCultist(EntityUid uid)
RemComp<CosmicCultLeadComponent>(uid);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
Expand All @@ -18,17 +19,20 @@ public sealed partial class CleanseOnUseComponent : Component
public TimeSpan UseTime = TimeSpan.FromSeconds(25);

[DataField]
public EntityUid? ScannedEntity;
public SoundSpecifier SizzleSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");

[DataField]
public float MaxScanRange = 1.5f;
public SoundSpecifier CleanseSound = new SoundPathSpecifier("/Audio/_Impstation/CosmicCult/cleanse_deconversion.ogg");

[DataField]
public SoundSpecifier? ScanningBeginSound;
public EntProtoId CleanseVFX = "CleanseEffectVFX";

[DataField]
public SoundSpecifier CleanseSound = new SoundPathSpecifier("/Audio/Items/Medical/healthscanner.ogg");
[DataField, AutoNetworkedField]
public DamageSpecifier SelfDamage = new()
{
DamageDict = new() {
{ "Caustic", 15 }
}
};

[DataField]
public EntProtoId CleanseVFX = "CleanseEffectVFX";
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cleanse-deconvert-attempt-begin = {CAPITALIZE(THE($target))} holds a rosary out towards you!
cleanse-deconvert-attempt-begin-user = You attempt to cleanse {CAPITALIZE(THE($target))} of otherworldly influences!
cleanse-deconvert-attempt-success = You cleanse {CAPITALIZE(THE($target))} completely!
cleanse-deconvert-attempt-success = You cleanse {CAPITALIZE(THE($target))} in a cascade of holy light!
cleanse-deconvert-attempt-notcult = {CAPITALIZE(THE($target))} wasn't under the influence of anything.
cleanse-item-sizzle = {CAPITALIZE(THE($target))} sizzles in your hands!
46 changes: 46 additions & 0 deletions Resources/Prototypes/_Impstation/CosmicCult/Effects/effects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
property: Energy
enabled: true
reverseWhenFinished: true
- type: Tag
tags:
- HideContextMenu

- type: entity
categories: [ HideSpawnMenu ]
Expand Down Expand Up @@ -62,6 +65,9 @@
enabled: true
isLooped: true
reverseWhenFinished: true
- type: Tag
tags:
- HideContextMenu

- type: entity
categories: [ HideSpawnMenu ]
Expand All @@ -81,6 +87,9 @@
shader: unshaded
netsync: false
drawdepth: Mobs
- type: Tag
tags:
- HideContextMenu

- type: entity
categories: [ HideSpawnMenu ]
Expand Down Expand Up @@ -112,3 +121,40 @@
enabled: true
isLooped: true
reverseWhenFinished: true
- type: Tag
tags:
- HideContextMenu

- type: entity
categories: [ HideSpawnMenu ]
id: CleanseEffectVFX
components:
- type: TimedDespawn
lifetime: 2.025
- type: Sprite
layers:
- sprite: _Impstation/CosmicCult/Effects/effect_cleansevfx.rsi
state: vfx
shader: unshaded
netsync: false
drawdepth: Mobs
- type: PointLight
color: "#ffd52e"
radius: 1.5
energy: 2.5
castShadows: false
- type: LightBehaviour
behaviours:
- !type:FadeBehaviour
interpolate: Linear
minDuration: 2.025
maxDuration: 2.025
startValue: 0.1
endValue: 2
property: Energy
enabled: true
isLooped: true
reverseWhenFinished: true
- type: Tag
tags:
- HideContextMenu
2 changes: 2 additions & 0 deletions Resources/Prototypes/_Impstation/Objects/Misc/nullrod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
parent: NullRodBase
description: An expensive-looking rosary, made from silver. Exudes somewhat soothing vibes. Nice!
components:
- type: UseDelay
delay: 5.0
- type: CleanseOnUse
- type: Prayable
bibleUserOnly: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "A custom item by AftrLite(Github)",
"size": {
"x": 64,
"y": 64
},
"states": [
{
"name": "vfx",
"delays": [
[
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
0.075,
99
]
]
}
]
}
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 3764ab9

Please sign in to comment.