fish-station/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Vigers Ray 939076ff99 Merge remote-tracking branch 'space-wizards/master'
# Conflicts:
#	.github/CODEOWNERS
#	.github/workflows/publish.yml
#	Content.Client/Administration/UI/BanPanel/BanPanel.xaml
#	Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
#	Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml.cs
#	Content.Client/Entry/EntryPoint.cs
#	Content.Client/Hands/Systems/HandsSystem.cs
#	Content.Client/Humanoid/HumanoidAppearanceSystem.cs
#	Content.Client/Humanoid/SingleMarkingPicker.xaml.cs
#	Content.Client/IoC/ClientContentIoC.cs
#	Content.Client/Lobby/LobbyState.cs
#	Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
#	Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs
#	Content.Client/Lobby/UI/LobbyGui.xaml
#	Content.Client/NetworkConfigurator/NetworkConfiguratorConfigurationMenu.xaml
#	Content.Client/Options/UI/EscapeMenu.xaml
#	Content.Client/Stealth/StealthSystem.cs
#	Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorWindow.xaml.cs
#	Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs
#	Content.Client/UserInterface/Systems/Emotes/EmotesUIController.cs
#	Content.Client/Weapons/Ranged/Systems/GunSystem.cs
#	Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs
#	Content.IntegrationTests/Tests/Damageable/DamageableTest.cs
#	Content.IntegrationTests/Tests/PostMapInitTest.cs
#	Content.Server/Administration/Commands/AdminWhoCommand.cs
#	Content.Server/Administration/Commands/PardonCommand.cs
#	Content.Server/Administration/Commands/RoleUnbanCommand.cs
#	Content.Server/Administration/Commands/SetOutfitCommand.cs
#	Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
#	Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
#	Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs
#	Content.Server/Body/Components/BloodstreamComponent.cs
#	Content.Server/Body/Systems/BloodstreamSystem.cs
#	Content.Server/Body/Systems/MetabolizerSystem.cs
#	Content.Server/Body/Systems/RespiratorSystem.cs
#	Content.Server/Chat/Managers/ChatSanitizationManager.cs
#	Content.Server/Chat/Systems/ChatSystem.Emote.cs
#	Content.Server/Chat/Systems/ChatSystem.cs
#	Content.Server/CrewManifest/CrewManifestSystem.cs
#	Content.Server/Emp/EmpSystem.cs
#	Content.Server/Explosion/EntitySystems/TriggerSystem.cs
#	Content.Server/Fax/FaxSystem.cs
#	Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
#	Content.Server/GameTicking/Commands/ForceMapCommand.cs
#	Content.Server/GameTicking/Commands/ForcePresetCommand.cs
#	Content.Server/GameTicking/Presets/GamePresetPrototype.cs
#	Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs
#	Content.Server/GameTicking/Rules/Components/ChangelingRuleComponent.cs
#	Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
#	Content.Server/Ghost/Roles/GhostRoleSystem.cs
#	Content.Server/Implants/Components/ScramImplantComponent.cs
#	Content.Server/Implants/SubdermalImplantSystem.cs
#	Content.Server/Materials/ProduceMaterialExtractorSystem.cs
#	Content.Server/Medical/HealthAnalyzerSystem.cs
#	Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs
#	Content.Server/NPC/Systems/NPCSystem.cs
#	Content.Server/Polymorph/Systems/PolymorphSystem.cs
#	Content.Server/Radio/EntitySystems/HeadsetSystem.cs
#	Content.Server/Repairable/RepairableSystem.cs
#	Content.Server/Revenant/EntitySystems/RevenantSystem.cs
#	Content.Server/RoundEnd/RoundEndSystem.cs
#	Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
#	Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs
#	Content.Server/Speech/EntitySystems/FrontalLispSystem.cs
#	Content.Server/Speech/EntitySystems/LizardAccentSystem.cs
#	Content.Server/Speech/EntitySystems/MothAccentSystem.cs
#	Content.Server/Speech/EntitySystems/OwOAccentSystem.cs
#	Content.Server/Station/Systems/StationSpawningSystem.cs
#	Content.Server/StationEvents/Events/MeteorSwarmSystem.cs
#	Content.Server/Stunnable/Components/StunOnCollideComponent.cs
#	Content.Server/SurveillanceCamera/Components/SurveillanceCameraRouterComponent.cs
#	Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs
#	Content.Server/Zombies/ZombieSystem.Transform.cs
#	Content.Server/Zombies/ZombieSystem.cs
#	Content.Shared/Actions/SharedActionsSystem.cs
#	Content.Shared/Bed/SharedBedSystem.cs
#	Content.Shared/Blocking/BlockingSystem.cs
#	Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
#	Content.Shared/Chemistry/Components/SolutionRegenerationComponent.cs
#	Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs
#	Content.Shared/Construction/Conditions/TileNotBlocked.cs
#	Content.Shared/Cuffs/SharedCuffableSystem.cs
#	Content.Shared/Doors/Systems/SharedDoorSystem.cs
#	Content.Shared/Emoting/EmoteAttemptEvent.cs
#	Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs
#	Content.Shared/Eye/VisibilityFlags.cs
#	Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
#	Content.Shared/Humanoid/HumanoidCharacterAppearance.cs
#	Content.Shared/Interaction/SmartEquipSystem.cs
#	Content.Shared/Inventory/InventorySystem.Relay.cs
#	Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs
#	Content.Shared/Medical/Healing/HealingSystem.cs
#	Content.Shared/Medical/HealingComponent.cs
#	Content.Shared/Nutrition/EntitySystems/FoodSystem.cs
#	Content.Shared/Slippery/SlipperySystem.cs
#	Content.Shared/SprayPainter/SharedSprayPainterSystem.cs
#	Content.Shared/Standing/StandingStateComponent.cs
#	Content.Shared/Standing/StandingStateSystem.cs
#	Content.Shared/Station/SharedStationSpawningSystem.cs
#	Content.Shared/Stunnable/SharedStunSystem.cs
#	Content.Shared/SurveillanceCamera/SharedSurveillanceCameraMonitorSystem.cs
#	Content.Shared/VendingMachines/VendingMachineComponent.cs
#	Content.Shared/Warps/WarpPointSystem.cs
#	Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
#	Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
#	Content.Shared/Wieldable/SharedWieldableSystem.cs
#	Resources/Audio/Ambience/Antag/attributions.yml
#	Resources/Audio/Ambience/Antag/changeling_start.ogg
#	Resources/Audio/Effects/attributions.yml
#	Resources/Audio/Lobby/attributions.yml
#	Resources/Audio/Machines/attributions.yml
#	Resources/Audio/Weapons/Guns/Gunshots/attributions.yml
#	Resources/Locale/en-US/_strings/administration/antag.ftl
#	Resources/Locale/en-US/_strings/administration/commands/camera.ftl
#	Resources/Locale/en-US/_strings/administration/commands/dsay-command.ftl
#	Resources/Locale/en-US/_strings/administration/commands/follow-command.ftl
#	Resources/Locale/en-US/_strings/administration/smites.ftl
#	Resources/Locale/en-US/_strings/administration/ui/admin-camera-window.ftl
#	Resources/Locale/en-US/_strings/administration/ui/role-bans.ftl
#	Resources/Locale/en-US/_strings/alerts/alerts.ftl
#	Resources/Locale/en-US/_strings/atmos/gas-pressure-regulator-system.ftl
#	Resources/Locale/en-US/_strings/bonk/components/bonkable-component.ftl
#	Resources/Locale/en-US/_strings/commands/add-body-part-command.ftl
#	Resources/Locale/en-US/_strings/commands/admin-logs-command.ftl
#	Resources/Locale/en-US/_strings/commands/admin-who-command.ftl
#	Resources/Locale/en-US/_strings/commands/asay-command.ftl
#	Resources/Locale/en-US/_strings/commands/crew-manifest-command.ftl
#	Resources/Locale/en-US/_strings/commands/deadmin-command.ftl
#	Resources/Locale/en-US/_strings/commands/delete-component-command.ftl
#	Resources/Locale/en-US/_strings/commands/destroy-mechanism-command.ftl
#	Resources/Locale/en-US/_strings/commands/dirty-command.ftl
#	Resources/Locale/en-US/_strings/commands/dsay-command.ftl
#	Resources/Locale/en-US/_strings/commands/dump-reagent-guide-text-command.ftl
#	Resources/Locale/en-US/_strings/commands/eye-commands.ftl
#	Resources/Locale/en-US/_strings/commands/follow-command.ftl
#	Resources/Locale/en-US/_strings/commands/force-map-command.ftl
#	Resources/Locale/en-US/_strings/commands/force-preset-command.ftl
#	Resources/Locale/en-US/_strings/commands/ghost-kick-command.ftl
#	Resources/Locale/en-US/_strings/commands/ghost-visibility-commands.ftl
#	Resources/Locale/en-US/_strings/commands/go-lobby-command.ftl
#	Resources/Locale/en-US/_strings/commands/grid-drag-command.ftl
#	Resources/Locale/en-US/_strings/commands/is-afk-command.ftl
#	Resources/Locale/en-US/_strings/commands/makesentient-command.ftl
#	Resources/Locale/en-US/_strings/commands/map-commands.ftl
#	Resources/Locale/en-US/_strings/commands/mapping-client-side-setup-command.ftl
#	Resources/Locale/en-US/_strings/commands/mappingclientsidesetup-command.ftl
#	Resources/Locale/en-US/_strings/commands/me-command.ftl
#	Resources/Locale/en-US/_strings/commands/mind-info-command.ftl
#	Resources/Locale/en-US/_strings/commands/node-vis-commands.ftl
#	Resources/Locale/en-US/_strings/commands/npc-command.ftl
#	Resources/Locale/en-US/_strings/commands/nukecodes-command.ftl
#	Resources/Locale/en-US/_strings/commands/ooc-command.ftl
#	Resources/Locale/en-US/_strings/commands/pardon-command.ftl
#	Resources/Locale/en-US/_strings/commands/powerstat-command.ftl
#	Resources/Locale/en-US/_strings/commands/promote-host-command.ftl
#	Resources/Locale/en-US/_strings/commands/radiation-command.ftl
#	Resources/Locale/en-US/_strings/commands/readmin-command.ftl
#	Resources/Locale/en-US/_strings/commands/remove-extra-components-command.ftl
#	Resources/Locale/en-US/_strings/commands/role-commands.ftl
#	Resources/Locale/en-US/_strings/commands/say-command.ftl
#	Resources/Locale/en-US/_strings/commands/set-battery-percent-command.ftl
#	Resources/Locale/en-US/_strings/commands/show-ambient-command.ftl
#	Resources/Locale/en-US/_strings/commands/show-gun-spread-command.ftl
#	Resources/Locale/en-US/_strings/commands/show-htn-command.ftl
#	Resources/Locale/en-US/_strings/commands/showrules-command.ftl
#	Resources/Locale/en-US/_strings/commands/spawn-entity-list-command.ftl
#	Resources/Locale/en-US/_strings/commands/start-singularity-command.ftl
#	Resources/Locale/en-US/_strings/commands/tile-pry-command.ftl
#	Resources/Locale/en-US/_strings/commands/toggle-decals-command.ftl
#	Resources/Locale/en-US/_strings/commands/toggle-disallow-late-join-command.ftl
#	Resources/Locale/en-US/_strings/commands/unlocknode-command.ftl
#	Resources/Locale/en-US/_strings/commands/whisper-command.ftl
#	Resources/Locale/en-US/_strings/components/gas-pressure-regulator-component.ftl
#	Resources/Locale/en-US/_strings/engineer-painter/engineer-painter.ftl
#	Resources/Locale/en-US/_strings/game-ticking/forcemap-command.ftl
#	Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl
#	Resources/Locale/en-US/_strings/markings/vox_tattoos.ftl
#	Resources/Locale/en-US/_strings/materials/material-extractor.ftl
#	Resources/Locale/en-US/_strings/movement/eye.ftl
#	Resources/Locale/en-US/_strings/nutrition/components/food-component.ftl
#	Resources/Locale/en-US/_strings/nutrition/components/ingestion-system.ftl
#	Resources/Locale/en-US/_strings/nutrition/components/sealable-component.ftl
#	Resources/Locale/en-US/_strings/radiation/radiation-command.ftl
#	Resources/Locale/en-US/_strings/reagents/meta/physical-desc.ftl
#	Resources/Locale/en-US/_strings/research/technologies.ftl
#	Resources/Locale/en-US/_strings/seeds/seeds.ftl
#	Resources/Locale/en-US/_strings/weapons/grenades/timer-trigger.ftl
#	Resources/Locale/en-US/_strings/weapons/grenades/voice-trigger.ftl
#	Resources/Locale/en-US/commands/mapping-client-side-setup-command.ftl
#	Resources/Locale/en-US/recipes/tags.ftl
#	Resources/Maps/_Sunrise/Station/bagel.yml
#	Resources/Maps/_Sunrise/Station/barratry.yml
#	Resources/Maps/_Sunrise/Station/box.yml
#	Resources/Maps/_Sunrise/Station/fland.yml
#	Resources/Maps/_Sunrise/Station/marathon.yml
#	Resources/Maps/_Sunrise/Station/oasis.yml
#	Resources/Maps/_Sunrise/Station/packed.yml
#	Resources/Maps/_Sunrise/Station/plasma.yml
#	Resources/Maps/amber.yml
#	Resources/Maps/centcomm.yml
#	Resources/Prototypes/Catalog/Fills/Backpacks/duffelbag.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/security.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/service.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/suit_storage.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/coffee.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/sustenance.yml
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/winterdrobe.yml
#	Resources/Prototypes/Entities/Clothing/Belt/belts.yml
#	Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml
#	Resources/Prototypes/Entities/Clothing/Eyes/hud.yml
#	Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
#	Resources/Prototypes/Entities/Clothing/Head/hats.yml
#	Resources/Prototypes/Entities/Clothing/Head/helmets.yml
#	Resources/Prototypes/Entities/Clothing/Head/hoods.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/pets.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
#	Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
#	Resources/Prototypes/Entities/Mobs/Player/clone.yml
#	Resources/Prototypes/Entities/Mobs/Species/base.yml
#	Resources/Prototypes/Entities/Mobs/Species/dwarf.yml
#	Resources/Prototypes/Entities/Mobs/base.yml
#	Resources/Prototypes/Entities/Objects/Fun/pai.yml
#	Resources/Prototypes/Entities/Objects/Fun/toys.yml
#	Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml
#	Resources/Prototypes/Entities/Objects/Shields/shields.yml
#	Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml
#	Resources/Prototypes/Entities/Objects/Specific/Medical/hypospray.yml
#	Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml
#	Resources/Prototypes/Entities/Objects/Tools/matches.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Bombs/spider.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/caseless_rifle.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/light_rifle.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/magnum.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/grenade.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml
#	Resources/Prototypes/Entities/Structures/Doors/Airlocks/airlocks.yml
#	Resources/Prototypes/Entities/Structures/Doors/airlock_groups.yml
#	Resources/Prototypes/Entities/Structures/Furniture/beds.yml
#	Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml
#	Resources/Prototypes/Entities/Structures/Power/debug_power.yml
#	Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml
#	Resources/Prototypes/Entities/Structures/Wallmounts/Misc/mirror.yml
#	Resources/Prototypes/GameRules/subgamemodes.yml
#	Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml
#	Resources/Prototypes/Reagents/Consumable/Drink/soda.yml
#	Resources/Prototypes/Reagents/medicine.yml
#	Resources/Prototypes/Recipes/Lathes/Packs/tiles.yml
#	Resources/Prototypes/Recipes/Lathes/categories.yml
#	Resources/Prototypes/Recipes/Reactions/chemicals.yml
#	Resources/Prototypes/Roles/Antags/changeling.yml
#	Resources/Prototypes/name_identifier_groups.yml
#	Resources/Prototypes/tool_qualities.yml
#	Resources/ServerInfo/Guidebook/Antagonist/Zombies.xml
#	Resources/ServerInfo/Guidebook/Cargo/CargoBounties.xml
#	Resources/ServerInfo/Guidebook/Command.xml
#	Resources/ServerInfo/Guidebook/Glossary.xml
#	Resources/ServerInfo/Guidebook/NewPlayer/YourFirstCharacter.xml
#	Resources/ServerInfo/Guidebook/Science/Robotics.xml
#	Resources/ServerInfo/Guidebook/Science/ScannersAndVessels.xml
#	Resources/ServerInfo/Guidebook/Science/Science.xml
#	Resources/ServerInfo/Guidebook/SpaceStation14.xml
#	Resources/ServerInfo/Guidebook/Survival.xml
#	Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/capspace.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/cybersun.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/engineering-white.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/engineering-white.rsi/on-equipped-HELMET.png
#	Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/icon.png
#	Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/on-equipped-HELMET.png
#	Resources/Textures/Clothing/Head/Hardsuits/medical.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/rd.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/salvage.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/security.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/spatiohelm.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/syndicate.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/syndiecommander.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/syndieelite.rsi/meta.json
#	Resources/Textures/Clothing/Head/Hardsuits/wizard.rsi/meta.json
#	Resources/Textures/Clothing/Head/Helmets/atmos_firehelmet.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Armor/captain_carapace.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Armor/security.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/atmospherics.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/capspace.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/cybersun.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/engineering-white.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/engineering.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/medical.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/paramed.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/rd.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/salvage.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/security.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/spatio.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/syndicate.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/syndiecommander.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/syndieelite.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Hardsuits/wizard.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Suits/atmos_firesuit.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/Suits/eva.rsi/meta.json
#	Resources/Textures/Interface/Misc/job_icons.rsi/meta.json
#	Resources/Textures/Objects/Misc/Lights/lampgreen.rsi/meta.json
#	Resources/Textures/Objects/Specific/Janitorial/janitorial_cart.rsi/meta.json
#	Resources/Textures/Objects/Tools/spray_painter.rsi/meta.json
#	Resources/Textures/Objects/Weapons/Melee/baseball_bat.rsi/meta.json
#	Resources/engineCommandPerms.yml
#	Resources/keybinds.yml
#	Resources/migration.yml
2025-08-10 01:49:23 +03:00

886 lines
28 KiB
C#

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.Body.Components;
using Content.Shared.Body.Events;
using Content.Shared.Body.Organ;
using Content.Shared.Body.Part;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Movement.Components;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Physics;
using Robust.Shared.Utility;
namespace Content.Shared.Body.Systems;
public partial class SharedBodySystem
{
private static readonly ProtoId<DamageTypePrototype> BloodlossDamageType = "Bloodloss";
private void InitializeParts()
{
// TODO: This doesn't handle comp removal on child ents.
// If you modify this also see the Body partial for root parts.
SubscribeLocalEvent<BodyPartComponent, EntInsertedIntoContainerMessage>(OnBodyPartInserted);
SubscribeLocalEvent<BodyPartComponent, EntRemovedFromContainerMessage>(OnBodyPartRemoved);
}
private void OnBodyPartInserted(Entity<BodyPartComponent> ent, ref EntInsertedIntoContainerMessage args)
{
// Body part inserted into another body part.
var insertedUid = args.Entity;
var slotId = args.Container.ID;
if (ent.Comp.Body is null)
return;
if (TryComp(insertedUid, out BodyPartComponent? part))
{
AddPart(ent.Comp.Body.Value, (insertedUid, part), slotId);
RecursiveBodyUpdate((insertedUid, part), ent.Comp.Body.Value);
}
if (TryComp(insertedUid, out OrganComponent? organ))
AddOrgan((insertedUid, organ), ent.Comp.Body.Value, ent);
}
private void OnBodyPartRemoved(Entity<BodyPartComponent> ent, ref EntRemovedFromContainerMessage args)
{
// Body part removed from another body part.
var removedUid = args.Entity;
var slotId = args.Container.ID;
DebugTools.Assert(!TryComp(removedUid, out BodyPartComponent? b) || b.Body == ent.Comp.Body);
DebugTools.Assert(!TryComp(removedUid, out OrganComponent? o) || o.Body == ent.Comp.Body);
if (TryComp(removedUid, out BodyPartComponent? part) && part.Body is not null)
{
RemovePart(part.Body.Value, (removedUid, part), slotId);
RecursiveBodyUpdate((removedUid, part), null);
}
if (TryComp(removedUid, out OrganComponent? organ))
RemoveOrgan((removedUid, organ), ent);
}
private void RecursiveBodyUpdate(Entity<BodyPartComponent> ent, EntityUid? bodyUid)
{
ent.Comp.Body = bodyUid;
Dirty(ent, ent.Comp);
foreach (var slotId in ent.Comp.Organs.Keys)
{
if (!Containers.TryGetContainer(ent, GetOrganContainerId(slotId), out var container))
continue;
foreach (var organ in container.ContainedEntities)
{
if (!TryComp(organ, out OrganComponent? organComp))
continue;
Dirty(organ, organComp);
if (organComp.Body is { Valid: true } oldBodyUid)
{
var removedEv = new OrganRemovedFromBodyEvent(oldBodyUid, ent);
RaiseLocalEvent(organ, ref removedEv);
}
organComp.Body = bodyUid;
if (bodyUid is not null)
{
var addedEv = new OrganAddedToBodyEvent(bodyUid.Value, ent);
RaiseLocalEvent(organ, ref addedEv);
}
}
}
foreach (var slotId in ent.Comp.Children.Keys)
{
if (!Containers.TryGetContainer(ent, GetPartSlotContainerId(slotId), out var container))
continue;
foreach (var containedUid in container.ContainedEntities)
{
if (TryComp(containedUid, out BodyPartComponent? childPart))
RecursiveBodyUpdate((containedUid, childPart), bodyUid);
}
}
}
protected virtual void AddPart(
Entity<BodyComponent?> bodyEnt,
Entity<BodyPartComponent> partEnt,
string slotId)
{
Dirty(partEnt, partEnt.Comp);
partEnt.Comp.Body = bodyEnt;
var ev = new BodyPartAddedEvent(slotId, partEnt);
RaiseLocalEvent(bodyEnt, ref ev);
AddLeg(partEnt, bodyEnt);
}
protected virtual void RemovePart(
Entity<BodyComponent?> bodyEnt,
Entity<BodyPartComponent> partEnt,
string slotId)
{
Resolve(bodyEnt, ref bodyEnt.Comp, logMissing: false);
Dirty(partEnt, partEnt.Comp);
partEnt.Comp.Body = null;
var ev = new BodyPartRemovedEvent(slotId, partEnt);
RaiseLocalEvent(bodyEnt, ref ev);
RemoveLeg(partEnt, bodyEnt);
PartRemoveDamage(bodyEnt, partEnt);
}
private void AddLeg(Entity<BodyPartComponent> legEnt, Entity<BodyComponent?> bodyEnt)
{
if (!Resolve(bodyEnt, ref bodyEnt.Comp, logMissing: false))
return;
if (legEnt.Comp.PartType == BodyPartType.Leg)
{
bodyEnt.Comp.LegEntities.Add(legEnt);
UpdateMovementSpeed(bodyEnt);
Dirty(bodyEnt, bodyEnt.Comp);
}
}
private void RemoveLeg(Entity<BodyPartComponent> legEnt, Entity<BodyComponent?> bodyEnt)
{
if (!Resolve(bodyEnt, ref bodyEnt.Comp, logMissing: false))
return;
if (legEnt.Comp.PartType == BodyPartType.Leg)
{
bodyEnt.Comp.LegEntities.Remove(legEnt);
UpdateMovementSpeed(bodyEnt);
Dirty(bodyEnt, bodyEnt.Comp);
if (!bodyEnt.Comp.LegEntities.Any())
{
Standing.Down(bodyEnt);
}
}
}
private void PartRemoveDamage(Entity<BodyComponent?> bodyEnt, Entity<BodyPartComponent> partEnt)
{
if (!Resolve(bodyEnt, ref bodyEnt.Comp, logMissing: false))
return;
if (!_timing.ApplyingState
&& partEnt.Comp.IsVital
&& !GetBodyChildrenOfType(bodyEnt, partEnt.Comp.PartType, bodyEnt.Comp).Any()
)
{
// TODO BODY SYSTEM KILL : remove this when wounding and required parts are implemented properly
var damage = new DamageSpecifier(Prototypes.Index(BloodlossDamageType), 300);
Damageable.TryChangeDamage(bodyEnt, damage);
}
}
/// <summary>
/// Tries to get the parent body part to this if applicable.
/// Doesn't validate if it's a part of body system.
/// </summary>
public EntityUid? GetParentPartOrNull(EntityUid uid)
{
if (!Containers.TryGetContainingContainer((uid, null, null), out var container))
return null;
var parent = container.Owner;
if (!HasComp<BodyPartComponent>(parent))
return null;
return parent;
}
/// <summary>
/// Tries to get the parent body part and slot to this if applicable.
/// </summary>
public (EntityUid Parent, string Slot)? GetParentPartAndSlotOrNull(EntityUid uid)
{
if (!Containers.TryGetContainingContainer((uid, null, null), out var container))
return null;
var slotId = GetPartSlotContainerIdFromContainer(container.ID);
if (string.IsNullOrEmpty(slotId))
return null;
var parent = container.Owner;
if (!TryComp<BodyPartComponent>(parent, out var parentBody)
|| !parentBody.Children.ContainsKey(slotId))
return null;
return (parent, slotId);
}
/// <summary>
/// Tries to get the relevant parent body part to this if it exists.
/// It won't exist if this is the root body part or if it's not in a body.
/// </summary>
public bool TryGetParentBodyPart(
EntityUid partUid,
[NotNullWhen(true)] out EntityUid? parentUid,
[NotNullWhen(true)] out BodyPartComponent? parentComponent)
{
DebugTools.Assert(HasComp<BodyPartComponent>(partUid));
parentUid = null;
parentComponent = null;
if (Containers.TryGetContainingContainer((partUid, null, null), out var container) &&
TryComp(container.Owner, out parentComponent))
{
parentUid = container.Owner;
return true;
}
return false;
}
#region Slots
/// <summary>
/// Creates a BodyPartSlot on the specified partUid.
/// </summary>
private BodyPartSlot? CreatePartSlot(
EntityUid partUid,
string slotId,
BodyPartType partType,
BodyPartComponent? part = null)
{
if (!Resolve(partUid, ref part, logMissing: false))
return null;
Containers.EnsureContainer<ContainerSlot>(partUid, GetPartSlotContainerId(slotId));
var partSlot = new BodyPartSlot(slotId, partType);
part.Children.Add(slotId, partSlot);
Dirty(partUid, part);
return partSlot;
}
/// <summary>
/// Tries to create a BodyPartSlot on the specified partUid.
/// </summary>
/// <returns>false if not relevant or can't add it.</returns>
public bool TryCreatePartSlot(
EntityUid? partId,
string slotId,
BodyPartType partType,
[NotNullWhen(true)] out BodyPartSlot? slot,
BodyPartComponent? part = null)
{
slot = null;
if (partId is null
|| !Resolve(partId.Value, ref part, logMissing: false))
{
return false;
}
Containers.EnsureContainer<ContainerSlot>(partId.Value, GetPartSlotContainerId(slotId));
slot = new BodyPartSlot(slotId, partType);
if (!part.Children.TryAdd(slotId, slot.Value))
return false;
Dirty(partId.Value, part);
return true;
}
public bool TryCreatePartSlotAndAttach(
EntityUid parentId,
string slotId,
EntityUid childId,
BodyPartType partType,
BodyPartComponent? parent = null,
BodyPartComponent? child = null)
{
return TryCreatePartSlot(parentId, slotId, partType, out _, parent)
&& AttachPart(parentId, slotId, childId, parent, child);
}
#endregion
#region RootPartManagement
/// <summary>
/// Returns true if the partId is the root body container for the specified bodyId.
/// </summary>
public bool IsPartRoot(
EntityUid bodyId,
EntityUid partId,
BodyComponent? body = null,
BodyPartComponent? part = null)
{
return Resolve(partId, ref part)
&& Resolve(bodyId, ref body)
&& Containers.TryGetContainingContainer(bodyId, partId, out var container)
&& container.ID == BodyRootContainerId;
}
/// <summary>
/// Returns true if we can attach the partId to the bodyId as the root entity.
/// </summary>
public bool CanAttachToRoot(
EntityUid bodyId,
EntityUid partId,
BodyComponent? body = null,
BodyPartComponent? part = null)
{
return Resolve(bodyId, ref body)
&& Resolve(partId, ref part)
&& body.RootContainer.ContainedEntity is null
&& bodyId != part.Body;
}
/// <summary>
/// Returns the root part of this body if it exists.
/// </summary>
public (EntityUid Entity, BodyPartComponent BodyPart)? GetRootPartOrNull(EntityUid bodyId, BodyComponent? body = null)
{
if (!Resolve(bodyId, ref body)
|| body.RootContainer.ContainedEntity is null)
{
return null;
}
return (body.RootContainer.ContainedEntity.Value,
Comp<BodyPartComponent>(body.RootContainer.ContainedEntity.Value));
}
/// <summary>
/// Returns true if the partId can be attached to the parentId in the specified slot.
/// </summary>
public bool CanAttachPart(
EntityUid parentId,
BodyPartSlot slot,
EntityUid partId,
BodyPartComponent? parentPart = null,
BodyPartComponent? part = null)
{
return Resolve(partId, ref part, logMissing: false)
&& Resolve(parentId, ref parentPart, logMissing: false)
&& CanAttachPart(parentId, slot.Id, partId, parentPart, part);
}
/// <summary>
/// Returns true if we can attach the specified partId to the parentId in the specified slot.
/// </summary>
public bool CanAttachPart(
EntityUid parentId,
string slotId,
EntityUid partId,
BodyPartComponent? parentPart = null,
BodyPartComponent? part = null)
{
return Resolve(partId, ref part, logMissing: false)
&& Resolve(parentId, ref parentPart, logMissing: false)
&& parentPart.Children.TryGetValue(slotId, out var parentSlotData)
&& part.PartType == parentSlotData.Type
&& Containers.TryGetContainer(parentId, GetPartSlotContainerId(slotId), out var container)
&& Containers.CanInsert(partId, container);
}
public bool AttachPartToRoot(
EntityUid bodyId,
EntityUid partId,
BodyComponent? body = null,
BodyPartComponent? part = null)
{
return Resolve(bodyId, ref body)
&& Resolve(partId, ref part)
&& CanAttachToRoot(bodyId, partId, body, part)
&& Containers.Insert(partId, body.RootContainer);
}
#endregion
#region Attach/Detach
/// <summary>
/// Attaches a body part to the specified body part parent.
/// </summary>
public bool AttachPart(
EntityUid parentPartId,
string slotId,
EntityUid partId,
BodyPartComponent? parentPart = null,
BodyPartComponent? part = null)
{
return Resolve(parentPartId, ref parentPart, logMissing: false)
&& parentPart.Children.TryGetValue(slotId, out var slot)
&& AttachPart(parentPartId, slot, partId, parentPart, part);
}
/// <summary>
/// Attaches a body part to the specified body part parent.
/// </summary>
public bool AttachPart(
EntityUid parentPartId,
BodyPartSlot slot,
EntityUid partId,
BodyPartComponent? parentPart = null,
BodyPartComponent? part = null)
{
if (!Resolve(parentPartId, ref parentPart, logMissing: false)
|| !Resolve(partId, ref part, logMissing: false)
|| !CanAttachPart(parentPartId, slot.Id, partId, parentPart, part)
|| !parentPart.Children.ContainsKey(slot.Id))
{
return false;
}
if (!Containers.TryGetContainer(parentPartId, GetPartSlotContainerId(slot.Id), out var container))
{
DebugTools.Assert($"Unable to find body slot {slot.Id} for {ToPrettyString(parentPartId)}");
return false;
}
return Containers.Insert(partId, container);
}
#endregion
#region Misc
public void UpdateMovementSpeed(
EntityUid bodyId,
BodyComponent? body = null,
MovementSpeedModifierComponent? movement = null)
{
if (!Resolve(bodyId, ref body, ref movement, logMissing: false)
|| body.RequiredLegs <= 0)
{
return;
}
var walkSpeed = 0f;
var sprintSpeed = 0f;
var acceleration = 0f;
var maxDensity = 0f; // 🌟Starlight🌟
foreach (var legEntity in body.LegEntities)
{
if (!TryComp<MovementBodyPartComponent>(legEntity, out var legModifier))
continue;
walkSpeed += legModifier.WalkSpeed;
sprintSpeed += legModifier.SprintSpeed;
acceleration += legModifier.Acceleration;
maxDensity += legModifier.MaxDensity; // 🌟Starlight🌟
}
// 🌟Starlight🌟 Start
var density = TryComp<FixturesComponent>(bodyId, out var fixtures)
&& fixtures.Fixtures.TryGetValue("fix1", out var fixture)
? fixture.Density : 185f;
var speedFactor = density > maxDensity && maxDensity > 0f
? maxDensity / density
: 1f;
walkSpeed *= speedFactor;
sprintSpeed *= speedFactor;
acceleration *= speedFactor;
// 🌟Starlight🌟 End
walkSpeed /= body.RequiredLegs;
sprintSpeed /= body.RequiredLegs;
acceleration /= body.RequiredLegs;
Movement.ChangeBaseSpeed(bodyId, walkSpeed, sprintSpeed, acceleration, movement);
}
#endregion
#region Queries
/// <summary>
/// Get all organs for the specified body part.
/// </summary>
public IEnumerable<(EntityUid Id, OrganComponent Component)> GetPartOrgans(EntityUid partId, BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
foreach (var slotId in part.Organs.Keys)
{
var containerSlotId = GetOrganContainerId(slotId);
if (!Containers.TryGetContainer(partId, containerSlotId, out var container))
continue;
foreach (var containedEnt in container.ContainedEntities)
{
if (!TryComp(containedEnt, out OrganComponent? organ))
continue;
yield return (containedEnt, organ);
}
}
}
/// <summary>
/// Gets all BaseContainers for body parts on this entity and its child entities.
/// </summary>
public IEnumerable<BaseContainer> GetPartContainers(EntityUid id, BodyPartComponent? part = null)
{
if (!Resolve(id, ref part, logMissing: false) ||
part.Children.Count == 0)
{
yield break;
}
foreach (var slotId in part.Children.Keys)
{
var containerSlotId = GetPartSlotContainerId(slotId);
if (!Containers.TryGetContainer(id, containerSlotId, out var container))
continue;
yield return container;
foreach (var ent in container.ContainedEntities)
{
foreach (var childContainer in GetPartContainers(ent))
{
yield return childContainer;
}
}
}
}
/// <summary>
/// Returns all body part components for this entity including itself.
/// </summary>
public IEnumerable<(EntityUid Id, BodyPartComponent Component)> GetBodyPartChildren(
EntityUid partId,
BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
yield return (partId, part);
foreach (var slotId in part.Children.Keys)
{
var containerSlotId = GetPartSlotContainerId(slotId);
if (Containers.TryGetContainer(partId, containerSlotId, out var container))
{
foreach (var containedEnt in container.ContainedEntities)
{
if (!TryComp(containedEnt, out BodyPartComponent? childPart))
continue;
foreach (var value in GetBodyPartChildren(containedEnt, childPart))
{
yield return value;
}
}
}
}
}
/// <summary>
/// Returns all body part slots for this entity.
/// </summary>
public IEnumerable<BodyPartSlot> GetAllBodyPartSlots(
EntityUid partId,
BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
foreach (var (slotId, slot) in part.Children)
{
yield return slot;
var containerSlotId = GetOrganContainerId(slotId);
if (Containers.TryGetContainer(partId, containerSlotId, out var container))
{
foreach (var containedEnt in container.ContainedEntities)
{
if (!TryComp(containedEnt, out BodyPartComponent? childPart))
continue;
foreach (var subSlot in GetAllBodyPartSlots(containedEnt, childPart))
{
yield return subSlot;
}
}
}
}
}
// Sunrise-Start
public IEnumerable<Entity<BodyPartComponent>> GetAllBodyPart(
EntityUid partId,
BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
foreach (var (slotId, slot) in part.Children)
{
var containerSlotId = GetPartSlotContainerId(slotId);
if (Containers.TryGetContainer(partId, containerSlotId, out var container))
{
foreach (var containedEnt in container.ContainedEntities)
{
if (!TryComp(containedEnt, out BodyPartComponent? childPart))
continue;
yield return (containedEnt, childPart);
foreach (var subPart in GetAllBodyPart(containedEnt, childPart))
{
yield return subPart;
}
}
}
}
}
// Sunrise-End
/// <summary>
/// Returns true if the bodyId has any parts of this type.
/// </summary>
public bool BodyHasPartType(
EntityUid bodyId,
BodyPartType type,
BodyComponent? body = null)
{
return GetBodyChildrenOfType(bodyId, type, body).Any();
}
/// <summary>
/// Returns true if the parentId has the specified childId.
/// </summary>
public bool PartHasChild(
EntityUid parentId,
EntityUid childId,
BodyPartComponent? parent,
BodyPartComponent? child)
{
if (!Resolve(parentId, ref parent, logMissing: false)
|| !Resolve(childId, ref child, logMissing: false))
{
return false;
}
foreach (var (foundId, _) in GetBodyPartChildren(parentId, parent))
{
if (foundId == childId)
return true;
}
return false;
}
/// <summary>
/// Returns true if the bodyId has the specified partId.
/// </summary>
public bool BodyHasChild(
EntityUid bodyId,
EntityUid partId,
BodyComponent? body = null,
BodyPartComponent? part = null)
{
return Resolve(bodyId, ref body, logMissing: false)
&& body.RootContainer.ContainedEntity is not null
&& Resolve(partId, ref part, logMissing: false)
&& TryComp(body.RootContainer.ContainedEntity, out BodyPartComponent? rootPart)
&& PartHasChild(body.RootContainer.ContainedEntity.Value, partId, rootPart, part);
}
public IEnumerable<(EntityUid Id, BodyPartComponent Component)> GetBodyChildrenOfType(
EntityUid bodyId,
BodyPartType type,
BodyComponent? body = null)
{
foreach (var part in GetBodyChildren(bodyId, body))
{
if (part.Component.PartType == type)
yield return part;
}
}
/// <summary>
/// Returns a list of ValueTuples of <see cref="T"/> and OrganComponent on each organ
/// in the given part.
/// </summary>
/// <param name="uid">The part entity id to check on.</param>
/// <param name="part">The part to check for organs on.</param>
/// <typeparam name="T">The component to check for.</typeparam>
public List<(T Comp, OrganComponent Organ)> GetBodyPartOrganComponents<T>(
EntityUid uid,
BodyPartComponent? part = null)
where T : IComponent
{
if (!Resolve(uid, ref part))
return new List<(T Comp, OrganComponent Organ)>();
var query = GetEntityQuery<T>();
var list = new List<(T Comp, OrganComponent Organ)>();
foreach (var organ in GetPartOrgans(uid, part))
{
if (query.TryGetComponent(organ.Id, out var comp))
list.Add((comp, organ.Component));
}
return list;
}
/// <summary>
/// Tries to get a list of ValueTuples of <see cref="T"/> and OrganComponent on each organs
/// in the given part.
/// </summary>
/// <param name="uid">The part entity id to check on.</param>
/// <param name="comps">The list of components.</param>
/// <param name="part">The part to check for organs on.</param>
/// <typeparam name="T">The component to check for.</typeparam>
/// <returns>Whether any were found.</returns>
public bool TryGetBodyPartOrganComponents<T>(
EntityUid uid,
[NotNullWhen(true)] out List<(T Comp, OrganComponent Organ)>? comps,
BodyPartComponent? part = null)
where T : IComponent
{
if (!Resolve(uid, ref part))
{
comps = null;
return false;
}
comps = GetBodyPartOrganComponents<T>(uid, part);
if (comps.Count != 0)
return true;
comps = null;
return false;
}
/// <summary>
/// Gets the parent body part and all immediate child body parts for the partId.
/// </summary>
public IEnumerable<EntityUid> GetBodyPartAdjacentParts(
EntityUid partId,
BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
if (TryGetParentBodyPart(partId, out var parentUid, out _))
yield return parentUid.Value;
foreach (var slotId in part.Children.Keys)
{
var container = Containers.GetContainer(partId, GetPartSlotContainerId(slotId));
foreach (var containedEnt in container.ContainedEntities)
{
yield return containedEnt;
}
}
}
public IEnumerable<(EntityUid AdjacentId, T Component)> GetBodyPartAdjacentPartsComponents<T>(
EntityUid partId,
BodyPartComponent? part = null)
where T : IComponent
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
var query = GetEntityQuery<T>();
foreach (var adjacentId in GetBodyPartAdjacentParts(partId, part))
{
if (query.TryGetComponent(adjacentId, out var component))
yield return (adjacentId, component);
}
}
public bool TryGetBodyPartAdjacentPartsComponents<T>(
EntityUid partId,
[NotNullWhen(true)] out List<(EntityUid AdjacentId, T Component)>? comps,
BodyPartComponent? part = null)
where T : IComponent
{
if (!Resolve(partId, ref part, logMissing: false))
{
comps = null;
return false;
}
var query = GetEntityQuery<T>();
comps = new List<(EntityUid AdjacentId, T Component)>();
foreach (var adjacentId in GetBodyPartAdjacentParts(partId, part))
{
if (query.TryGetComponent(adjacentId, out var component))
comps.Add((adjacentId, component));
}
if (comps.Count != 0)
return true;
comps = null;
return false;
}
public bool TryGetFreePartSlot(EntityUid partId, [NotNullWhen(true)] out string? freeSlotId, BodyPartComponent? part = null)
{
freeSlotId = null;
if (!Resolve(partId, ref part, logMissing: false))
return false;
foreach (var (slotId, slot) in part.Children)
{
var containerId = GetPartSlotContainerId(slotId);
if (!Containers.TryGetContainer(partId, containerId, out var container))
continue;
if (container.ContainedEntities.Count == 0)
{
freeSlotId = slotId;
return true;
}
}
return false;
}
public IEnumerable<string> TryGetFreePartSlots(EntityUid partId, BodyPartComponent? part = null)
{
if (!Resolve(partId, ref part, logMissing: false))
yield break;
foreach (var (slotId, slot) in part.Children)
{
var containerId = GetPartSlotContainerId(slotId);
if (!Containers.TryGetContainer(partId, containerId, out var container))
continue;
if (container.ContainedEntities.Count == 0)
{
yield return slotId;
}
}
}
#endregion
}