diff --git a/Content.Server/Power/Components/ChargerComponent.cs b/Content.Server/Power/Components/ChargerComponent.cs index 569bc0f2f8..e93dcd3c1e 100644 --- a/Content.Server/Power/Components/ChargerComponent.cs +++ b/Content.Server/Power/Components/ChargerComponent.cs @@ -1,5 +1,6 @@ using Content.Shared.Construction.Prototypes; using Content.Shared.Power; +using Content.Shared.Whitelist; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Power.Components @@ -13,14 +14,12 @@ namespace Content.Server.Power.Components /// /// The charge rate of the charger, in watts /// - [DataField("chargeRate")] public float ChargeRate = 20.0f; /// /// The charge rate with no machine upgrades /// - [DataField("baseChargeRate")] public float BaseChargeRate = 20.0f; @@ -37,7 +36,16 @@ namespace Content.Server.Power.Components [DataField("partRatingChargeRateModifier")] public float PartRatingChargeRateModifier = 1.5f; + /// + /// The container ID that is holds the entities being charged. + /// [DataField("slotId", required: true)] public string SlotId = string.Empty; + + /// + /// A whitelist for what entities can be charged by this Charger. + /// + [DataField("whitelist")] + public EntityWhitelist? Whitelist; } } diff --git a/Content.Server/Power/EntitySystems/ChargerSystem.cs b/Content.Server/Power/EntitySystems/ChargerSystem.cs index f3a4d6c68f..4c343a4a2c 100644 --- a/Content.Server/Power/EntitySystems/ChargerSystem.cs +++ b/Content.Server/Power/EntitySystems/ChargerSystem.cs @@ -210,6 +210,9 @@ internal sealed class ChargerSystem : EntitySystem if (!receiverComponent.Powered) return; + if (component.Whitelist?.IsValid(targetEntity, EntityManager) == false) + return; + if (!SearchForBattery(targetEntity, out var heldBattery)) return; diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index 51da54bc2b..ac57ced2bd 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -395,7 +395,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem var targetIsMob = HasComp(toInsert); var storageIsItem = HasComp(container); - var allowedToEat = HasComp(toInsert); + var allowedToEat = whitelist?.IsValid(toInsert) ?? storageIsItem; // BEFORE REPLACING THIS WITH, I.E. A PROPERTY: // Make absolutely 100% sure you have worked out how to stop people ending up in backpacks. @@ -414,9 +414,6 @@ public abstract class SharedEntityStorageSystem : EntitySystem } } - if (allowedToEat && whitelist != null) - allowedToEat = whitelist.IsValid(toInsert); - return allowedToEat; } diff --git a/Resources/Prototypes/Entities/Structures/Power/chargers.yml b/Resources/Prototypes/Entities/Structures/Power/chargers.yml index 5fe1b40bd2..8955aea240 100644 --- a/Resources/Prototypes/Entities/Structures/Power/chargers.yml +++ b/Resources/Prototypes/Entities/Structures/Power/chargers.yml @@ -200,6 +200,9 @@ - type: Charger baseChargeRate: 30 slotId: entity_storage + whitelist: + components: + - BorgChassis - type: Construction containers: - machine_parts diff --git a/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml b/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml index 089d6a2975..44800a3e22 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml @@ -35,7 +35,6 @@ layer: - MachineLayer - type: EntityStorage - capacity: 500 - type: PlaceableSurface isPlaceable: false # defaults to closed. - type: Damageable diff --git a/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml b/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml index 1f40fa15a6..a576c1c9da 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml @@ -338,7 +338,7 @@ - type: Physics bodyType: Dynamic - type: EntityStorage - capacity: 500 + capacity: 1 airtight: false - type: Fixtures fixtures: