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] Хирургия макак, рыб и кучу чего ещё (work in progress) #77

Merged
merged 18 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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref Ap
!buckled ||
args.Sprite == null)
{
// _CorvaxNext: Laying System
// CorvaxNext: Laying System
//_rotationVisualizerSystem.SetHorizontalAngle((uid, rotVisuals), rotVisuals.DefaultRotation);
return;
}
Expand Down
5 changes: 3 additions & 2 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._CorvaxNext.Surgery.Body.Events;
AwareFoxy marked this conversation as resolved.
Show resolved Hide resolved
using Content.Shared.Body.Part;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
Expand Down Expand Up @@ -51,8 +52,8 @@ public override void Initialize()
SubscribeLocalEvent<HandsComponent, ComponentShutdown>(OnHandsShutdown);
SubscribeLocalEvent<HandsComponent, ComponentHandleState>(HandleComponentState);
SubscribeLocalEvent<HandsComponent, VisualsChangedEvent>(OnVisualsChanged);
SubscribeLocalEvent<HandsComponent, BodyPartRemovedEvent>(HandleBodyPartRemoved); // _CorvaxNext: surgery
SubscribeLocalEvent<HandsComponent, BodyPartDisabledEvent>(HandleBodyPartDisabled); // _CorvaxNext: surgery
SubscribeLocalEvent<HandsComponent, BodyPartRemovedEvent>(HandleBodyPartRemoved); // CorvaxNext: surgery
SubscribeLocalEvent<HandsComponent, BodyPartDisabledEvent>(HandleBodyPartDisabled); // CorvaxNext: surgery

OnHandSetActive += OnHandActivated;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Humanoid/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void UpdateLayers(HumanoidAppearanceComponent component, SpriteComponent
foreach (var (key, info) in component.CustomBaseLayers)
{
oldLayers.Remove(key);
// Shitmed modification: For whatever reason these weren't actually ignoring the skin color as advertised.
// CorvaxNext modification: For whatever reason these weren't actually ignoring the skin color as advertised.
SetLayerData(component, sprite, key, info.Id, sexMorph: false, color: info.Color, overrideSkin: true);
}

Expand Down
12 changes: 6 additions & 6 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.Arcade1);
human.AddFunction(ContentKeyFunctions.Arcade2);
human.AddFunction(ContentKeyFunctions.Arcade3);
human.AddFunction(ContentKeyFunctions.TargetHead); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetTorso); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetLeftArm); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetRightArm); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetLeftLeg); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetRightLeg); // _CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetHead); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetTorso); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetLeftArm); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetRightArm); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetLeftLeg); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.TargetRightLeg); // CorvaxNext: surgery
human.AddFunction(ContentKeyFunctions.OfferItem); // Corvax-Next-Offer
human.AddFunction(ContentKeyFunctions.ToggleStanding); // CorvaxNext: laying system toggle standing

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Inventory/ClientInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override void Initialize()

SubscribeLocalEvent<InventorySlotsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<InventorySlotsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<InventorySlotsComponent, RefreshInventorySlotsEvent>(OnRefreshInventorySlots); // _CorvaxNext: surgery
SubscribeLocalEvent<InventorySlotsComponent, RefreshInventorySlotsEvent>(OnRefreshInventorySlots); // CorvaxNext: surgery
SubscribeLocalEvent<InventoryComponent, ComponentShutdown>(OnShutdown);

SubscribeLocalEvent<InventorySlotsComponent, DidEquipEvent>((_, comp, args) =>
Expand Down
8 changes: 6 additions & 2 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // WD EDIT
AddButton(EngineKeyFunctions.MoveRight);
AddButton(EngineKeyFunctions.Walk);
AddCheckBox("ui-options-hotkey-toggle-walk", _cfg.GetCVar(CCVars.ToggleWalk), HandleToggleWalk);
AddCheckBox("ui-options-hotkey-auto-up", _cfg.GetCVar(Shared._CorvaxNext.NextVars.NextVars.AutoGetUp), HandleToggleAutoGetUp); // _CorvaxNext: Laying System
AddCheckBox("ui-options-hotkey-auto-up", _cfg.GetCVar(Shared._CorvaxNext.NextVars.NextVars.AutoGetUp), HandleToggleAutoGetUp); // CorvaxNext: Laying System
InitToggleWalk();

AddHeader("ui-options-header-camera");
Expand All @@ -194,7 +194,7 @@ void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // WD EDIT
AddButton(ContentKeyFunctions.RotateStoredItem);
AddButton(ContentKeyFunctions.SaveItemLocation);
AddButton(ContentKeyFunctions.OfferItem); // Corvax-Next-Offer
AddButton(ContentKeyFunctions.ToggleStanding); // _CorvaxNext: Laying System
AddButton(ContentKeyFunctions.ToggleStanding); // CorvaxNext: Laying System
AddHeader("ui-options-header-interaction-adv");
AddButton(ContentKeyFunctions.SmartEquipBackpack);
AddButton(ContentKeyFunctions.SmartEquipBelt);
Expand Down Expand Up @@ -245,9 +245,13 @@ void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // WD EDIT
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);
// end-_CorvaxNext: surgery

AddHeader("ui-options-header-misc");
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 @@
// CorvaxNext Change Start

using Content.Shared.Smoking.Systems;

namespace Content.Client.Smoking;

public sealed class MatchstickSystem : SharedMatchstickSystem;

// CorvaxNext Change End
16 changes: 8 additions & 8 deletions Content.Client/_CorvaxNext/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
4 changes: 2 additions & 2 deletions Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public override void Update(float frameTime)
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); // _CorvaxNext
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false, canSever: false); // CorvaxNext
if (!barotrauma.TakingDamage)
{
barotrauma.TakingDamage = true;
Expand All @@ -251,7 +251,7 @@ public override void Update(float frameTime)
var damageScale = MathF.Min(((pressure / Atmospherics.HazardHighPressure) - 1) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);

// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false); // _CorvaxNext
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false); // CorvaxNext

if (!barotrauma.TakingDamage)
{
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>
/// CorvaxNext Change: Is this brain currently controlling the entity?
/// </summary>
[DataField]
public bool Active = true;
}
}
12 changes: 11 additions & 1 deletion Content.Server/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void Initialize()

SubscribeLocalEvent<BodyComponent, MoveInputEvent>(OnRelayMoveInput);
SubscribeLocalEvent<BodyComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
SubscribeLocalEvent<BodyPartComponent, AttemptEntityGibEvent>(OnGibTorsoAttempt); // _CorvaxNext: surgery
SubscribeLocalEvent<BodyPartComponent, AttemptEntityGibEvent>(OnGibTorsoAttempt); // CorvaxNext: surgery
}

// start-_CorvaxNext: surgery
Expand Down Expand Up @@ -178,6 +178,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
58 changes: 46 additions & 12 deletions Content.Server/Body/Systems/BrainSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Content.Shared.Body.Components;
using Content.Shared.Body.Systems;
using Content.Shared.Body.Events;
using Content.Shared.Body.Organ;
using Content.Server._CorvaxNext.DelayedDeath;
using Content.Shared._CorvaxNext.Surgery.Body.Organs;
using Content.Shared.Mind;
Expand All @@ -28,30 +27,38 @@ public override void Initialize()
}

// start-_CorvaxNext: surgery
private void HandleRemoval(EntityUid uid, BrainComponent _, ref OrganRemovedFromBodyEvent args)
private void HandleRemoval(EntityUid uid, BrainComponent brain, ref OrganRemovedFromBodyEvent args)
{
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.OldBody))
return;

// Prevents revival, should kill the user within a given timespan too.
EnsureComp<DebrainedComponent>(args.OldBody);
EnsureComp<DelayedDeathComponent>(args.OldBody);
HandleMind(uid, args.OldBody);
brain.Active = false;
if (!CheckOtherBrains(args.OldBody))
{
// Prevents revival, should kill the user within a given timespan too.
EnsureComp<DebrainedComponent>(args.OldBody);
EnsureComp<DelayedDeathComponent>(args.OldBody);
HandleMind(uid, args.OldBody);
}
}

private void HandleAddition(EntityUid uid, BrainComponent _, ref OrganAddedToBodyEvent args)
private void HandleAddition(EntityUid uid, BrainComponent brain, ref OrganAddedToBodyEvent args)
{
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.Body))
return;

RemComp<DebrainedComponent>(args.Body);
if (_bodySystem.TryGetBodyOrganEntityComps<HeartComponent>(args.Body, out var _))
RemComp<DelayedDeathComponent>(args.Body);
HandleMind(args.Body, uid);
if (!CheckOtherBrains(args.Body))
{
RemComp<DebrainedComponent>(args.Body);
if (_bodySystem.TryGetBodyOrganEntityComps<HeartComponent>(args.Body, out var _))
RemComp<DelayedDeathComponent>(args.Body);
HandleMind(args.Body, uid);
}
}
// end-_CorvaxNext: surgery

private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
// CorvaxNext: surgery
private void HandleMind(EntityUid newEntity, EntityUid oldEntity, BrainComponent? brain = null)
{
if (TerminatingOrDeleted(newEntity) || TerminatingOrDeleted(oldEntity))
return;
Expand All @@ -67,8 +74,35 @@ private void HandleMind(EntityUid newEntity, EntityUid oldEntity)
return;

_mindSystem.TransferTo(mindId, newEntity, mind: mind);
if (brain != null) // CorvaxNext: surgery
brain.Active = true; // CorvaxNext: surgery
}

// start-_CorvaxNext: surgery
private bool CheckOtherBrains(EntityUid entity)
{
var hasOtherBrains = false;
if (TryComp<BodyComponent>(entity, out var body))
{
if (TryComp<BrainComponent>(entity, out var bodyBrain))
hasOtherBrains = true;
else
{
foreach (var (organ, _) in _bodySystem.GetBodyOrgans(entity, body))
{
if (TryComp<BrainComponent>(organ, out var brain) && brain.Active)
{
hasOtherBrains = true;
break;
}
}
}
}

return hasOtherBrains;
}

// end-_CorvaxNext: surgery
private void OnPointAttempt(Entity<BrainComponent> ent, ref PointAttemptEvent args)
{
args.Cancel();
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ 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.
if (!_mobState.IsIncapacitated(uid) && !HasComp<DebrainedComponent>(uid)) // CorvaxNext Change - Cannot breathe in crit or when no brain.
{
switch (respirator.Status)
{
Expand Down Expand Up @@ -296,7 +296,7 @@ private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
}
}

_damageableSys.TryChangeDamage(ent, HasComp<DebrainedComponent>(ent) ? ent.Comp.Damage * 4.5f : ent.Comp.Damage, interruptsDoAfters: false); // _CorvaxNext: surgery
_damageableSys.TryChangeDamage(ent, HasComp<DebrainedComponent>(ent) ? ent.Comp.Damage * 4.5f : ent.Comp.Damage, interruptsDoAfters: false); // CorvaxNext: surgery
}

private void StopSuffocation(Entity<RespiratorComponent> ent)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cloning/CloningConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private CloningConsoleBoundUserInterfaceState GetUserInterfaceState(CloningConso
{
scanBodyInfo = MetaData(scanBody.Value).EntityName;

if (!_mobStateSystem.IsDead(scanBody.Value))
if (false) // CorvaxNext: surgery Lets you clone living people
{
clonerStatus = ClonerStatus.ScannerOccupantAlive;
}
Expand Down
Loading
Loading