Fix item slots spawning entities on startup instead of map init (#5501)

* spawn item slot entities on map init not startup

* prevent locked state form destroying inheritance on save

* fix whitelist for booze dispenser
This commit is contained in:
Leon Friedrich
2021-11-25 05:29:49 +13:00
committed by GitHub
parent 20baa5a2b9
commit 3cf05535bd
4 changed files with 9 additions and 9 deletions

View File

@@ -101,7 +101,7 @@ namespace Content.Shared.Containers.ItemSlots
/// This doesn't have to mean the slot is somehow physically locked. In the case of the item cabinet, the
/// cabinet may simply be closed at the moment and needs to be opened first.
/// </remarks>
[DataField("locked")]
[DataField("locked", readOnly: true)]
[ViewVariables(VVAccess.ReadWrite)]
public bool Locked = false;

View File

@@ -12,7 +12,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -30,7 +29,7 @@ namespace Content.Shared.Containers.ItemSlots
{
base.Initialize();
SubscribeLocalEvent<ItemSlotsComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ItemSlotsComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ItemSlotsComponent, ComponentInit>(Oninitialize);
SubscribeLocalEvent<ItemSlotsComponent, InteractUsingEvent>(OnInteractUsing);
@@ -50,7 +49,7 @@ namespace Content.Shared.Containers.ItemSlots
/// <summary>
/// Spawn in starting items for any item slots that should have one.
/// </summary>
private void OnStartup(EntityUid uid, ItemSlotsComponent itemSlots, ComponentStartup args)
private void OnMapInit(EntityUid uid, ItemSlotsComponent itemSlots, MapInitEvent args)
{
foreach (var slot in itemSlots.Slots.Values)
{

View File

@@ -45,3 +45,9 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
- type: ReagentDispenser
beakerSlot:
whitelistFailPopup: reagent-dispenser-component-cannot-put-entity-message
whitelist:
components:
- FitsInDispenser

View File

@@ -9,11 +9,6 @@
state: industrial-working
- type: ReagentDispenser
pack: ChemDispenserStandardInventory
beakerSlot:
whitelistFailPopup: reagent-dispenser-component-cannot-put-entity-message
whitelist:
components:
- FitsInDispenser
- type: ApcPowerReceiver
- type: ExtensionCableReceiver
- type: Construction