Make chemistry machines and IdCardConsole use item slots (#5428)
* chemistry item slots * item slots id card console
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
@@ -15,6 +15,9 @@ namespace Content.Shared.Chemistry.Components
|
||||
/// </summary>
|
||||
public class SharedChemMasterComponent : Component
|
||||
{
|
||||
[DataField("beakerSlot")]
|
||||
public ItemSlot BeakerSlot = new();
|
||||
|
||||
public override string Name => "ChemMaster";
|
||||
public const string SolutionName = "buffer";
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Shared.Chemistry.Dispenser
|
||||
{
|
||||
@@ -17,6 +19,9 @@ namespace Content.Shared.Chemistry.Dispenser
|
||||
{
|
||||
public override string Name => "ReagentDispenser";
|
||||
|
||||
[DataField("beakerSlot")]
|
||||
public ItemSlot BeakerSlot = new();
|
||||
|
||||
/// <summary>
|
||||
/// A list of reagents which this may dispense. Defined in yaml prototype, see <see cref="ReagentDispenserInventoryPrototype"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
|
||||
namespace Content.Shared.Chemistry.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedChemMasterSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedChemMasterComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<SharedChemMasterComponent, ComponentRemove>(OnComponentRemove);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, SharedChemMasterComponent component, ComponentInit args)
|
||||
{
|
||||
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-beaker", component.BeakerSlot);
|
||||
}
|
||||
|
||||
private void OnComponentRemove(EntityUid uid, SharedChemMasterComponent component, ComponentRemove args)
|
||||
{
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, component.BeakerSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Chemistry.Dispenser;
|
||||
|
||||
namespace Content.Shared.Chemistry.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedReagentDispenserSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedReagentDispenserComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<SharedReagentDispenserComponent, ComponentRemove>(OnComponentRemove);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, SharedReagentDispenserComponent component, ComponentInit args)
|
||||
{
|
||||
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-beaker", component.BeakerSlot);
|
||||
}
|
||||
|
||||
private void OnComponentRemove(EntityUid uid, SharedReagentDispenserComponent component, ComponentRemove args)
|
||||
{
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, component.BeakerSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user