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

Emercency Surgery Patch #537

Merged
merged 29 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
25f6b52
Beacons no longer glitch off on grid split (#28518) (#517)
Mnemotechnician Feb 3, 2025
e06e36a
Replace surgery interaction with a utility verb.
Mnemotechnician Feb 3, 2025
3ffbd4a
Add rotting to organs
Mnemotechnician Feb 3, 2025
766f062
Parent traversal distorter guide
Mnemotechnician Feb 4, 2025
823957d
Maybe this will fix the missing slots client-side bug.
Mnemotechnician Feb 4, 2025
15ca28d
Assorted changes to laying down
Mnemotechnician Feb 4, 2025
b41a022
Debraining means no consciousness
Mnemotechnician Feb 4, 2025
efc4fbf
General anesthesia canisters and associated cargo order
LucasTheDrgn Feb 4, 2025
9c7ee18
Increase CO2 danger threshold to 1%
Eagle0600 Feb 4, 2025
efbaf9b
ERT/Testing Surgical Tool Crate
LucasTheDrgn Feb 4, 2025
b9ccf2c
Fix numerous issues with client-side buckles
Mnemotechnician Feb 4, 2025
8b55a2f
Fix negative blood regeneration causing constant bleeding
Mnemotechnician Feb 4, 2025
6f1c686
Fix cyber-eyes having standard rot time
Mnemotechnician Feb 4, 2025
c67f5b2
DeltaV species guidebook entries (#1174)
NullWanderer May 18, 2024
f654877
Comment out DV Harpy guide entry
Forzii Feb 5, 2025
575c2c5
Update Dwarf.xml
Forzii Feb 5, 2025
de975d6
"I'll make those changes in a minute" 18 hours later
LucasTheDrgn Feb 5, 2025
bfdaf20
Biosynthetic Left Leg Fix (#528)
LucasTheDrgn Feb 6, 2025
be5b250
Update Resomi body and parts definition to follow surgery update spec…
LucasTheDrgn Feb 6, 2025
a116bc6
Fix Applicable Medication Stack Bug (#1278)
Tmanzxd Nov 29, 2024
d00957d
More Bug Fixes (#1311)
sleepyyapril Dec 5, 2024
107d455
Revert the GoTNS 'fix'
Mnemotechnician Feb 6, 2025
f752a42
Merge pull request #531 from Mnemotechnician/floof/fix/wave-3
Fansana Feb 6, 2025
0de32c1
Merge pull request #530 from Eagle0600/atmos
Fansana Feb 6, 2025
6ba4459
Merge pull request #529 from LucasTheDrgn/ert-surgery-crate
Fansana Feb 6, 2025
9153de3
Merge pull request #527 from LucasTheDrgn/nitrous-orders
Fansana Feb 6, 2025
3d7e990
Weaken the effects of damage on parts
Mnemotechnician Feb 6, 2025
496e660
Merge pull request #535 from Mnemotechnician/floof/tweak/proliferation
FoxxoTrystan Feb 6, 2025
27fb1d8
Merge pull request #532 from Forzii/Add-DV-species-guide-entries
FoxxoTrystan Feb 6, 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
40 changes: 36 additions & 4 deletions Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
using Content.Shared.Buckle.Components;
using Content.Shared.Rotation;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.GameStates;

namespace Content.Client.Buckle;

internal sealed class BuckleSystem : SharedBuckleSystem
{
[Dependency] private readonly RotationVisualizerSystem _rotationVisualizerSystem = default!;
[Dependency] private readonly IPlayerManager _player = default!; // Floof

public override void Initialize()
{
Expand All @@ -21,7 +23,19 @@ public override void Initialize()
SubscribeLocalEvent<BuckleComponent, UnbuckledEvent>(OnUnbuckledEvent);
}

/// <summary>
// Floof section - update the draw depths of all buckled entities
public override void FrameUpdate(float frameTime)
{
var query = EntityQueryEnumerator<StrapComponent>();
while (query.MoveNext(out var uid, out var strap))
{
UpdateBucklesDrawDepth(uid, strap);
}
query.Dispose();
}
// Floof section end

/// <summary>
/// Is the strap entity already rotated north? Lower the draw depth of the buckled entity.
/// </summary>
private void OnBuckledEvent(Entity<BuckleComponent> ent, ref BuckledEvent args)
Expand All @@ -30,7 +44,7 @@ private void OnBuckledEvent(Entity<BuckleComponent> ent, ref BuckledEvent args)
!TryComp<SpriteComponent>(ent.Owner, out var buckledSprite))
return;

if (Transform(args.Strap.Owner).LocalRotation.GetCardinalDir() == Direction.North)
if (GetEntityOrientation(args.Strap.Owner) == Direction.North) // Floof - replaced with a method call
{
ent.Comp.OriginalDrawDepth ??= buckledSprite.DrawDepth;
buckledSprite.DrawDepth = strapSprite.DrawDepth - 1;
Expand All @@ -48,7 +62,8 @@ private void OnUnbuckledEvent(Entity<BuckleComponent> ent, ref UnbuckledEvent ar
if (ent.Comp.OriginalDrawDepth.HasValue)
{
buckledSprite.DrawDepth = ent.Comp.OriginalDrawDepth.Value;
ent.Comp.OriginalDrawDepth = null;
// Floof - do not reset original draw depth here because prediction FUCKING SUCKS
// ent.Comp.OriginalDrawDepth = null;
}
}

Expand All @@ -64,10 +79,15 @@ private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveE
if (args.NewRotation == args.OldRotation)
return;

// Floof - everything that was below was separated into that method in order to allow calling it from other places
UpdateBucklesDrawDepth(uid, component);
}

private void UpdateBucklesDrawDepth(EntityUid uid, StrapComponent component) {
if (!TryComp<SpriteComponent>(uid, out var strapSprite))
return;

var isNorth = Transform(uid).LocalRotation.GetCardinalDir() == Direction.North;
var isNorth = GetEntityOrientation(uid) == Direction.North; // Floof - replaced with a method call
foreach (var buckledEntity in component.BuckledEntities)
{
if (!TryComp<BuckleComponent>(buckledEntity, out var buckle))
Expand Down Expand Up @@ -100,4 +120,16 @@ private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref Ap
// TODO: Dump this when buckle is better
_rotationVisualizerSystem.AnimateSpriteRotation(uid, args.Sprite, rotVisuals.HorizontalRotation, 0.125f);
}

// Floof section - method for getting the direction of an entity perceived by the local player
private Direction GetEntityOrientation(EntityUid uid)
{
var ownRotation = Transform(uid).LocalRotation;
var eyeRotation =
TryComp<EyeComponent>(_player.LocalEntity, out var eye) ? eye.Rotation : Angle.Zero;

// Note: we subtract instead of adding because e.g. rotating an eye +90° visually rotates all entities in vision by -90°
return (ownRotation + eyeRotation).GetCardinalDir();
}
// Floof section end
}
6 changes: 4 additions & 2 deletions Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,12 @@ public override void Update(float frameTime)
>= Atmospherics.WarningHighPressure => GetFeltHighPressure(uid, barotrauma, pressure),
_ => pressure
};

const float partMultiplier = 0.4f; // Floof - weakened the effect of barotrauma on body parts to 40%
if (pressure <= Atmospherics.HazardLowPressure)
{
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false, canSever: false);
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false, canSever: false, partMultiplier: partMultiplier); // Floof - added partMultiplier
if (!barotrauma.TakingDamage)
{
barotrauma.TakingDamage = true;
Expand All @@ -247,7 +249,7 @@ public override void Update(float frameTime)
{
var damageScale = MathF.Min(((pressure / Atmospherics.HazardHighPressure) - 1) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);

_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false);
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false, partMultiplier: partMultiplier); // Floof - added partMultiplier
RaiseLocalEvent(uid, new MoodEffectEvent("MobHighPressure"));

if (!barotrauma.TakingDamage)
Expand Down
8 changes: 6 additions & 2 deletions Content.Server/Body/Systems/BloodstreamSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public void SetBloodMaxVolume(EntityUid uid, FixedPoint2 volume, BloodstreamComp
/// <summary>
/// Attempts to modify the blood level of this entity directly.
/// </summary>
public bool TryModifyBloodLevel(EntityUid uid, FixedPoint2 amount, BloodstreamComponent? component = null)
public bool TryModifyBloodLevel(EntityUid uid, FixedPoint2 amount, BloodstreamComponent? component = null, bool allowBleeding = true) // Floof - added allowBleeding
{
if (!Resolve(uid, ref component, logMissing: false)
|| !_solutionContainerSystem.ResolveSolution(uid, component.BloodSolutionName, ref component.BloodSolution))
Expand All @@ -379,6 +379,10 @@ public bool TryModifyBloodLevel(EntityUid uid, FixedPoint2 amount, BloodstreamCo
if (!_solutionContainerSystem.ResolveSolution(uid, component.BloodTemporarySolutionName, ref component.TemporarySolution, out var tempSolution))
return true;

// Floof - if bleeding is not allowed (e.g. because blood loss was caused by negative natural regeneration), do not spill the blood
if (!allowBleeding)
return true;

tempSolution.AddSolution(newSol, _prototypeManager);

if (tempSolution.Volume > component.BleedPuddleThreshold)
Expand Down Expand Up @@ -527,6 +531,6 @@ private bool TryDoNaturalRegeneration(Entity<BloodstreamComponent> ent, Solution
if (usedThirst > 0 && thirstComp is not null)
_thirst.ModifyThirst(ent, thirstComp, (float) -usedThirst);

return TryModifyBloodLevel(ent, ev.Amount, ent.Comp);
return TryModifyBloodLevel(ent, ev.Amount, ent.Comp, allowBleeding: false);
}
}
8 changes: 8 additions & 0 deletions Content.Server/Body/Systems/DebrainedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.DelayedDeath;
using Content.Shared.Mind;
using Content.Server.Popups;
using Content.Shared.Interaction.Events;
using Content.Shared.Speech;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
Expand All @@ -26,6 +27,7 @@ public override void Initialize()
SubscribeLocalEvent<DebrainedComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<DebrainedComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<DebrainedComponent, StandAttemptEvent>(OnStandAttempt);
SubscribeLocalEvent<DebrainedComponent, ConsciousAttemptEvent>(OnConsciousAttempt); // Floofstation
}

private void OnComponentInit(EntityUid uid, DebrainedComponent _, ComponentInit args)
Expand Down Expand Up @@ -59,4 +61,10 @@ private void OnStandAttempt(EntityUid uid, DebrainedComponent _, StandAttemptEve
{
args.Cancel();
}

// Floofstation
private void OnConsciousAttempt(Entity<DebrainedComponent> ent, ref ConsciousAttemptEvent args)
{
args.Cancel();
}
}
4 changes: 2 additions & 2 deletions Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent arg
_popupSystem.PopupEntity(Loc.GetString("butcherable-knife-butchered-success", ("target", args.Args.Target.Value), ("knife", uid)),
popupEnt, args.Args.User, popupType);

if (hasBody)
_bodySystem.GibBody(args.Args.Target.Value, body: body);
if (hasBody && butcher.GibBody) // Floof - added additional check
_bodySystem.GibBody(args.Args.Target.Value, body: body, gibOrgans: butcher.GibOrgans, contents: butcher.GibContents);

_destructibleSystem.DestroyEntity(args.Args.Target.Value);

Expand Down
43 changes: 31 additions & 12 deletions Content.Server/Medical/Surgery/SurgerySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
using Content.Shared.Verbs;


namespace Content.Server.Medical.Surgery;

Expand All @@ -47,6 +49,7 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<SurgeryToolComponent, AfterInteractEvent>(OnToolAfterInteract);
SubscribeLocalEvent<SurgeryToolComponent, GetVerbsEvent<UtilityVerb>>(OnToolGetVerbs); // Floofstation
SubscribeLocalEvent<SurgeryTargetComponent, SurgeryStepDamageEvent>(OnSurgeryStepDamage);
// You might be wondering "why aren't we using StepEvent for these two?" reason being that StepEvent fires off regardless of success on the previous functions
// so this would heal entities even if you had a used or incorrect organ.
Expand Down Expand Up @@ -105,28 +108,44 @@ private void SetDamage(EntityUid body,
}

private void OnToolAfterInteract(Entity<SurgeryToolComponent> ent, ref AfterInteractEvent args)
{
// Floofstation - replaced with a verb. Fuck AfterInteractEvent.
// Be very mindful of this when merging upstream changes.
return;
}

private void OnToolGetVerbs(Entity<SurgeryToolComponent> ent, ref GetVerbsEvent<UtilityVerb> args)
{
var user = args.User;
if (args.Handled
|| !args.CanReach
|| args.Target == null
var target = args.Target;
if (!args.CanAccess
|| !args.CanInteract
|| !HasComp<SurgeryTargetComponent>(args.Target)
|| !TryComp<SurgeryTargetComponent>(args.User, out var surgery)
|| !surgery.CanOperate
|| !IsLyingDown(args.Target.Value, args.User))
|| !IsLyingDown(args.Target, args.User))
{
return;
}

if (user == args.Target && !_config.GetCVar(CCVars.CanOperateOnSelf))
var verb = new UtilityVerb
{
_popup.PopupEntity(Loc.GetString("surgery-error-self-surgery"), user, user);
return;
}

args.Handled = true;
_ui.OpenUi(args.Target.Value, SurgeryUIKey.Key, user);
RefreshUI(args.Target.Value);
Act = () =>
{
if (user == target && !_config.GetCVar(CCVars.CanOperateOnSelf))
{
_popup.PopupEntity(Loc.GetString("surgery-error-self-surgery"), user, user);
return;
}

_ui.OpenUi(target, SurgeryUIKey.Key, user);
RefreshUI(target);
},
Text = Loc.GetString("surgery-verb-perform"),
Priority = 2,
IconEntity = GetNetEntity(ent)
};
args.Verbs.Add(verb);
}

private void OnSurgeryStepDamage(Entity<SurgeryTargetComponent> ent, ref SurgeryStepDamageEvent args) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Shared.Interaction;
using Content.Shared.Mobs.Components;
using Content.Shared.Popups;
using Content.Shared.Silicon.Components;
using Content.Shared.Silicons.Bots;
using Robust.Shared.Audio.Systems;

Expand Down Expand Up @@ -53,9 +54,11 @@ public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTi
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entMan) || _entMan.Deleted(target))
return HTNOperatorStatus.Failed;

if (!_entMan.TryGetComponent<MedibotComponent>(owner, out var botComp))
if (_entMan.HasComponent<SiliconComponent>(target))
return HTNOperatorStatus.Failed;

if (!_entMan.TryGetComponent<MedibotComponent>(owner, out var botComp))
return HTNOperatorStatus.Failed;

if (!_entMan.TryGetComponent<DamageableComponent>(target, out var damage))
return HTNOperatorStatus.Failed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Silicons.Bots;
using Content.Shared.Emag.Components;
using Content.Shared.Silicon.Components;


namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Specific;

Expand Down Expand Up @@ -64,6 +66,9 @@ public override void Initialize(IEntitySystemManager sysManager)
damageQuery.TryGetComponent(entity, out var damage) &&
!recentlyInjected.HasComponent(entity))
{
if (_entManager.HasComponent<SiliconComponent>(entity))
continue;

// no treating dead bodies
if (!_medibot.TryGetTreatment(medibot, state.CurrentState, out var treatment))
continue;
Expand Down
13 changes: 11 additions & 2 deletions Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ private void OnEatMouse(EntityUid uid, FelinidComponent component, EatMouseActio

if (hunger.CurrentThreshold == Shared.Nutrition.Components.HungerThreshold.Overfed)
{
_popupSystem.PopupEntity(Loc.GetString("food-system-you-cannot-eat-any-more"), uid, uid, Shared.Popups.PopupType.SmallCaution);
_popupSystem.PopupEntity(
Loc.GetString("food-system-you-cannot-eat-any-more"),
uid,
uid,
Shared.Popups.PopupType.SmallCaution);
return;
}

Expand All @@ -147,15 +151,20 @@ private void OnEatMouse(EntityUid uid, FelinidComponent component, EatMouseActio
_actionsSystem.SetCharges(component.HairballAction, 1); // You get the charge back and that's it. Tough.
_actionsSystem.SetEnabled(component.HairballAction, true);
}

Del(component.EatActionTarget.Value);
component.EatActionTarget = null;

_audio.PlayPvs("/Audio/DeltaV/Items/eatfood.ogg", uid, AudioHelpers.WithVariation(0.15f));

_hungerSystem.ModifyHunger(uid, 50f, hunger);

if (component.EatAction != null)
if (component.EatAction is not null && _actionsSystem.TryGetActionData(uid, out var result))
{
if (result.AttachedEntity == null)
return;
_actionsSystem.RemoveAction(uid, component.EatAction.Value);
}
}

private void SpawnHairball(EntityUid uid, FelinidComponent component)
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Pinpointer/NavMapSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ private void RefreshGrid(EntityUid uid, NavMapComponent component, MapGridCompon
component.Chunks.Clear();
component.Beacons.Clear();

// Refresh beacons
var query = EntityQueryEnumerator<NavMapBeaconComponent, TransformComponent>();
while (query.MoveNext(out var qUid, out var qNavComp, out var qTransComp))
{
if (qTransComp.ParentUid != uid)
continue;

UpdateNavMapBeaconData(qUid, qNavComp);
}

// Loop over all tiles
var tileRefs = _mapSystem.GetAllTiles(uid, mapGrid);

Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Body/Part/BodyPartComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent
/// to make possible severing it.
/// </summary>
[DataField, AutoNetworkedField]
public float SeverIntegrity = 90;
public float SeverIntegrity = 300; // Floof - increased to 300 due to frequent RR

/// <summary>
/// The ID of the base layer for this body part.
Expand All @@ -159,8 +159,8 @@ public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent
[DataField, AutoNetworkedField]
public Dictionary<TargetIntegrity, float> IntegrityThresholds = new()
{
{ TargetIntegrity.CriticallyWounded, 90 },
{ TargetIntegrity.HeavilyWounded, 75 },
{ TargetIntegrity.CriticallyWounded, 100 }, // Floof - adjusted the thresholds to come in increments of 20
{ TargetIntegrity.HeavilyWounded, 80 },
{ TargetIntegrity.ModeratelyWounded, 60 },
{ TargetIntegrity.SomewhatWounded, 40},
{ TargetIntegrity.LightlyWounded, 20 },
Expand Down
Loading
Loading