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

"Proper" "Softcrit" "Support" #1545

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b226b26
could've been worse
RedFoxIV Jan 10, 2025
58effdf
That was not enjoyable
VMSolidus Jan 2, 2025
bf8769a
aaa
RedFoxIV Jan 10, 2025
3d8b25c
two, four, one, ten
RedFoxIV Jan 10, 2025
5c05c6c
am i transmitting
RedFoxIV Jan 11, 2025
85dfcdb
is anyone listening
RedFoxIV Jan 12, 2025
2607623
unfuck the cherrypick and some minor touchups
RedFoxIV Jan 14, 2025
840554d
forgor to push
RedFoxIV Jan 14, 2025
77ea955
ref
RedFoxIV Jan 15, 2025
9425dfd
i was unable to get it working
RedFoxIV Jan 15, 2025
7459027
this was bad, but now it's a little bit less bad
RedFoxIV Jan 15, 2025
f132394
groundhog commit
RedFoxIV Jan 15, 2025
c0d756f
renamed ConsciousAttemptAllowed to IsConscious
RedFoxIV Jan 15, 2025
837f5ff
Merge branch 'master' into pillow-export
RedFoxIV Jan 15, 2025
5153336
unprofessional commit name №1184
RedFoxIV Jan 17, 2025
51a579e
god i hope this doesn't break anything
RedFoxIV Jan 17, 2025
79c0c9b
🤷‍♂️
RedFoxIV Jan 17, 2025
2e311a2
Merge branch 'master' into pillow-export
RedFoxIV Jan 17, 2025
d0aea1b
Merge branch 'master' into pillow-export
RedFoxIV Jan 17, 2025
1b92ab9
Good Game Design was slain...
RedFoxIV Jan 19, 2025
0b54b8a
oops
RedFoxIV Jan 19, 2025
9f3c14a
Please enter commit message
RedFoxIV Jan 19, 2025
db499bf
Merge branch 'master' into pillow-export
RedFoxIV Jan 19, 2025
6de7ca3
unwhited the white
RedFoxIV Jan 19, 2025
9af7b69
FUCK
RedFoxIV Jan 19, 2025
fedd36f
doesn't work properly without being able to pick up stuff, so it has …
RedFoxIV Jan 19, 2025
9e40595
Merge remote-tracking branch 'upstream/master' into pillow-export
RedFoxIV Jan 20, 2025
f8d88bf
damn i feel dumb
RedFoxIV Jan 20, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ private static string GetStatus(MobState mobState)
return mobState switch
{
MobState.Alive => Loc.GetString("health-analyzer-window-entity-alive-text"),
MobState.SoftCritical => Loc.GetString("health-analyzer-window-entity-critical-text"),
MobState.Critical => Loc.GetString("health-analyzer-window-entity-critical-text"),
MobState.Dead => Loc.GetString("health-analyzer-window-entity-dead-text"),
_ => Loc.GetString("health-analyzer-window-entity-unknown-text"),
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Interaction/DragDropSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ private void RemoveHighlights()
// CanInteract() doesn't support checking a second "target" entity.
// Doing so manually:
var ev = new GettingInteractedWithAttemptEvent(user, dragged);
RaiseLocalEvent(dragged, ref ev);
RaiseLocalEvent(dragged, ev);

if (ev.Cancelled)
return false;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Movement/Systems/WaddleAnimationSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Client.Buckle;
using Content.Client.Gravity;
using Content.Shared.ActionBlocker;
Expand Down Expand Up @@ -82,7 +82,7 @@ private void OnStartedWalking(EntityUid uid, WaddleAnimationComponent component,
return;

// Do nothing if crit or dead (for obvious reasons)
if (_mobState.IsIncapacitated(uid))
if (_mobState.IsHardCritical(uid) || _mobState.IsDead(uid))
return;

var tumbleIntensity = component.LastStep ? 360 - component.TumbleIntensity : component.TumbleIntensity;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Overlays/EntityHealthBarOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected override void Draw(in OverlayDrawArgs args)
if (dmg.HealthBarThreshold != null && dmg.TotalDamage < dmg.HealthBarThreshold)
return null;

if (!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Critical, out var threshold, thresholds) &&
if (!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.SoftCritical, MobState.Critical, out var threshold, thresholds) &&
!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Dead, out threshold, thresholds))
return (1, false);

Expand All @@ -142,7 +142,7 @@ protected override void Draw(in OverlayDrawArgs args)

if (_mobStateSystem.IsCritical(uid, component))
{
if (!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Critical, out var critThreshold, thresholds) ||
if (!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.SoftCritical, MobState.Critical, out var critThreshold, thresholds) ||
!_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Dead, out var deadThreshold, thresholds))
{
return (1, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void InitializeBlockers()

private void OnInteractAttempt(Entity<ReplaySpectatorComponent> ent, ref InteractionAttemptEvent args)
{
args.Cancelled = true;
args.Cancel();
}

private void OnAttempt(EntityUid uid, ReplaySpectatorComponent component, CancellableEntityEventArgs args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void OnPlayerAttach(LocalPlayerAttachedEvent args)
ClearOverlay();
if (!EntityManager.TryGetComponent<MobStateComponent>(args.Entity, out var mobState))
return;
if (mobState.CurrentState != MobState.Dead)
if (mobState.CurrentState.IsCritOrAlive())
UpdateOverlays(args.Entity, mobState);
_overlayManager.AddOverlay(_overlay);
}
Expand Down Expand Up @@ -89,6 +89,7 @@ private void UpdateOverlays(EntityUid entity, MobStateComponent? mobState, Damag

var critThreshold = foundThreshold.Value;
_overlay.State = mobState.CurrentState;
_overlay.OxygenLevelOverride = mobState.GetOxyDamageOverlay();

switch (mobState.CurrentState)
{
Expand All @@ -113,6 +114,7 @@ private void UpdateOverlays(EntityUid entity, MobStateComponent? mobState, Damag
_overlay.DeadLevel = 0;
break;
}
case MobState.SoftCritical:
case MobState.Critical:
{
if (!_mobThresholdSystem.TryGetDeadPercentage(entity,
Expand All @@ -124,7 +126,7 @@ private void UpdateOverlays(EntityUid entity, MobStateComponent? mobState, Damag
_overlay.DeadLevel = 0;
break;
}
case MobState.Dead:
case MobState.Dead: // todo: move (some of?) the stuff above and below to mobstate parameters
{
_overlay.BruteLevel = 0;
_overlay.CritLevel = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
Expand All @@ -21,7 +22,6 @@ public sealed class DamageOverlay : Overlay
private readonly ShaderInstance _bruteShader;

public MobState State = MobState.Alive;

/// <summary>
/// Handles the red pulsing overlay
/// </summary>
Expand All @@ -33,6 +33,7 @@ public sealed class DamageOverlay : Overlay
/// Handles the darkening overlay.
/// </summary>
public float OxygenLevel = 0f;
public float? OxygenLevelOverride; // for darkening in crit

private float _oldOxygenLevel = 0f;

Expand Down Expand Up @@ -168,7 +169,7 @@ protected override void Draw(in OverlayDrawArgs args)
_oldBruteLevel = BruteLevel;
}

level = State != MobState.Critical ? _oldOxygenLevel : 1f;
level = OxygenLevelOverride ?? _oldOxygenLevel;

if (level > 0f)
{
Expand Down
7 changes: 6 additions & 1 deletion Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Administration.Commands;
using Content.Server.Administration.Commands;
using Content.Server.Administration.Systems;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
Expand Down Expand Up @@ -72,6 +72,10 @@ await server.WaitAssertion(() =>
Assert.That(mobStateSystem.IsAlive(human, mobState), Is.False);
Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
Assert.That(mobStateSystem.IsDead(human, mobState), Is.True);
// This now may not be true for all mobs since the introduction of MobState parameters.
// Even though being dead should be incapacitating makes perfect sense.
// If you're fucking around with parameters for MobState.Dead and this
// throws at you, feel free to comment it. Or reconsider what you're doing.
Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.True);
});

Expand All @@ -84,6 +88,7 @@ await server.WaitAssertion(() =>
Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True);
Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False);
Assert.That(mobStateSystem.IsDead(human, mobState), Is.False);
// see above, same thing but for MobState.Alive
Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False);

Assert.That(damageable.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
Act = () =>
{
int damageToDeal;
if (!_mobThresholdSystem.TryGetThresholdForState(args.Target, MobState.Critical, out var criticalThreshold)) {
if (!_mobThresholdSystem.TryGetThresholdForState(args.Target, MobState.SoftCritical, MobState.Critical, out var criticalThreshold)) {
// We can't crit them so try killing them.
if (!_mobThresholdSystem.TryGetThresholdForState(args.Target, MobState.Dead,
out var deadThreshold))
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Systems/SuperBonkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void StartSuperBonk(EntityUid target, float delay = 0.1f, bool stopWhenDe
//The other check in the code to stop when the target dies does not work if the target is already dead.
if (stopWhenDead && TryComp<MobStateComponent>(target, out var mState))
{
if (mState.CurrentState == MobState.Dead)
if (mState.CurrentState.IsDead())
return;
}

Expand Down
21 changes: 13 additions & 8 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.Mobs.Components;

namespace Content.Server.Body.Systems;

Expand Down Expand Up @@ -83,12 +84,13 @@ public override void Update(float frameTime)

UpdateSaturation(uid, -(float) respirator.UpdateInterval.TotalSeconds, respirator);

if (!_mobState.IsIncapacitated(uid) && !HasComp<DebrainedComponent>(uid)) // Shitmed: cannot breathe in crit or when no brain.
float mul = _mobState.BreatheMultiplier(uid);
if (mul > 0f && !HasComp<DebrainedComponent>(uid)) // Shitmed: cannot breathe in crit or when no brain.
{
switch (respirator.Status)
{
case RespiratorStatus.Inhaling:
Inhale(uid, body);
Inhale(uid, body, mul);
respirator.Status = RespiratorStatus.Exhaling;
break;
case RespiratorStatus.Exhaling:
Expand All @@ -106,7 +108,7 @@ public override void Update(float frameTime)
_popupSystem.PopupEntity(Loc.GetString("lung-behavior-gasp"), uid);
}

TakeSuffocationDamage((uid, respirator));
TakeSuffocationDamage((uid, respirator), 1 - mul);
respirator.SuffocationCycles += 1;
continue;
}
Expand All @@ -116,7 +118,7 @@ public override void Update(float frameTime)
}
}

public void Inhale(EntityUid uid, BodyComponent? body = null)
public void Inhale(EntityUid uid, BodyComponent? body = null, float breathVolumeMultiplier = 1f)
{
if (!Resolve(uid, ref body, logMissing: false))
return;
Expand All @@ -134,7 +136,7 @@ public void Inhale(EntityUid uid, BodyComponent? body = null)
return;
}

var actualGas = ev.Gas.RemoveVolume(Atmospherics.BreathVolume);
var actualGas = ev.Gas.RemoveVolume(Atmospherics.BreathVolume * breathVolumeMultiplier);

var lungRatio = 1.0f / organs.Count;
var gas = organs.Count == 1 ? actualGas : actualGas.RemoveRatio(lungRatio);
Expand Down Expand Up @@ -286,7 +288,7 @@ bool CanMetabolize(EntityEffect effect)
return saturation;
}

private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
private void TakeSuffocationDamage(Entity<RespiratorComponent> ent, float damageMultiplier = 1f)
{
if (ent.Comp.SuffocationCycles == 2)
_adminLogger.Add(LogType.Asphyxiation, $"{ToPrettyString(ent):entity} started suffocating");
Expand All @@ -301,8 +303,11 @@ private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
}
RaiseLocalEvent(ent, new MoodEffectEvent("Suffocating"));
}

_damageableSys.TryChangeDamage(ent, HasComp<DebrainedComponent>(ent) ? ent.Comp.Damage * 4.5f : ent.Comp.Damage, interruptsDoAfters: false);
var damageToTake = ent.Comp.Damage;
if (HasComp<DebrainedComponent>(ent))
damageToTake *= 4.5f;
damageToTake *= damageMultiplier;
_damageableSys.TryChangeDamage(ent, damageToTake, interruptsDoAfters: false);
}

private void StopSuffocation(Entity<RespiratorComponent> ent)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void OnInteractionAttempt(EntityUid uid, BeingCarriedComponent component
var targetParent = Transform(args.Target.Value).ParentUid;

if (args.Target.Value != component.Carrier && targetParent != component.Carrier && targetParent != uid)
args.Cancelled = true;
args.Cancel();
}

/// <summary>
Expand Down Expand Up @@ -202,7 +202,7 @@ private void OnStandAttempt(EntityUid uid, BeingCarriedComponent component, Stan
private void OnInteractedWith(EntityUid uid, BeingCarriedComponent component, GettingInteractedWithAttemptEvent args)
{
if (args.Uid != component.Carrier)
args.Cancelled = true;
args.Cancel();
}

private void OnPullAttempt(EntityUid uid, BeingCarriedComponent component, PullAttemptEvent args)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public void TrySendInGameOOCMessage(
sendType = InGameOOCChatType.Dead;

// If crit player LOOC is disabled, don't send the message at all.
if (!_critLoocEnabled && _mobStateSystem.IsCritical(source))
if (!_critLoocEnabled && _mobStateSystem.IsHardCritical(source))
return;

switch (sendType)
Expand Down Expand Up @@ -615,7 +615,7 @@ private void SendLOOC(EntityUid source, ICommonSession player, string message, b
else if (!_loocEnabled) return;

// If crit player LOOC is disabled, don't send the message at all.
if (!_critLoocEnabled && _mobStateSystem.IsCritical(source))
if (!_critLoocEnabled && _mobStateSystem.IsHardCritical(source))
return;

var wrappedMessage = Loc.GetString("chat-manager-entity-looc-wrap-message",
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Chat/TelepathicChatSystem.Psychognomy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Random;
using Content.Shared.Mobs;

namespace Content.Server.Chat;
public sealed partial class TelepathicChatSystem
Expand Down Expand Up @@ -76,7 +77,7 @@ private void DescribeDamage(EntityUid uid, DamageableComponent component, GetPsy

private void DescribeMobState(EntityUid uid, MobStateComponent component, GetPsychognomicDescriptorEvent ev)
{
if (component.CurrentState != Shared.Mobs.MobState.Critical)
if (!component.CurrentState.IsCrit())
return;

ev.Descriptors.Add(Loc.GetString("p-descriptor-liminal"));
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Power.EntitySystems;
using Content.Server.Stunnable;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
Expand All @@ -13,12 +15,14 @@
using Content.Shared.Interaction;
using Content.Shared.Mobs.Components;
using Content.Shared.Stacks;
using Content.Shared.StatusEffect;

namespace Content.Server.Chemistry.EntitySystems;

public sealed class InjectorSystem : SharedInjectorSystem
{
[Dependency] private readonly BloodstreamSystem _blood = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly ReactiveSystem _reactiveSystem = default!;

public override void Initialize()
Expand Down Expand Up @@ -163,7 +167,7 @@ private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target,


// Check if the target is incapacitated or in combat mode and modify time accordingly.
if (MobState.IsIncapacitated(target))
if (MobState.IsIncapacitated(target) /*|| _statusEffects.TryGetTime(target, "Stun", out var _)*/)
{
actualDelay /= 2.5f;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cloning/CloningSystem.Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ private void UpdateCloneDamage(EntityUid mob, CloningPodComponent clonePodComp,
{
if (!clonePodComp.DoGeneticDamage
|| !HasComp<DamageableComponent>(mob)
|| !_thresholds.TryGetThresholdForState(mob, Shared.Mobs.MobState.Critical, out var threshold))
|| !_thresholds.TryGetThresholdForState(mob, Shared.Mobs.MobState.Critical, Shared.Mobs.MobState.SoftCritical, out var threshold))
return;
DamageSpecifier damage = new();
damage.DamageDict.Add("Cellular", (int) threshold + 1 + geneticDamage);
Expand Down
17 changes: 10 additions & 7 deletions Content.Server/Damage/ForceSay/DamageForceSaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Damage.ForceSay;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Stunnable;
using Robust.Shared.Player;
Expand Down Expand Up @@ -114,12 +115,14 @@ private void OnDamageChanged(EntityUid uid, DamageForceSayComponent component, D

private void OnMobStateChanged(EntityUid uid, DamageForceSayComponent component, MobStateChangedEvent args)
{
if (args is not { OldMobState: MobState.Alive, NewMobState: MobState.Critical or MobState.Dead })
return;

// no suffix for the drama
// LING IN MAI-
TryForceSay(uid, component, false);
AllowNextSpeech(uid);
var mobState = Comp<MobStateComponent>(uid);
if (mobState.CanTalk(args.OldMobState) && // could talk before and
!mobState.CanTalk()) // can't talk now
{
// no suffix for the drama
// LING IN MAI-
TryForceSay(uid, component, false);
AllowNextSpeech(uid);
}
}
}
4 changes: 2 additions & 2 deletions Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ private void HandleRattleTrigger(EntityUid uid, RattleComponent component, Trigg
return;

// Sends a message to the radio channel specified by the implant
if (mobstate.CurrentState == MobState.Critical)
if (mobstate.CurrentState.IsCrit())
_radioSystem.SendRadioMessage(uid, critMessage, _prototypeManager.Index<RadioChannelPrototype>(component.RadioChannel), uid);
if (mobstate.CurrentState == MobState.Dead)
if (mobstate.CurrentState.IsDead())
_radioSystem.SendRadioMessage(uid, deathMessage, _prototypeManager.Index<RadioChannelPrototype>(component.RadioChannel), uid);

args.Handled = true;
Expand Down
Loading
Loading