HolsterAction.AllowAction
#
Declarationpublic virtual void AllowAction(string action, Object[] args, Boolean& cancel)
#
ParametersName | Description |
---|---|
action | Command to run |
args | Parameters |
cancel | Cancel action indicator |
#
DescriptionCheck if an action is allowed
#
Usageusing NullSave.GDTK.Inventory;using UnityEngine;
public class Example : MonoBehaviour{
// Check if an item (other) can be attached to target public void ExampleMethod(GDTKItem target, GDTKItem other) { HolsterAction action = target.GetPlugin<HolsterAction>(); SocketAbility socket = other.GetPlugin<SocketAbility>(); bool cancel = false;
if (action != null && socket != null) { action.AllowAction("attach", new object[] { socket }, ref cancel); } else { cancel = true; }
bool canAttach = !cancel; }
}