EquipAction.BeforeAdd
Declaration#
public virtual void BeforeAdd(ItemContainer container, Boolean& cancelAdd)Parameters#
| Name | Description |
|---|---|
| container | Container requesting the add |
| cancelAdd | Forbid adding indicator |
Description#
Method run before item is added to inventory
Usage#
namespace NullSave.GDTK.Inventory{ public class ExampleAction : ItemPlugin {
public override bool isAction => true;
public override string title => "(Action) Example";
public override string description => "Example action for BeforeAdd";
public int itemLimit = 20;
// In some cases you may wish to prevent an item from being added // This override on plugins allows you to do so. public override void BeforeAdd(ItemContainer container, ref bool cancelAdd) { cancelAdd = container.items.Count >= itemLimit; }
}}