Files
wwdpublic/Content.Shared/Body/Systems/SharedBodySystem.cs
gluesniffler 2a33691a1c Ports Shitmed Updates From Goob (#1387)
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster

# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.

(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
2025-01-13 23:01:51 +03:00

84 lines
2.7 KiB
C#

using Content.Shared.Damage;
using Content.Shared.Movement.Systems;
using Content.Shared.Standing;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Shared.Body.Systems;
public abstract partial class SharedBodySystem : EntitySystem
{
/*
* See the body partial for how this works.
*/
/// <summary>
/// Container ID prefix for any body parts.
/// </summary>
public const string PartSlotContainerIdPrefix = "body_part_slot_";
/// <summary>
/// Container ID for the ContainerSlot on the body entity itself.
/// </summary>
public const string BodyRootContainerId = "body_root_part";
/// <summary>
/// Container ID prefix for any body organs.
/// </summary>
public const string OrganSlotContainerIdPrefix = "body_organ_slot_";
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] protected readonly IPrototypeManager Prototypes = default!;
[Dependency] protected readonly DamageableSystem Damageable = default!;
[Dependency] protected readonly MovementSpeedModifierSystem Movement = default!;
[Dependency] protected readonly SharedContainerSystem Containers = default!;
[Dependency] protected readonly SharedTransformSystem SharedTransform = default!;
[Dependency] protected readonly StandingStateSystem Standing = default!;
public override void Initialize()
{
base.Initialize();
InitializeBody();
InitializeParts();
InitializeOrgans();
// Shitmed Change Start
// To try and mitigate the server load due to integrity checks, we set up a Job Queue.
InitializeIntegrityQueue();
InitializePartAppearances();
// Shitmed Change End
}
/// <summary>
/// Inverse of <see cref="GetPartSlotContainerId"/>
/// </summary>
protected static string? GetPartSlotContainerIdFromContainer(string containerSlotId)
{
// This is blursed
var slotIndex = containerSlotId.IndexOf(PartSlotContainerIdPrefix, StringComparison.Ordinal);
if (slotIndex < 0)
return null;
var slotId = containerSlotId.Remove(slotIndex, PartSlotContainerIdPrefix.Length);
return slotId;
}
/// <summary>
/// Gets the container Id for the specified slotId.
/// </summary>
public static string GetPartSlotContainerId(string slotId)
{
return PartSlotContainerIdPrefix + slotId;
}
/// <summary>
/// Gets the container Id for the specified slotId.
/// </summary>
public static string GetOrganContainerId(string slotId)
{
return OrganSlotContainerIdPrefix + slotId;
}
}