As the title asks, is there an event to detect when an item is going to be deleted because it was abandoned on the ground for too long ?
Removing items on ground after period of time?
Discussion in 'Rust Discussion' started by Yatta, Jul 1, 2016.
-
Not sure about some timer or message, but there is console (rcon) command to set time before despawn
Code:server.itemdespawn 180
-
Would that plan make sense :
- detect dropped item, add it to a "dropped items" list
- remove it from the list if someones pick it up
- periodically check if the item still exists (if not it has despawned and use it to do code accordingly)
Also im new to this and im a little confused by the api documentation : all the events are listed, but no basics like accessing position of an entity, manipulating inventories and so on ... did i miss something ? is there documentation on that ? -
Bump,
****How to know when a human corpse or item is despawned/killed/destroyed/removed? Is there a hook?****
I tried watching OnEntityKill(BaseNetworkable net) but really mostly saw animal corpses and barrels/crates being killed -
Any dropped item will create a worldobject as "WorldItem". This object has also the class "DroppedItem".
Once its dropped, it runs an invoke "IdleDestroy" based on the the server setting for despawn:
Code:// DroppedItem private void IdleDestroy() { if (this.item != null) { this.item.Remove(0f); this.item = null; } base.Kill(BaseNetworkable.DestroyMode.None); }
In this hook you could check for if the object is either a "WorldItem and/or "DroppedItem".
Afterwards you could do anything you want to do with it. -
-
-
Thank you.