entity storage tweaks (#19182)
This commit is contained in:
@@ -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
|
||||
/// <summary>
|
||||
/// The charge rate of the charger, in watts
|
||||
/// </summary>
|
||||
|
||||
[DataField("chargeRate")]
|
||||
public float ChargeRate = 20.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The charge rate with no machine upgrades
|
||||
/// </summary>
|
||||
|
||||
[DataField("baseChargeRate")]
|
||||
public float BaseChargeRate = 20.0f;
|
||||
|
||||
@@ -37,7 +36,16 @@ namespace Content.Server.Power.Components
|
||||
[DataField("partRatingChargeRateModifier")]
|
||||
public float PartRatingChargeRateModifier = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The container ID that is holds the entities being charged.
|
||||
/// </summary>
|
||||
[DataField("slotId", required: true)]
|
||||
public string SlotId = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A whitelist for what entities can be charged by this Charger.
|
||||
/// </summary>
|
||||
[DataField("whitelist")]
|
||||
public EntityWhitelist? Whitelist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
|
||||
var targetIsMob = HasComp<BodyComponent>(toInsert);
|
||||
var storageIsItem = HasComp<ItemComponent>(container);
|
||||
var allowedToEat = HasComp<ItemComponent>(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@
|
||||
- type: Charger
|
||||
baseChargeRate: 30
|
||||
slotId: entity_storage
|
||||
whitelist:
|
||||
components:
|
||||
- BorgChassis
|
||||
- type: Construction
|
||||
containers:
|
||||
- machine_parts
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: EntityStorage
|
||||
capacity: 500
|
||||
- type: PlaceableSurface
|
||||
isPlaceable: false # defaults to closed.
|
||||
- type: Damageable
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
- type: EntityStorage
|
||||
capacity: 500
|
||||
capacity: 1
|
||||
airtight: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
|
||||
Reference in New Issue
Block a user