Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harpy Customization Pack 1 #175

Merged
merged 16 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Content.Server/DeltaV/Harpy/HarpySingerSystem.cs
VMSolidus marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Content.Server.Mobs;
using Content.Server.Instruments;
using Content.Shared.Instruments;
using Content.Shared.Actions;
using Content.Shared.Mobs;
using Content.Shared.DeltaV.Harpy;

namespace Content.Server.DeltaV.Harpy
{
public class HarpySingerSystem : EntitySystem
{
[Dependency] private readonly InstrumentSystem _instrument = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<InstrumentComponent, MobStateChangedEvent>(OnRemoveInstrumentAbility);
SubscribeLocalEvent<HarpySingerComponent, MobStateChangedEvent>(OnAddInstrumentAbility);
}
//Immediately stops a harpy from singing if they're critted or killed, and prevents them from starting a new song
private void OnRemoveInstrumentAbility(EntityUid uid, InstrumentComponent component, MobStateChangedEvent args)
{
if (args.NewMobState != MobState.Dead || args.NewMobState != MobState.Critical)
{
RemComp<InstrumentComponent>(uid);
return;
}
}
//Allows a harpy to sing again after being revived.
private void OnAddInstrumentAbility(EntityUid uid, HarpySingerComponent component, MobStateChangedEvent args)
{
if (args.NewMobState != MobState.Alive)
return;

var instrument = EnsureComp<InstrumentComponent>(uid);
EnsureComp<InstrumentComponent>(uid);
_instrument.SetInstrumentProgram(instrument, 52, 0);
}
}
}

1 change: 1 addition & 0 deletions Content.Shared/DeltaV/Harpy/HarpySingerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ private void OnShutdown(EntityUid uid, HarpySingerComponent component, Component
}
}
}

Loading