OnNpcEquipWeapon
Usage
- Return a non-null value to override default behavior
Example Autogenerated
csharp
private void OnNpcEquipWeapon( NPCPlayer instance, Item slot )
{
Puts( "OnNpcEquipWeapon works!" );
}
csharp
private void OnNpcEquipWeapon( ScientistNPC instance, Item item )
{
Puts( "OnNpcEquipWeapon works!" );
}
Location
- NPCPlayer::EquipWeapon(bool skipDeployDelay)
- ScientistNPC::EquipWeapon(bool skipDeployDelay)
csharp
//---
if (base.inventory == null || base.inventory.containerBelt == null)
{
return;
}
Item slot = base.inventory.containerBelt.GetSlot(0);
if (Interface.CallHook("OnNpcEquipWeapon", this, slot) != null)
{
return;
}
if (slot != null)
{
//---
csharp
//---
if (heldEntity != null)
{
Item item = heldEntity.GetItem();
if (item != null && item.contents != null)
{
if (Interface.CallHook("OnNpcEquipWeapon", this, item) != null)
{
return;
}
if (UnityEngine.Random.Range(0, 3) == 0)
{
//---