CanLootEntity
Called when a player tries to loot a WorldItem
Usage
- Return a non-null value to override default behavior
Example Autogenerated
csharp
private object CanLootEntity( BasePlayer player, WorldItem instance )
{
Puts( "CanLootEntity works!" );
return null;
}Location
- WorldItem::RPC_OpenLoot(BaseEntity.RPCMessage rpc)
csharp
//---
}
ItemModContainer component = item.info.GetComponent<ItemModContainer>();
if (!(component == null) && component.canLootInWorld)
{
BasePlayer player = rpc.player;
if ((bool)player && player.CanInteract() && CanOpenInSafeZone(player) && Interface.CallHook("CanLootEntity", player, this) == null && player.inventory.loot.StartLootingEntity(this))
{
SetFlag(Flags.Open, b: true);
player.inventory.loot.AddContainer(item.contents);
player.inventory.loot.SendImmediate();
player.ClientRPC(RpcTarget.Player("RPC_OpenLootPanel", player), "generic_resizable");
//---