/// <summary> /// Server spawn callback for item. /// </summary> /// <param name="trigger">Trigger leading to this spawn.</param> /// <param name="zone">Server zone instance.</param> /// <param name="protoItem">Prototype of item to spawn.</param> /// <param name="tilePosition">Position to try spawn at.</param> protected IGameObjectWithProto ServerSpawnItem( IProtoTrigger trigger, IServerZone zone, IProtoItem protoItem, Vector2Ushort tilePosition) { var container = ObjectGroundItemsContainer.ServerTryGetOrCreateGroundContainerAtTile( tilePosition, writeWarningsToLog: false); if (container == null) { // cannot spawn item there return(null); } return(Server.Items.CreateItem(protoItem, container) .ItemAmounts .Keys .FirstOrDefault()); }