mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-30 12:07:37 +03:00
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster
# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.
(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared._Shitmed.Targeting;
|
|
using Content.Shared._Shitmed.Targeting.Events;
|
|
using Content.Shared.Body.Part;
|
|
|
|
namespace Content.Server._Shitmed.Targeting;
|
|
public sealed class TargetingSystem : SharedTargetingSystem
|
|
{
|
|
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeNetworkEvent<TargetChangeEvent>(OnTargetChange);
|
|
SubscribeLocalEvent<TargetingComponent, MobStateChangedEvent>(OnMobStateChange);
|
|
}
|
|
|
|
private void OnTargetChange(TargetChangeEvent message, EntitySessionEventArgs args)
|
|
{
|
|
if (!TryComp<TargetingComponent>(GetEntity(message.Uid), out var target))
|
|
return;
|
|
|
|
target.Target = message.BodyPart;
|
|
Dirty(GetEntity(message.Uid), target);
|
|
}
|
|
|
|
private void OnMobStateChange(EntityUid uid, TargetingComponent component, MobStateChangedEvent args)
|
|
{
|
|
// Revival is handled by the server, so we're keeping all of this here.
|
|
var changed = false;
|
|
|
|
if (args.NewMobState == MobState.Dead)
|
|
{
|
|
foreach (var part in GetValidParts())
|
|
{
|
|
component.BodyStatus[part] = TargetIntegrity.Dead;
|
|
changed = true;
|
|
}
|
|
// I love groin shitcode.
|
|
component.BodyStatus[TargetBodyPart.Groin] = TargetIntegrity.Dead;
|
|
}
|
|
else if (args.OldMobState == MobState.Dead && (args.NewMobState == MobState.Alive || args.NewMobState == MobState.Critical))
|
|
{
|
|
component.BodyStatus = _bodySystem.GetBodyPartStatus(uid);
|
|
changed = true;
|
|
}
|
|
|
|
if (changed)
|
|
{
|
|
Dirty(uid, component);
|
|
RaiseNetworkEvent(new TargetIntegrityChangeEvent(GetNetEntity(uid)), uid);
|
|
}
|
|
}
|
|
}
|