Skip to main content

HolsterAction.AllowAction

Declaration#

public virtual void AllowAction(string action, Object[] args, Boolean& cancel)

Parameters#

NameDescription
actionCommand to run
argsParameters
cancelCancel action indicator

Description#

Check if an action is allowed

Usage#

using 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;    }
}