private bool DestroyThroughBolt(bool fakeDrop) { if (BoltNetwork.isRunning) { BoltEntity boltEntity = (!this._destroyTarget) ? base.GetComponentInParent <BoltEntity>() : this._destroyTarget.GetComponent <BoltEntity>(); if (boltEntity && !this._destroyTarget && !boltEntity.StateIs <IAnimalState>()) { boltEntity = null; } if (boltEntity && boltEntity.isAttached && !boltEntity.StateIs <IPlayerState>() && !boltEntity.StateIs <IMutantState>()) { if (this._disableInsteadOfDestroy) { DisablePickup disablePickup; if (boltEntity.source == null) { disablePickup = DisablePickup.Create(GlobalTargets.OnlySelf); } else { disablePickup = DisablePickup.Create(boltEntity.source); } disablePickup.Entity = boltEntity; disablePickup.Num = this._destroyTarget.transform.GetSiblingIndex(); disablePickup.Send(); this._pendingdestroythroughbolt = true; return(false); } DestroyPickUp destroyPickUp; if (boltEntity.source == null) { destroyPickUp = DestroyPickUp.Create(GlobalTargets.OnlySelf); } else { destroyPickUp = DestroyPickUp.Create(boltEntity.source); } destroyPickUp.PickUpPlayer = LocalPlayer.Entity; destroyPickUp.PickUpEntity = boltEntity; destroyPickUp.ItemId = this._itemId; destroyPickUp.SibblingId = ((!this._mpIsFlareFromCrate) ? -1 : this._destroyTarget.transform.GetSiblingIndex()); destroyPickUp.FakeDrop = (fakeDrop && !this._spawnAfterPickupPrefab); destroyPickUp.Send(); if (this._destroyTarget) { this.ToggleRenderers(this._destroyTarget.transform, false); } this._pendingdestroythroughbolt = true; return(true); } } return(false); }
private void CutDown() { if (this.entity.IsAttached() && this.entity.StateIs <IGardenDirtPileState>()) { DestroyPickUp destroyPickUp = DestroyPickUp.Create(GlobalTargets.OnlyServer); destroyPickUp.PickUpEntity = this.entity; destroyPickUp.Send(); } else { this.CutDownReal(); } }
public override void OnEvent(DestroyPickUp evnt) { if (evnt.PickUpEntity) { if (evnt.PickUpEntity.isAttached) { if (evnt.PickUpEntity.isOwner) { if (evnt.PickUpEntity.StateIs <ISuitcaseState>()) { if (evnt.SibblingId >= 0) { ISuitcaseState state = evnt.PickUpEntity.GetState <ISuitcaseState>(); state.FlaresPickedUp |= 1 << evnt.SibblingId; } else { evnt.PickUpEntity.GetState <ISuitcaseState>().ClothPickedUp = true; } } else { if (evnt.FakeDrop) { if (evnt.PickUpPlayer == LocalPlayer.Entity) { LocalPlayer.Inventory.FakeDrop(evnt.ItemId); } else { PlayerAddItem playerAddItem = PlayerAddItem.Create(evnt.PickUpPlayer.source); playerAddItem.ItemId = evnt.ItemId; playerAddItem.Amount = 1; playerAddItem.Player = evnt.PickUpPlayer; playerAddItem.Send(); } } PickUp componentInChildren = evnt.PickUpEntity.GetComponentInChildren <PickUp>(); if (!componentInChildren || !componentInChildren.TryPool()) { BoltNetwork.Destroy(evnt.PickUpEntity); } } } else { DestroyPickUp destroyPickUp = DestroyPickUp.Raise(evnt.PickUpEntity.source); destroyPickUp.PickUpEntity = evnt.PickUpEntity; destroyPickUp.Send(); } } } else if (evnt.PickUpPlayer.isOwner) { ItemRemoveFromPlayer itemRemoveFromPlayer = ItemRemoveFromPlayer.Create(GlobalTargets.OnlySelf); itemRemoveFromPlayer.ItemId = itemRemoveFromPlayer.ItemId; itemRemoveFromPlayer.Send(); } else { ItemRemoveFromPlayer itemRemoveFromPlayer2 = ItemRemoveFromPlayer.Create(evnt.PickUpPlayer.source); itemRemoveFromPlayer2.ItemId = itemRemoveFromPlayer2.ItemId; itemRemoveFromPlayer2.Send(); } }