Upload from upload_mods.ps1
This commit is contained in:
21
Scripts/MinEventActions/MinEventActionAddItemToInventory.cs
Normal file
21
Scripts/MinEventActions/MinEventActionAddItemToInventory.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
public class MinEventActionAddItemToInventory : MinEventActionItemAccessBase
|
||||
{
|
||||
private ItemStack itemStackCache = new ItemStack();
|
||||
|
||||
public override bool CanExecute(MinEventTypes _eventType, MinEventParams _params)
|
||||
{
|
||||
if (itemValueCache == null)
|
||||
{
|
||||
itemValueCache = ItemClass.GetItem(itemName);
|
||||
itemStackCache.itemValue = itemValueCache;
|
||||
}
|
||||
return !_params.Self.isEntityRemote && base.CanExecute(_eventType, _params);
|
||||
}
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
itemStackCache.count = GetCount(_params);
|
||||
_params.Self.TryStackItem(itemStackCache);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user