Exemple #1
0
 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);
 }
Exemple #2
0
 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();
     }
 }