Class VendingMachineSystem
Namespace: Content.Server.VendingMachines
Assembly: Content.Server.dll
Syntax
public sealed class VendingMachineSystem : SharedVendingMachineSystem
Methods
| Improve this Doc View SourceAuthorizedVend(EntityUid, EntityUid, InventoryType, String, VendingMachineComponent)
Checks whether the user is authorized to use the vending machine, then ejects the provided item if true
Declaration
public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type, string itemId, VendingMachineComponent component)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
EntityUid | sender | Entity that is trying to use the vending machine |
InventoryType | type | The type of inventory the item is from |
System.String | itemId | The prototype ID of the item |
VendingMachineComponent | component |
Deny(EntityUid, VendingMachineComponent)
Declaration
public void Deny(EntityUid uid, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
VendingMachineComponent | vendComponent |
EjectRandom(EntityUid, Boolean, Boolean, VendingMachineComponent)
Ejects a random item from the available stock. Will do nothing if the vending machine is empty.
Declaration
public void EjectRandom(EntityUid uid, bool throwItem, bool forceEject = false, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.Boolean | throwItem | Whether to throw the item in a random direction after dispensing it. |
System.Boolean | forceEject | Whether to skip the regular ejection checks and immediately dispense the item without animation. |
VendingMachineComponent | vendComponent |
Initialize()
Declaration
public override void Initialize()
Overrides
| Improve this Doc View SourceIsAuthorized(EntityUid, EntityUid, VendingMachineComponent)
Checks if the user is authorized to use this vending machine
Declaration
public bool IsAuthorized(EntityUid uid, EntityUid sender, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
EntityUid | sender | Entity trying to use the vending machine |
VendingMachineComponent | vendComponent |
Returns
Type | Description |
---|---|
System.Boolean |
OnComponentInit(EntityUid, VendingMachineComponent, ComponentInit)
Declaration
protected override void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
VendingMachineComponent | component | |
ComponentInit | args |
SetShooting(EntityUid, Boolean, VendingMachineComponent)
Sets the CanShoot property of the vending machine.
Declaration
public void SetShooting(EntityUid uid, bool canShoot, VendingMachineComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.Boolean | canShoot | |
VendingMachineComponent | component |
TryEjectVendorItem(EntityUid, InventoryType, String, Boolean, VendingMachineComponent)
Tries to eject the provided item. Will do nothing if the vending machine is incapable of ejecting, already ejecting or the item doesn't exist in its inventory.
Declaration
public void TryEjectVendorItem(EntityUid uid, InventoryType type, string itemId, bool throwItem, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
InventoryType | type | The type of inventory the item is from |
System.String | itemId | The prototype ID of the item |
System.Boolean | throwItem | Whether the item should be thrown in a random direction after ejection |
VendingMachineComponent | vendComponent |
TryRestockInventory(EntityUid, VendingMachineComponent)
Declaration
public void TryRestockInventory(EntityUid uid, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
VendingMachineComponent | vendComponent |
TryUpdateVisualState(EntityUid, VendingMachineComponent)
Tries to update the visuals of the component based on its current state.
Declaration
public void TryUpdateVisualState(EntityUid uid, VendingMachineComponent vendComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
VendingMachineComponent | vendComponent |
Update(Single)
Declaration
public override void Update(float frameTime)
Parameters
Type | Name | Description |
---|---|---|
System.Single | frameTime |