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 11 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
  •  
  •  
  •  
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._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
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
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 @@ -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
AwareFoxy marked this conversation as resolved.
Show resolved Hide resolved
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
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;
}
}
10 changes: 10 additions & 0 deletions Content.Server/Body/Systems/BodySystem.cs
AwareFoxy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
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
AwareFoxy marked this conversation as resolved.
Show resolved Hide resolved
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
2 changes: 1 addition & 1 deletion 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.
AwareFoxy marked this conversation as resolved.
Show resolved Hide resolved
{
switch (respirator.Status)
{
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
18 changes: 10 additions & 8 deletions Content.Server/Cloning/CloningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
return false;

var mind = mindEnt.Comp;
if (ClonesWaitingForMind.TryGetValue(mind, out var clone))
// _CorvaxNext: surgery Remove this logic entirely, infinite clone army
/*if (ClonesWaitingForMind.TryGetValue(mind, out var clone))
{
if (EntityManager.EntityExists(clone) &&
!_mobStateSystem.IsDead(clone) &&
Expand All @@ -153,10 +154,11 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
return false; // Mind already has clone

ClonesWaitingForMind.Remove(mind);
}
}*/

if (mind.OwnedEntity != null && !_mobStateSystem.IsDead(mind.OwnedEntity.Value))
return false; // Body controlled by mind is not dead
// _CorvaxNext: surgery Lets you clone living people
//if (mind.OwnedEntity != null && !_mobStateSystem.IsDead(mind.OwnedEntity.Value))
// return false; // Body controlled by mind is not dead

// Yes, we still need to track down the client because we need to open the Eui
if (mind.UserId == null || !_playerManager.TryGetSessionById(mind.UserId.Value, out var client))
Expand All @@ -171,10 +173,10 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
if (!TryComp<PhysicsComponent>(bodyToClone, out var physics))
return false;

var cloningCost = (int) Math.Round(physics.FixturesMass);
var cloningCost = (int)Math.Round(physics.FixturesMass);

if (_configManager.GetCVar(CCVars.BiomassEasyMode))
cloningCost = (int) Math.Round(cloningCost * EasyModeCloningCost);
cloningCost = (int)Math.Round(cloningCost * EasyModeCloningCost);

// biomass checks
var biomassAmount = _material.GetMaterialAmount(uid, clonePod.RequiredMaterial);
Expand All @@ -194,7 +196,7 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
if (TryComp<DamageableComponent>(bodyToClone, out var damageable) &&
damageable.Damage.DamageDict.TryGetValue("Cellular", out var cellularDmg))
{
var chance = Math.Clamp((float) (cellularDmg / 100), 0, 1);
var chance = Math.Clamp((float)(cellularDmg / 100), 0, 1);
chance *= failChanceModifier;

if (cellularDmg > 0 && clonePod.ConnectedConsole != null)
Expand Down Expand Up @@ -223,7 +225,7 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
cloneMindReturn.Mind = mind;
cloneMindReturn.Parent = uid;
_containerSystem.Insert(mob, clonePod.BodyContainer);
ClonesWaitingForMind.Add(mind, mob);
//ClonesWaitingForMind.Add(mind, mob); // _CorvaxNext: surgery
UpdateStatus(uid, CloningPodStatus.NoMind, clonePod);
_euiManager.OpenEui(new AcceptCloningEui(mindEnt, mind, this), client);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Body.Components;
using Content.Shared.Body.Part; // _CorvaxNext: surgery
using Content.Shared.Inventory;
using Content.Shared.Popups;
using JetBrains.Annotations;
Expand All @@ -25,8 +26,18 @@ public void Execute(EntityUid bodyId, DestructibleSystem system, EntityUid? caus
}
}

sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);

system.EntityManager.QueueDeleteEntity(bodyId);
// start-_CorvaxNext: surgery
if (system.EntityManager.TryGetComponent<BodyPartComponent>(bodyId, out var bodyPart))
{
if (bodyPart.CanSever
&& system.BodySystem.BurnPart(bodyId, bodyPart))
sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);
}
else
{
sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);
system.EntityManager.QueueDeleteEntity(bodyId);
}
// end-_CorvaxNext: surgery
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Server.Speech.EntitySystems;

namespace Content.Server.Speech.Components;

[RegisterComponent]
[Access(typeof(OhioAccentSystem))]
public sealed partial class OhioAccentComponent : Component
{ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random;

namespace Content.Server.Speech.EntitySystems;

public sealed class OhioAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<OhioAccentComponent, AccentGetEvent>(OnAccent);
}

private void OnAccent(EntityUid uid, OhioAccentComponent component, AccentGetEvent args)
{
var message = args.Message;

message = _replacement.ApplyReplacements(message, "ohio");

// Prefix
if (_random.Prob(0.15f))
{
var pick = _random.Next(1, 7);

// Reverse sanitize capital
message = message[0].ToString().ToLower() + message.Remove(0, 1);
message = Loc.GetString($"accent-ohio-prefix-{pick}") + " " + message;
}

// Sanitize capital again, in case we substituted a word that should be capitalized
message = message[0].ToString().ToUpper() + message.Remove(0, 1);

// Suffixes
if (_random.Prob(0.3f))
{
var pick = _random.Next(1, 13);
message += Loc.GetString($"accent-ohio-suffix-{pick}");
}

args.Message = message;
}
};
1 change: 1 addition & 0 deletions Content.Server/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Body.Systems;
using Content.Shared.Body.Events;
using Content.Shared.ActionBlocker;
using Content.Shared._CorvaxNext.Surgery.Body.Events;
using Content.Shared.Body.Part;
using Content.Shared.CombatMode;
using Content.Shared.Damage.Systems;
Expand Down
29 changes: 0 additions & 29 deletions Content.Server/Light/Components/MatchstickComponent.cs

This file was deleted.

1 change: 1 addition & 0 deletions Content.Server/Light/EntitySystems/MatchboxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.Storage.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Smoking;
using Content.Shared.Smoking.Components; // _CorvaxNext Change

namespace Content.Server.Light.EntitySystems
{
Expand Down
Loading
Loading