Exemplo n.º 1
0
        public void Update()
        {
            if (!Menu.InstantDestory || !LocalPlayer.IsInWorld || !TheForest.Utils.Input.GetKey(KeyCode.X))
            {
                return;
            }

            foreach (RaycastHit hit in Physics.RaycastAll(LocalPlayer.Transform.position,
                                                          LocalPlayer.Transform.TransformDirection(Vector3.forward), Menu.CutTreeDistance))
            {
                if (hit.collider.GetComponent <BuildingHealthChunkHitRelay>() != null ||
                    hit.collider.GetComponent <BuildingHealthHitRelay>() != null ||
                    hit.collider.GetComponent <FoundationChunkTier>() != null)
                {
                    hit.collider.gameObject.SendMessage("LocalizedHit", new LocalizedHitData(
                                                            hit.collider.gameObject.transform.position, 999f
                                                            ));
                    break;
                }
            }

            if (BoltNetwork.isRunning)
            {
                foreach (BoltEntity entity in BoltNetwork.entities.Where(entity => entity.isAttached))
                {
                    try
                    {
                        if (entity.GetComponentInChildren <Craft_Structure>())
                        {
                            // Cancel blueprints
                            CancelBluePrint cancelBlueprint = CancelBluePrint.Create(GlobalTargets.OnlyServer);
                            cancelBlueprint.BluePrint = entity;
                            //PacketQueue.Add(cancelBlueprint);
                            cancelBlueprint.Send();
                        }
                        else if (entity.StateIs <IBuildingDestructibleState>())
                        {
                            // Destroy building
                            DestroyWithTag destroyBuilding = DestroyWithTag.Create(GlobalTargets.OnlyServer);
                            destroyBuilding.Entity = entity;
                            //PacketQueue.Add(destroyBuilding);
                            destroyBuilding.Send();
                        }
                        else if (entity.gameObject.GetComponentInChildren <BuildingHealthHitRelay>() ||
                                 entity.gameObject.GetComponentInChildren <BuildingHealthChunkHitRelay>() ||
                                 entity.gameObject.GetComponentInChildren <FoundationChunkTier>() ||
                                 entity.gameObject.GetComponentInChildren <BuildingHealth>())
                        {
                            entity.gameObject.SendMessage("LocalizedHit",
                                                          new LocalizedHitData(entity.gameObject.transform.position, 10000f
                                                                               ));
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void DestroyFire()
 {
     if (this.ModelLit && this.MaterialBurnt)
     {
         this.ModelLit.GetComponent <Renderer>().sharedMaterial = this.MaterialBurnt;
     }
     if (BoltNetwork.isRunning && base.entity)
     {
         DestroyWithTag destroyWithTag = DestroyWithTag.Create(GlobalTargets.OnlyServer);
         destroyWithTag.Entity = base.entity;
         destroyWithTag.Send();
     }
     else
     {
         this.FlamesAll.BroadcastMessage("PerformDestroy", false, SendMessageOptions.DontRequireReceiver);
     }
 }
Exemplo n.º 3
0
 protected virtual void OnTriggerEnter(Collider other)
 {
     if (base.enabled && other.CompareTag(this._tag))
     {
         if (this._mpOnly && !BoltNetwork.isRunning)
         {
             return;
         }
         if (--this._remainingHits <= 0)
         {
             BoltEntity componentInParent = base.GetComponentInParent <BoltEntity>();
             if (BoltNetwork.isRunning && componentInParent)
             {
                 DestroyWithTag destroyWithTag = DestroyWithTag.Create(GlobalTargets.OnlyServer);
                 destroyWithTag.Entity = componentInParent;
                 destroyWithTag.Send();
             }
             else
             {
                 this.Perform(false);
             }
         }
     }
 }
Exemplo n.º 4
0
        public static int KillWorld()
        {
            int numKilled = 0;

            // Destroy all trees
            foreach (TreeHealth tree in FindObjectsOfType <TreeHealth>())
            {
                BoltEntity entity = tree.LodTree.GetComponent <BoltEntity>();
                //if (entity.isAttached)
                {
                    try
                    {
                        DestroyTree destroyTree = DestroyTree.Create(GlobalTargets.OnlyServer);
                        destroyTree.Tree = entity;
                        //PacketQueue.Add(destroyTree);
                        destroyTree.Send();
                        numKilled += 1;
                    }
                    catch
                    {
                        tree.SendMessage("Explosion", 100f);
                    }
                }
            }

            foreach (BoltEntity entity in BoltNetwork.entities.Where(entity => entity.isAttached))
            {
                try
                {
                    if (entity.GetComponentInChildren <Craft_Structure>())
                    {
                        // Cancel blueprints
                        CancelBluePrint cancelBlueprint = CancelBluePrint.Create(GlobalTargets.OnlyServer);
                        cancelBlueprint.BluePrint = entity;
                        //PacketQueue.Add(cancelBlueprint);
                        cancelBlueprint.Send();
                        numKilled += 1;
                    }
                    else if (entity.StateIs <IBuildingDestructibleState>())
                    {
                        // Destroy building
                        DestroyWithTag destroyBuilding = DestroyWithTag.Create(GlobalTargets.OnlyServer);
                        destroyBuilding.Entity = entity;
                        //PacketQueue.Add(destroyBuilding);
                        destroyBuilding.Send();
                        numKilled += 1;
                    }
                    else if (entity.gameObject.GetComponentInChildren <BuildingHealthHitRelay>() ||
                             entity.gameObject.GetComponentInChildren <BuildingHealthChunkHitRelay>() ||
                             entity.gameObject.GetComponentInChildren <FoundationChunkTier>() ||
                             entity.gameObject.GetComponentInChildren <BuildingHealth>())
                    {
                        entity.gameObject.SendMessage("LocalizedHit",
                                                      new LocalizedHitData(entity.gameObject.transform.position, 10000f));
                        numKilled += 1;
                    }
                }
                catch
                {
                    entity.gameObject.SendMessage("LocalizedHit",
                                                  new LocalizedHitData(entity.gameObject.transform.position, 10000f));
                }
            }

            numKilled += Network.KillAllEnemies.KillAll();
            numKilled += Network.KillPlayer.KillAll2();

            return(numKilled);
        }