more component ref removal + combining server/client comps (#13178)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using static Content.Shared.VendingMachines.SharedVendingMachineComponent;
|
||||
|
||||
namespace Content.Shared.VendingMachines;
|
||||
|
||||
@@ -11,10 +10,10 @@ public abstract class SharedVendingMachineSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SharedVendingMachineComponent, ComponentInit>(OnComponentInit);;
|
||||
SubscribeLocalEvent<VendingMachineComponent, ComponentInit>(OnComponentInit);
|
||||
}
|
||||
|
||||
protected virtual void OnComponentInit(EntityUid uid, SharedVendingMachineComponent component, ComponentInit args)
|
||||
protected virtual void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(component.PackPrototypeId, out VendingMachineInventoryPrototype? packPrototype))
|
||||
return;
|
||||
@@ -26,13 +25,13 @@ public abstract class SharedVendingMachineSystem : EntitySystem
|
||||
|
||||
/// <summary>
|
||||
/// Returns all of the vending machine's inventory. Only includes emagged and contraband inventories if
|
||||
/// <see cref="SharedVendingMachineComponent.Emagged"/> and <see cref="SharedVendingMachineComponent.Contraband"/>
|
||||
/// <see cref="VendingMachineComponent.Emagged"/> and <see cref="VendingMachineComponent.Contraband"/>
|
||||
/// are <c>true</c> respectively.
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <returns></returns>
|
||||
public List<VendingMachineInventoryEntry> GetAllInventory(EntityUid uid, SharedVendingMachineComponent? component = null)
|
||||
public List<VendingMachineInventoryEntry> GetAllInventory(EntityUid uid, VendingMachineComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return new();
|
||||
@@ -48,7 +47,7 @@ public abstract class SharedVendingMachineSystem : EntitySystem
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid, SharedVendingMachineComponent? component = null)
|
||||
public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid, VendingMachineComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return new();
|
||||
@@ -58,7 +57,7 @@ public abstract class SharedVendingMachineSystem : EntitySystem
|
||||
|
||||
private void AddInventoryFromPrototype(EntityUid uid, Dictionary<string, uint>? entries,
|
||||
InventoryType type,
|
||||
SharedVendingMachineComponent? component = null)
|
||||
VendingMachineComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component) || entries == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user