Skip to content

Commit

Permalink
Shitmed Update 1 - Forma de Goob (DeltaV-Station#897)
Browse files Browse the repository at this point in the history
* full fucking send

* ope forgot to remove the EE scripts

* fix test

* fix shitcode fail

* DELTA THAT VALUE IS NULLABLE

* whoopsie daysie
  • Loading branch information
gluesniffler authored and deltanedas committed Dec 27, 2024
1 parent a778a9b commit bf33742
Show file tree
Hide file tree
Showing 79 changed files with 347 additions and 215 deletions.
4 changes: 4 additions & 0 deletions Content.Client/Smoking/MatchstickSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Shitmed Change Start

using Content.Shared.Smoking.Systems;

namespace Content.Client.Smoking;

public sealed class MatchstickSystem : SharedMatchstickSystem;

// Shitmed Change End
3 changes: 2 additions & 1 deletion Content.Server/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ public override HashSet<EntityUid> GibPart(
var ev = new BeingGibbedEvent(gibs);
RaiseLocalEvent(partId, ref ev);

QueueDel(partId);
if (gibs.Any())
QueueDel(partId);

return gibs;
}
Expand Down
11 changes: 9 additions & 2 deletions Content.Server/Body/Systems/BrainSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
using Content.Server.Ghost.Components;
using Content.Shared.Body.Components;
using Content.Shared.Body.Events;
using Content.Shared._Shitmed.Body.Organ; // Shitmed Change
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Pointing;

// Shitmed Change
using Content.Shared._Shitmed.Body.Organ;
using Content.Server._Shitmed.DelayedDeath;
using Content.Shared.Body.Systems;

namespace Content.Server.Body.Systems
{
public sealed class BrainSystem : EntitySystem
{
[Dependency] private readonly SharedMindSystem _mindSystem = default!;

[Dependency] private readonly SharedBodySystem _bodySystem = default!; // Shitmed Change
public override void Initialize()
{
base.Initialize();
Expand All @@ -30,6 +34,7 @@ private void HandleRemoval(EntityUid uid, BrainComponent _, ref OrganRemovedFrom

// 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)
Expand All @@ -38,6 +43,8 @@ private void HandleAddition(EntityUid uid, BrainComponent _, ref OrganAddedToBod
return;

RemComp<DebrainedComponent>(args.Body);
if (_bodySystem.TryGetBodyOrganEntityComps<HeartComponent>(args.Body, out var _))
RemComp<DelayedDeathComponent>(args.Body);
HandleMind(args.Body, uid);
}
// Shitmed Change End
Expand Down
9 changes: 5 additions & 4 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Shared._Shitmed.Body.Components; // GoobStation
using Content.Shared._Shitmed.Body.Components; // Shitmed Change
using Content.Shared._Shitmed.Body.Organ; // Shitmed Change
using Content.Server.Chat.Systems;
using Content.Server.EntityEffects.EffectConditions;
Expand All @@ -21,6 +21,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;


namespace Content.Server.Body.Systems;

[UsedImplicitly]
Expand Down Expand Up @@ -73,7 +74,7 @@ public override void Update(float frameTime)

respirator.NextUpdate += respirator.UpdateInterval;

if (_mobState.IsDead(uid) || HasComp<BreathingImmunityComponent>(uid)) // GoobStation: BreathingImmunity
if (_mobState.IsDead(uid) || HasComp<BreathingImmunityComponent>(uid)) // Shitmed: BreathingImmunity
continue;

// Begin DeltaV Code: Addition:
Expand All @@ -86,7 +87,7 @@ public override void Update(float frameTime)
// End DeltaV Code
UpdateSaturation(uid, multiplier * (float) respirator.UpdateInterval.TotalSeconds, respirator); // DeltaV: use multiplier instead of negating

if (!_mobState.IsIncapacitated(uid) || HasComp<DebrainedComponent>(uid)) // Shitmed Change - Cannot breathe in crit or when no brain.
if (!_mobState.IsIncapacitated(uid) && !HasComp<DebrainedComponent>(uid)) // Shitmed Change - Cannot breathe in crit or when no brain.
{
switch (respirator.Status)
{
Expand Down Expand Up @@ -304,7 +305,7 @@ private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
}
}

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

private void StopSuffocation(Entity<RespiratorComponent> ent)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Light/EntitySystems/MatchboxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Content.Server.Storage.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Smoking;
using Content.Shared.Smoking.Components;
using Content.Shared.Smoking.Components; // Shitmed Change

namespace Content.Server.Light.EntitySystems
{
Expand Down
16 changes: 10 additions & 6 deletions Content.Server/Light/EntitySystems/MatchstickSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Smoking;
using Content.Shared.Smoking.Components;
using Content.Shared.Smoking.Systems;
using Content.Shared.Smoking.Components; // Shitmed Change
using Content.Shared.Smoking.Systems; // Shitmed Change
using Content.Shared.Temperature;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
Expand All @@ -13,7 +13,7 @@

namespace Content.Server.Light.EntitySystems
{
public sealed class MatchstickSystem : SharedMatchstickSystem
public sealed class MatchstickSystem : SharedMatchstickSystem // Shitmed Change
{
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
Expand Down Expand Up @@ -85,22 +85,25 @@ public void Ignite(Entity<MatchstickComponent> matchstick, EntityUid user)
_audio.PlayPvs(component.IgniteSound, matchstick, AudioParams.Default.WithVariation(0.125f).WithVolume(-0.125f));

// Change state
SetState((matchstick, component), SmokableState.Lit);
SetState((matchstick, component), SmokableState.Lit); // Shitmed Change
_litMatches.Add(matchstick);
matchstick.Owner.SpawnTimer(component.Duration * 1000, delegate
{
SetState((matchstick, component), SmokableState.Burnt);
SetState((matchstick, component), SmokableState.Burnt); // Shitmed Change
_litMatches.Remove(matchstick);
});
}

// Shitmed Change Start
public override bool SetState(Entity<MatchstickComponent> ent, SmokableState value)
{
if (!base.SetState(ent, value))
return false;

var (uid, component) = ent;

// Shitmed Change End

if (_lights.TryGetLight(uid, out var pointLightComponent))
{
_lights.SetEnabled(uid, component.CurrentState == SmokableState.Lit, pointLightComponent);
Expand All @@ -124,7 +127,8 @@ public override bool SetState(Entity<MatchstickComponent> ent, SmokableState val
_appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance);
}

return true;

return true; // Shitmed Change
}
}
}
38 changes: 38 additions & 0 deletions Content.Server/_Shitmed/Body/Organ/HeartSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Shared.Body.Events;
using Content.Server.Body.Components;
using Content.Shared.Body.Systems;
using Content.Shared._Shitmed.Body.Organ;
using Content.Server._Shitmed.DelayedDeath;

namespace Content.Server._Shitmed.Body.Organ;

public sealed class HeartSystem : EntitySystem
{
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<HeartComponent, OrganAddedToBodyEvent>(HandleAddition);
SubscribeLocalEvent<HeartComponent, OrganRemovedFromBodyEvent>(HandleRemoval);
}

private void HandleRemoval(EntityUid uid, HeartComponent _, ref OrganRemovedFromBodyEvent args)
{
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.OldBody))
return;

// TODO: Add some form of very violent bleeding effect.
EnsureComp<DelayedDeathComponent>(args.OldBody);
}

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

if (_bodySystem.TryGetBodyOrganEntityComps<BrainComponent>(args.Body, out var _))
RemComp<DelayedDeathComponent>(args.Body);
}
// Shitmed-End
}
16 changes: 16 additions & 0 deletions Content.Server/_Shitmed/DelayedDeath/DelayedDeathComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Content.Server._Shitmed.DelayedDeath;

[RegisterComponent]
public sealed partial class DelayedDeathComponent : Component
{
/// <summary>
/// How long it takes to kill the entity.
/// </summary>
[DataField]
public float DeathTime = 60;

/// <summary>
/// How long it has been since the delayed death timer started.
/// </summary>
public float DeathTimer;
}
28 changes: 28 additions & 0 deletions Content.Server/_Shitmed/DelayedDeath/DelayedDeathSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Prototypes;
namespace Content.Server._Shitmed.DelayedDeath;

public partial class DelayedDeathSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly IPrototypeManager _prototypes = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);

using var query = EntityQueryEnumerator<DelayedDeathComponent>();
while (query.MoveNext(out var ent, out var component))
{
component.DeathTimer += frameTime;

if (component.DeathTimer >= component.DeathTime && !_mobState.IsDead(ent))
{
var damage = new DamageSpecifier(_prototypes.Index<DamageTypePrototype>("Bloodloss"), 150);
_damageable.TryChangeDamage(ent, damage, partMultiplier: 0f);
}
}
}
}
24 changes: 7 additions & 17 deletions Content.Server/_Shitmed/Medical/Surgery/SurgerySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ public override void Initialize()

SubscribeLocalEvent<SurgeryToolComponent, AfterInteractEvent>(OnToolAfterInteract);
SubscribeLocalEvent<SurgeryTargetComponent, SurgeryStepDamageEvent>(OnSurgeryStepDamage);
SubscribeLocalEvent<SurgeryDamageChangeEffectComponent, SurgeryStepEvent>(OnSurgeryDamageChange);
SubscribeLocalEvent<SurgerySpecialDamageChangeEffectComponent, SurgeryStepEvent>(OnSurgerySpecialDamageChange);
// 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.
SubscribeLocalEvent<SurgerySpecialDamageChangeEffectComponent, SurgeryStepDamageChangeEvent>(OnSurgerySpecialDamageChange);
SubscribeLocalEvent<SurgeryDamageChangeEffectComponent, SurgeryStepDamageChangeEvent>(OnSurgeryDamageChange);
SubscribeLocalEvent<SurgeryStepEmoteEffectComponent, SurgeryStepEvent>(OnStepScreamComplete);
SubscribeLocalEvent<SurgeryStepSpawnEffectComponent, SurgeryStepEvent>(OnStepSpawnComplete);
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
Expand Down Expand Up @@ -129,33 +131,21 @@ 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 SurgeryStepEvent args)
private void OnSurgeryDamageChange(Entity<SurgeryDamageChangeEffectComponent> ent, ref SurgeryStepDamageChangeEvent args)
{
// This unintentionally punishes the user if they have an organ in another hand that is already used.
// Imo surgery shouldn't let you automatically pick tools on both hands anyway, it should only use the one you've got in your selected hand.
if (ent.Comp.IsConsumable
&& args.Tools.Where(tool => TryComp<OrganComponent>(tool, out var organComp)
&& !_body.TrySetOrganUsed(tool, true, organComp)).Any())
return;

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 SurgeryStepEvent args)
private void OnSurgerySpecialDamageChange(Entity<SurgerySpecialDamageChangeEffectComponent> ent, ref SurgeryStepDamageChangeEvent args)
{
if (ent.Comp.IsConsumable
&& args.Tools.Where(tool => TryComp<OrganComponent>(tool, out var organComp)
&& !_body.TrySetOrganUsed(tool, true, organComp)).Any())
return;

if (ent.Comp.DamageType == "Rot")
_rot.ReduceAccumulator(args.Body, TimeSpan.FromSeconds(2147483648)); // BEHOLD, SHITCODE THAT I JUST COPY PASTED. I'll redo it at some point, pinky swear :)
else if (ent.Comp.DamageType == "Eye"
&& TryComp(args.Body, out BlindableComponent? blindComp)
&& TryComp(ent, out BlindableComponent? blindComp)
&& blindComp.EyeDamage > 0)
_blindableSystem.AdjustEyeDamage((args.Body, blindComp), -blindComp!.EyeDamage);
}
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Body/Organ/OrganComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ public sealed partial class OrganComponent : Component, ISurgeryToolComponent //
[DataField, AutoNetworkedField]
public EntityUid? Body;

/// <summary>
/// Shitmed Change:Relevant body this organ originally belonged to.
/// FOR WHATEVER FUCKING REASON AUTONETWORKING THIS CRASHES GIBTEST AAAAAAAAAAAAAAA
/// </summary>
[DataField]
public EntityUid? OriginalBody;

// Shitmed Change Start
/// <summary>
/// Shitmed Change: Shitcodey solution to not being able to know what name corresponds to each organ's slot ID
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Body/Systems/SharedBodySystem.Body.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ public virtual HashSet<EntityUid> GibPart(
if (IsPartRoot(bodyEnt, partId, part: part))
return gibs;

ChangeSlotState((partId, part), true);
RemovePartChildren((partId, part), bodyEnt);
foreach (var organ in GetPartOrgans(partId, part))
{
Expand Down
14 changes: 11 additions & 3 deletions Content.Shared/Body/Systems/SharedBodySystem.Organs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Body.Events;
using Content.Shared.Body.Organ;
using Content.Shared.Body.Part;
using Content.Shared.Damage; // Shitmed Change
using Robust.Shared.Containers;

namespace Content.Shared.Body.Systems;
Expand All @@ -20,10 +21,17 @@ private void AddOrgan(

if (organEnt.Comp.Body is not null)
{
organEnt.Comp.OriginalBody = organEnt.Comp.Body; // Shitmed Change
var addedInBodyEv = new OrganAddedToBodyEvent(bodyUid, parentPartUid);
RaiseLocalEvent(organEnt, ref addedInBodyEv);
}

// Shitmed Change Start
if (TryComp(parentPartUid, out DamageableComponent? damageable)
&& damageable.TotalDamage > 200)
TrySetOrganUsed(organEnt, true, organEnt.Comp);
// Shitmed Change End

Dirty(organEnt, organEnt.Comp);
}

Expand Down Expand Up @@ -211,14 +219,14 @@ public bool TryGetBodyOrganEntityComps<T>(
}

// Shitmed Change Start

public bool TrySetOrganUsed(EntityUid organId, bool used, OrganComponent? organ = null)
{
if (!Resolve(organId, ref organ)
|| organ.Used == true)
|| organ.Used == used)
return false;

organ.Used = true;
organ.Used = used;
Dirty(organId, organ);
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ private void EnablePart(Entity<BodyPartComponent> partEnt)
public void ChangeSlotState(Entity<BodyPartComponent> partEnt, bool disable)
{
if (partEnt.Comp.Body is not null
&& TryComp<InventoryComponent>(partEnt.Comp.Body, out var inventory) // GoobStation: Prevent error for non-humanoids
&& TryComp<InventoryComponent>(partEnt.Comp.Body, out var inventory) // Prevent error for non-humanoids
&& GetBodyPartCount(partEnt.Comp.Body.Value, partEnt.Comp.PartType) == 1
&& TryGetPartSlotContainerName(partEnt.Comp.PartType, out var containerNames))
{
foreach (var containerName in containerNames)
{
_inventorySystem.SetSlotStatus(partEnt.Comp.Body.Value, containerName, disable, inventory); // GoobStation: pass inventory
_inventorySystem.SetSlotStatus(partEnt.Comp.Body.Value, containerName, disable, inventory);
var ev = new RefreshInventorySlotsEvent(containerName);
RaiseLocalEvent(partEnt.Comp.Body.Value, ev);
}
Expand Down Expand Up @@ -567,7 +567,7 @@ public bool CanAttachPart(
}

/// <summary>
/// GoobStation: Returns true if this parentId supports attaching a new part to the specified slot.
/// Shitmed Change: Returns true if this parentId supports attaching a new part to the specified slot.
/// </summary>
public bool CanAttachToSlot(
EntityUid parentId,
Expand Down
Loading

0 comments on commit bf33742

Please sign in to comment.