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

[Port] Surgety Update: Outer Content #944

Merged
merged 7 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions Content.Client/Backmen/Targeting/TargetingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ public override void Initialize()
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.Torso)))
.Bind(ContentKeyFunctions.TargetLeftArm,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftArm)))
/* .Bind(ContentKeyFunctions.TargetLeftHand,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftHand))) SOON :TM: */
.Bind(ContentKeyFunctions.TargetLeftHand,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftHand)))
.Bind(ContentKeyFunctions.TargetRightArm,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightArm)))
/* .Bind(ContentKeyFunctions.TargetRightHand,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightHand)))*/
.Bind(ContentKeyFunctions.TargetRightHand,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightHand)))
.Bind(ContentKeyFunctions.TargetLeftLeg,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftLeg)))
/* .Bind(ContentKeyFunctions.TargetLeftFoot,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftFoot)))*/
.Bind(ContentKeyFunctions.TargetLeftFoot,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.LeftFoot)))
.Bind(ContentKeyFunctions.TargetRightLeg,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightLeg)))
/* .Bind(ContentKeyFunctions.TargetRightFoot,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightFoot)))*/
.Bind(ContentKeyFunctions.TargetRightFoot,
InputCmdHandler.FromDelegate((session) => HandleTargetChange(session, TargetBodyPart.RightFoot)))
.Register<SharedTargetingSystem>();
}

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Client.Examine;
using Content.Client.Strip;
using Content.Client.Verbs.UI;
using Content.Shared.Backmen.Surgery.Body.Events;
using Content.Shared.Body.Part;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.TargetHead);
human.AddFunction(ContentKeyFunctions.TargetTorso);
human.AddFunction(ContentKeyFunctions.TargetLeftArm);
human.AddFunction(ContentKeyFunctions.TargetLeftHand);
human.AddFunction(ContentKeyFunctions.TargetRightArm);
human.AddFunction(ContentKeyFunctions.TargetRightHand);
human.AddFunction(ContentKeyFunctions.TargetLeftLeg);
human.AddFunction(ContentKeyFunctions.TargetLeftFoot);
human.AddFunction(ContentKeyFunctions.TargetRightLeg);
human.AddFunction(ContentKeyFunctions.TargetRightFoot);

// actions should be common (for ghosts, mobs, etc)
common.AddFunction(ContentKeyFunctions.OpenActionsMenu);
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,13 @@ void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // BACKMEN ED
AddButton(ContentKeyFunctions.TargetHead);
AddButton(ContentKeyFunctions.TargetTorso);
AddButton(ContentKeyFunctions.TargetLeftArm);
AddButton(ContentKeyFunctions.TargetLeftHand);
AddButton(ContentKeyFunctions.TargetRightArm);
AddButton(ContentKeyFunctions.TargetRightHand);
AddButton(ContentKeyFunctions.TargetLeftLeg);
AddButton(ContentKeyFunctions.TargetLeftFoot);
AddButton(ContentKeyFunctions.TargetRightLeg);
AddButton(ContentKeyFunctions.TargetRightFoot);

AddHeader("ui-options-header-misc");
AddButton(ContentKeyFunctions.TakeScreenshot);
Expand Down
9 changes: 9 additions & 0 deletions Content.Client/Smoking/MatchstickSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Shitmed Change Start

using Content.Shared.Smoking.Systems;

namespace Content.Client.Smoking;

public sealed class MatchstickSystem : SharedMatchstickSystem;

// Shitmed Change End
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server._Shitmed.Body.Organ;
namespace Content.Server.Backmen.Body.Components;

[RegisterComponent, Access(typeof(StatusEffectOrganSystem))]
[AutoGenerateComponentPause]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Content.Shared.StatusEffect;
using Robust.Shared.Timing;

namespace Content.Server._Shitmed.Body.Organ;
namespace Content.Server.Backmen.Body.Components;

public sealed class StatusEffectOrganSystem : EntitySystem
{
Expand Down
62 changes: 62 additions & 0 deletions Content.Server/Backmen/Body/Systems/DebrainedSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Content.Server.Backmen.DelayedDeath;
using Content.Shared.Body.Systems;
using Content.Server.Popups;
using Content.Shared.Backmen.Surgery.Body;
using Content.Shared.Backmen.Surgery.Body.Organs;
using Content.Shared.Speech;
using Content.Shared.Standing;
using Content.Shared.Stunnable;

namespace Content.Server.Backmen.Body.Systems;

/// <summary>
/// This system handles behavior on entities when they lose their head or their brains are removed.
/// MindComponent fuckery should still be mainly handled on BrainSystem as usual.
/// </summary>
public sealed class DebrainedSystem : EntitySystem
{
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly StandingStateSystem _standingSystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<DebrainedComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<DebrainedComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<DebrainedComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<DebrainedComponent, StandAttemptEvent>(OnStandAttempt);
}

private void OnComponentInit(EntityUid uid, DebrainedComponent _, ComponentInit args)
{
if (TerminatingOrDeleted(uid))
return;

EnsureComp<DelayedDeathComponent>(uid);
EnsureComp<StunnedComponent>(uid);
_standingSystem.Down(uid);
}

private void OnComponentRemove(EntityUid uid, DebrainedComponent _, ComponentRemove args)
{
if (TerminatingOrDeleted(uid))
return;

RemComp<DelayedDeathComponent>(uid);
RemComp<StunnedComponent>(uid);
if (_bodySystem.TryGetBodyOrganEntityComps<HeartComponent>(uid, out var _))
RemComp<DelayedDeathComponent>(uid);
}

private void OnSpeakAttempt(EntityUid uid, DebrainedComponent _, SpeakAttemptEvent args)
{
_popupSystem.PopupEntity(Loc.GetString("speech-muted"), uid, uid);
args.Cancel();
}

private void OnStandAttempt(EntityUid uid, DebrainedComponent _, StandAttemptEvent args)
{
args.Cancel();
}
}
86 changes: 86 additions & 0 deletions Content.Server/Backmen/Body/Systems/EyesSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using Content.Server.Body.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Backmen.Surgery.Body.Organs;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Eye.Blinding.Systems;

namespace Content.Server.Backmen.Body.Systems
{
public sealed class EyesSystem : EntitySystem
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
[Dependency] private readonly BodySystem _bodySystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<EyesComponent, OrganEnabledEvent>(OnOrganEnabled);
SubscribeLocalEvent<EyesComponent, OrganDisabledEvent>(OnOrganDisabled);
}

private void HandleSight(EntityUid newEntity, EntityUid oldEntity)
{
if (TerminatingOrDeleted(newEntity) || TerminatingOrDeleted(oldEntity))
return;

BlindableComponent? newSight;
BlindableComponent? oldSight;
//transfer existing component to organ
if (!TryComp(newEntity, out newSight))
newSight = EnsureComp<BlindableComponent>(newEntity);

if (!TryComp(oldEntity, out oldSight))
oldSight = EnsureComp<BlindableComponent>(oldEntity);

//give new sight all values of old sight
_blindableSystem.TransferBlindness(newSight, oldSight, newEntity);

var hasOtherEyes = false;
//check for other eye components on owning body and owning body organs (if old entity has a body)
if (TryComp<BodyComponent>(oldEntity, out var body))
{
if (TryComp<EyesComponent>(oldEntity, out var bodyEyes)) //some bodies see through their skin!!! (slimes)
hasOtherEyes = true;
else
{
foreach (var (organ, _) in _bodySystem.GetBodyOrgans(oldEntity, body))
{
if (TryComp<EyesComponent>(organ, out var eyes))
{
hasOtherEyes = true;
break;
}
}
//TODO (MS14): Should we do this for body parts too? might be a little overpowered but could be funny/interesting
}
}

//if there are no existing eye components for the old entity - set old sight to be blind otherwise leave it as is
if (!hasOtherEyes && !TryComp<EyesComponent>(oldEntity, out var self))
_blindableSystem.AdjustEyeDamage((oldEntity, oldSight), oldSight.MaxDamage);

}

private void OnOrganEnabled(EntityUid uid, EyesComponent component, OrganEnabledEvent args)
{
if (TerminatingOrDeleted(uid)
|| args.Organ.Comp.Body is not { Valid: true } body)
return;

RemComp<TemporaryBlindnessComponent>(body);
HandleSight(uid, body);
}

private void OnOrganDisabled(EntityUid uid, EyesComponent component, OrganDisabledEvent args)
{
if (TerminatingOrDeleted(uid)
|| args.Organ.Comp.Body is not { Valid: true } body)
return;

EnsureComp<TemporaryBlindnessComponent>(body);
HandleSight(body, uid);
}
}
}
55 changes: 55 additions & 0 deletions Content.Server/Backmen/Cybernetics/CyberneticsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Content.Server.Emp;
using Content.Shared.Backmen.Surgery.Body;
using Content.Shared.Backmen.Surgery.Body.Events;
using Content.Shared.Backmen.Surgery.Body.Organs;
using Content.Shared.Body.Part;
using Content.Shared.Body.Organ;

namespace Content.Server.Backmen.Cybernetics;

internal sealed class CyberneticsSystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<CyberneticsComponent, EmpPulseEvent>(OnEmpPulse);
SubscribeLocalEvent<CyberneticsComponent, EmpDisabledRemoved>(OnEmpDisabledRemoved);
}
private void OnEmpPulse(Entity<CyberneticsComponent> cyberEnt, ref EmpPulseEvent ev)
{
if (!cyberEnt.Comp.Disabled)
{
ev.Affected = true;
ev.Disabled = true;
cyberEnt.Comp.Disabled = true;

if (HasComp<OrganComponent>(cyberEnt))
{
var disableEvent = new OrganEnableChangedEvent(false);
RaiseLocalEvent(cyberEnt, ref disableEvent);
}
else if (HasComp<BodyPartComponent>(cyberEnt))
{
var disableEvent = new BodyPartEnableChangedEvent(false);
RaiseLocalEvent(cyberEnt, ref disableEvent);
}
}
}

private void OnEmpDisabledRemoved(Entity<CyberneticsComponent> cyberEnt, ref EmpDisabledRemoved ev)
{
if (cyberEnt.Comp.Disabled)
{
cyberEnt.Comp.Disabled = false;
if (HasComp<OrganComponent>(cyberEnt))
{
var enableEvent = new OrganEnableChangedEvent(true);
RaiseLocalEvent(cyberEnt, ref enableEvent);
}
else if (HasComp<BodyPartComponent>(cyberEnt))
{
var enableEvent = new BodyPartEnableChangedEvent(true);
RaiseLocalEvent(cyberEnt, ref enableEvent);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public sealed partial class DelayedDeathComponent : Component
/// How long it has been since the delayed death timer started.
/// </summary>
public float DeathTimer;
}
}
6 changes: 1 addition & 5 deletions Content.Server/Backmen/DelayedDeath/DelayedDeathSystem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using Content.Shared.Body.Organ;
using Content.Shared.Body.Events;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Timing;
using Robust.Shared.Prototypes;

namespace Content.Server.Backmen.DelayedDeath;

public partial class DelayedDeathSystem : EntitySystem
Expand All @@ -29,4 +25,4 @@ public override void Update(float frameTime)
}
}
}
}
}
18 changes: 9 additions & 9 deletions Content.Server/Backmen/Surgery/SurgerySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ private void OnToolAfterInteract(Entity<SurgeryToolComponent> ent, ref AfterInte
private void OnSurgeryStepDamage(Entity<SurgeryTargetComponent> ent, ref SurgeryStepDamageEvent args) =>
SetDamage(args.Body, args.Damage, args.PartMultiplier, args.User, args.Part);

private void OnSurgeryDamageChange(Entity<SurgeryDamageChangeEffectComponent> ent, ref SurgeryStepDamageChangeEvent args)
{
var damageChange = ent.Comp.Damage;
if (HasComp<ForcedSleepingComponent>(args.Body))
damageChange = damageChange * ent.Comp.SleepModifier;

SetDamage(args.Body, damageChange, 0.5f, args.User, args.Part);
}

private void OnSurgerySpecialDamageChange(Entity<SurgerySpecialDamageChangeEffectComponent> ent, ref SurgeryStepDamageChangeEvent args)
{
if (ent.Comp.DamageType == "Rot")
Expand All @@ -140,15 +149,6 @@ private void OnSurgerySpecialDamageChange(Entity<SurgerySpecialDamageChangeEffec
_blindableSystem.AdjustEyeDamage((args.Body, blindComp), -blindComp!.EyeDamage);
}

private void OnSurgeryDamageChange(Entity<SurgeryDamageChangeEffectComponent> ent, ref SurgeryStepDamageChangeEvent args)
{
var damageChange = ent.Comp.Damage;
if (HasComp<ForcedSleepingComponent>(args.Body))
damageChange = damageChange * ent.Comp.SleepModifier;

SetDamage(args.Body, damageChange, 0.5f, args.User, args.Part);
}

private void OnStepScreamComplete(Entity<SurgeryStepEmoteEffectComponent> ent, ref SurgeryStepEvent args)
{
if (HasComp<ForcedSleepingComponent>(args.Body))
Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Body/Components/BrainComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ namespace Content.Server.Body.Components
[RegisterComponent, Access(typeof(BrainSystem))]
public sealed partial class BrainComponent : Component
{
/// <summary>
/// Shitmed Change: Is this brain currently controlling the entity?
/// </summary>
[DataField]
public bool Active = true;
}
}
10 changes: 10 additions & 0 deletions Content.Server/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ public override HashSet<EntityUid> GibPart(
return gibs;
}

public override bool BurnPart(EntityUid partId, BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false)
|| TerminatingOrDeleted(partId)
|| EntityManager.IsQueuedForDeletion(partId))
return false;

return base.BurnPart(partId, part);
}

protected override void ApplyPartMarkings(EntityUid target, BodyPartAppearanceComponent component)
{
return;
Expand Down
Loading
Loading