| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // SPDX-FileCopyrightText: 2022 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2022 Jezithyr <Jezithyr@gmail.com>
- // SPDX-FileCopyrightText: 2022 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
- // SPDX-FileCopyrightText: 2023 Jezithyr <jezithyr@gmail.com>
- // SPDX-FileCopyrightText: 2023 Psychpsyo <60073468+Psychpsyo@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2023 Visne <39844191+Visne@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2023 metalgearsloth <comedian_vs_clown@hotmail.com>
- // SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2025 Piras314 <p1r4s@proton.me>
- //
- // SPDX-License-Identifier: AGPL-3.0-or-later
- 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();
- InitializeRelay();
- // 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;
- }
- }
|