public MyEntity RemoveItems(uint itemId, MyFixedPoint?amount = null, bool sendEvent = true, bool spawn = false, MatrixD?spawnPos = null) { var item = GetItemByID(itemId); var am = amount.HasValue ? amount.Value : (item.HasValue? item.Value.Amount : 1); MyEntity spawned = null; if (Sync.IsServer) { if (item.HasValue && RemoveItemsInternal(itemId, am, sendEvent)) { if (spawn) { var owner = Owner as MyEntity; if (!spawnPos.HasValue) { spawnPos = MatrixD.CreateWorld(owner.PositionComp.GetPosition() + owner.PositionComp.WorldMatrix.Forward + owner.PositionComp.WorldMatrix.Up, owner.PositionComp.WorldMatrix.Forward, owner.PositionComp.WorldMatrix.Up); } spawned = item.Value.Spawn(am, spawnPos.Value, owner); } SyncObject.SendRemoveItemsAnnounce(this, am, itemId); } } else { SyncObject.SendRemoveItemsRequest(this, am, itemId, spawn); } return(spawned); }