mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +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)
93 lines
3.0 KiB
C#
93 lines
3.0 KiB
C#
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Rejuvenate;
|
|
using Content.Shared.Slippery;
|
|
using Content.Shared.StatusEffect;
|
|
using Content.Shared.Body.Systems; // Shitmed Change
|
|
|
|
namespace Content.Shared.Damage.Systems;
|
|
|
|
public abstract class SharedGodmodeSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
|
|
|
[Dependency] private readonly SharedBodySystem _bodySystem = default!; // Shitmed Change
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<GodmodeComponent, BeforeDamageChangedEvent>(OnBeforeDamageChanged);
|
|
SubscribeLocalEvent<GodmodeComponent, BeforeStatusEffectAddedEvent>(OnBeforeStatusEffect);
|
|
SubscribeLocalEvent<GodmodeComponent, BeforeStaminaDamageEvent>(OnBeforeStaminaDamage);
|
|
SubscribeLocalEvent<GodmodeComponent, SlipAttemptEvent>(OnSlipAttempt);
|
|
}
|
|
|
|
private void OnSlipAttempt(EntityUid uid, GodmodeComponent component, SlipAttemptEvent args)
|
|
{
|
|
args.Cancel();
|
|
}
|
|
|
|
private void OnBeforeDamageChanged(EntityUid uid, GodmodeComponent component, ref BeforeDamageChangedEvent args)
|
|
{
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
private void OnBeforeStatusEffect(EntityUid uid, GodmodeComponent component, ref BeforeStatusEffectAddedEvent args)
|
|
{
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
private void OnBeforeStaminaDamage(EntityUid uid, GodmodeComponent component, ref BeforeStaminaDamageEvent args)
|
|
{
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
public virtual void EnableGodmode(EntityUid uid, GodmodeComponent? godmode = null)
|
|
{
|
|
godmode ??= EnsureComp<GodmodeComponent>(uid);
|
|
|
|
if (TryComp<DamageableComponent>(uid, out var damageable))
|
|
{
|
|
godmode.OldDamage = new DamageSpecifier(damageable.Damage);
|
|
}
|
|
|
|
// Rejuv to cover other stuff
|
|
|
|
RaiseLocalEvent(uid, new RejuvenateEvent());
|
|
foreach (var (id, _) in _bodySystem.GetBodyChildren(uid)) // Shitmed Change
|
|
EnableGodmode(id);
|
|
}
|
|
|
|
public virtual void DisableGodmode(EntityUid uid, GodmodeComponent? godmode = null)
|
|
{
|
|
if (!Resolve(uid, ref godmode, false))
|
|
return;
|
|
|
|
if (TryComp<DamageableComponent>(uid, out var damageable) && godmode.OldDamage != null)
|
|
{
|
|
_damageable.SetDamage(uid, damageable, godmode.OldDamage);
|
|
}
|
|
|
|
RemComp<GodmodeComponent>(uid);
|
|
|
|
foreach (var (id, _) in _bodySystem.GetBodyChildren(uid)) // Shitmed Change
|
|
DisableGodmode(id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Toggles godmode for a given entity.
|
|
/// </summary>
|
|
/// <param name="uid">The entity to toggle godmode for.</param>
|
|
/// <returns>true if enabled, false if disabled.</returns>
|
|
public bool ToggleGodmode(EntityUid uid)
|
|
{
|
|
if (TryComp<GodmodeComponent>(uid, out var godmode))
|
|
{
|
|
DisableGodmode(uid, godmode);
|
|
return false;
|
|
}
|
|
|
|
EnableGodmode(uid, godmode);
|
|
return true;
|
|
}
|
|
} |