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