// Token: 0x060033A4 RID: 13220 RVA: 0x0014F0EC File Offset: 0x0014D4EC
        private IEnumerator cleanup()
        {
            yield return(new WaitForSeconds(600f));

            BarricadeManager.damage(base.transform, 65000f, 1f, false);
            yield break;
        }
Beispiel #2
0
 public void VehicleElementDrop(InteractableVehicle vehicle, bool shouldDestroy = true, Transform trainCarTransform = null)
 {
     if ((vehicle.asset.engine == EEngine.TRAIN && trainCarTransform == null) || vehicle.isDead)
     {
         return;
     }
     if (BarricadeManager.tryGetPlant(vehicle.asset.engine == EEngine.TRAIN ? trainCarTransform : vehicle.transform, out byte x, out byte y, out ushort plant, out BarricadeRegion vregion))
     {
         for (int i = vregion.drops.Count - 1; i >= 0; i--)
         {
             try
             {
                 Item item = new Item(vregion.barricades[i].barricade.id, true);
                 ItemManager.dropItem(item, vregion.drops[i].model.position, false, true, true);
             }
             catch (Exception ex)
             {
                 // You can get an error, if there's a mismatch in the barricades and drops lists for the region(should rarely ever happen, mostly ever happens when elements are destroyed by a thread outside of the main thread, eg by plugin.).
                 Logger.LogException(ex, "Error in dropping an element off of the vehicle.");
             }
             if (shouldDestroy)
             {
                 try
                 {
                     BarricadeManager.damage(vregion.drops[i].model, ushort.MaxValue, 1, false);
                 }
                 catch (Exception ex)
                 {
                     Logger.LogException(ex, "Error in destroying vehicle barricade.");
                 }
             }
         }
     }
 }
 private void Update()
 {
     if (!Provider.isServer)
     {
         return;
     }
     if (Time.realtimeSinceStartup - this.started < 3f)
     {
         return;
     }
     if (this.isRegistered)
     {
         for (int i = 0; i < Provider.clients.Count; i++)
         {
             SteamPlayer steamPlayer = Provider.clients[i];
             if (!(steamPlayer.player == null) && !(steamPlayer.player.movement == null) && !(steamPlayer.player.life == null) && !steamPlayer.player.life.isDead)
             {
                 if (steamPlayer.player.movement.nav == this.nav)
                 {
                     return;
                 }
             }
         }
     }
     BarricadeManager.damage(base.transform, 10000f, 1f, false);
 }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length > 1)
            {
                Rocket.Unturned.Chat.UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                throw new WrongUsageOfCommandException(caller, this);
            }
            UnturnedPlayer player = (UnturnedPlayer)caller;

            if (Physics.Raycast(player.Player.look.aim.position, player.Player.look.aim.forward, out RaycastHit hit, 4, RayMasks.BARRICADE_INTERACT))
            {
                if (BarricadeManager.tryGetInfo(hit.transform, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion r))
                {
                    BarricadeData bdata = r.barricades[index];
                    if (bdata.barricade.id != 3280 || bdata.owner != player.CSteamID.m_SteamID)
                    {
                        Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"Error occured: this barricade is not a virtual inventory box or box is not yours.", Color.red);
                        Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"Owner steamID: {bdata.owner}\r\nYour steamID: {player.CSteamID.ToString()}");
                        return;
                    }
                    StateToBlock(bdata, player.CSteamID.ToString(), (command.Length == 0) ? SetBoxName(Plugin.Instance.pathTemp + $@"\{player.CSteamID}") : command[0].Trim());
                    //BarricadeManager.dropBarricade(bdata.barricade, hit.transform, player.Position, bdata.angle_x, bdata.angle_y, bdata.angle_z, bdata.owner, bdata.group);
                    BarricadeManager.damage(hit.transform, ushort.MaxValue, 1, false);
                    //BarricadeManager.dropBarricade(bdata.barricade, hit.transform, player.Position, bdata.angle_x, bdata.angle_y, bdata.angle_z, bdata.owner, bdata.group);
                    List <ItemData> itemsData = new List <ItemData>();
                    GetItemsInRadius(bdata.point, 2, new RegionCoordinate(x, y), itemsData);
                    foreach (var item in itemsData)
                    {
                        ItemManager.instance.channel.send("tellTakeItem", ESteamCall.CLIENTS, x, y, ItemManager.ITEM_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, (object)x, (object)y, (object)item.instanceID);
                    }
                }
            }
        }
Beispiel #5
0
        // Token: 0x060020B4 RID: 8372 RVA: 0x000B363C File Offset: 0x000B1A3C
        public void detonate(CSteamID killer)
        {
            EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position);
            List <EPlayerKill> list;

            DamageTool.explode(base.transform.position, this.range2, EDeathCause.CHARGE, killer, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
            BarricadeManager.damage(base.transform, 5f, 1f, false);
        }
Beispiel #6
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player    = (UnturnedPlayer)caller;
            DirectoryInfo  directory = new DirectoryInfo(Plugin.Instance.pathTemp + "\\" + ((UnturnedPlayer)caller).CSteamID.ToString());

            if (!directory.Exists || directory.GetFiles().Length == 0)
            {
                directory.Create();
            }
            if (!GetAllowed(player.CSteamID.ToString(), out ushort allowedTotal, out string groupName))
            {
                Rocket.Unturned.Chat.UnturnedChat.Say(caller, "You groupID was not found to find your find limits");
                return;
            }
            ushort boxNow = (ushort)new DirectoryInfo(Plugin.Instance.pathTemp + $@"\{player.CSteamID}").GetFiles().Length;

            if (allowedTotal - boxNow == 0)
            {
                Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"You have reached your limit of boxes in cloud. \r\nLimit: {allowedTotal}\r\nYour groupID: {groupName}");
                return;
            }
            else if (allowedTotal - boxNow < 0)
            {
                Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"You have {boxNow - allowedTotal} extra boxes in cloud box intentory, drop {boxNow - allowedTotal + 1} boxes to send new box");
                return;
            }

            if (command.Length > 1)
            {
                Rocket.Unturned.Chat.UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                throw new WrongUsageOfCommandException(caller, this);
            }
            if (Physics.Raycast(player.Player.look.aim.position, player.Player.look.aim.forward, out RaycastHit hit, 4, RayMasks.BARRICADE_INTERACT))
            {
                if (BarricadeManager.tryGetInfo(hit.transform, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion r))
                {
                    BarricadeData bdata = r.barricades[index];
                    if (bdata.barricade.id != 3280 || bdata.owner != player.CSteamID.m_SteamID)
                    {
                        Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"Error occured: this barricade is not a virtual inventory box or box is not yours.", Color.red);
                        Rocket.Unturned.Chat.UnturnedChat.Say(caller, $"Owner steamID: {bdata.owner}\r\nYour steamID: {player.CSteamID.ToString()}");
                        return;
                    }
                    StateToBlock(bdata, player.CSteamID.ToString(), (command.Length == 0) ? SetBoxName(Plugin.Instance.pathTemp + $@"\{player.CSteamID}") : command[0].Trim());
                    //BarricadeManager.dropBarricade(bdata.barricade, hit.transform, player.Position, bdata.angle_x, bdata.angle_y, bdata.angle_z, bdata.owner, bdata.group);
                    BarricadeManager.damage(hit.transform, ushort.MaxValue, 1, false);
                    //BarricadeManager.dropBarricade(bdata.barricade, hit.transform, player.Position, bdata.angle_x, bdata.angle_y, bdata.angle_z, bdata.owner, bdata.group);
                    List <ItemData> itemsData = new List <ItemData>();
                    GetItemsInRadius(bdata.point, 2, new RegionCoordinate(x, y), itemsData);
                    foreach (var item in itemsData)
                    {
                        ItemManager.instance.channel.send("tellTakeItem", ESteamCall.CLIENTS, x, y, ItemManager.ITEM_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, (object)x, (object)y, (object)item.instanceID);
                    }
                }
            }
        }
 public void despawnAlive()
 {
     if (this.alive <= 0)
     {
         return;
     }
     this.alive--;
     if (this.remaining == 0 && this.alive == 0)
     {
         BarricadeManager.damage(base.transform, 10000f, 1f, false);
     }
 }
        public void DestructionRun()
        {
            if (_destroyQueue.Count == 0)
            {
                return;
            }
            if ((DateTime.Now - _lastDestructionRun).TotalMilliseconds <= (1000 / _wreckPlugin.ConfigurationInstance.DestructionInterval) &&
                _amountDestroyed >= _wreckPlugin.ConfigurationInstance.DestructionsPerInterval)
            {
                return;
            }

            KeyValuePair <int, object> nextDestroy = _destroyQueue.First();

            if (nextDestroy.Value is BarricadeData bData)
            {
                Transform transform = Physics.OverlapSphere(bData.point, 0.5f, 1 << LayerMasks.BARRICADE).FirstOrDefault(c => c.transform.position == bData.point)?.transform;
                if (transform == null)
                {
                    return;
                }
                BarricadeManager.damage(transform, ushort.MaxValue, 1, false);
            }
            if (nextDestroy.Value is StructureData sData)
            {
                Transform transform = Physics.OverlapSphere(sData.point, 0.5f, 1 << LayerMasks.BARRICADE).FirstOrDefault(c => c.transform.position == sData.point)?.transform;
                if (transform == null)
                {
                    return;
                }
                StructureManager.damage(transform, transform.position, ushort.MaxValue, 1, false);
            }
            if (nextDestroy.Value is InteractableVehicle vData)
            {
                vData.askDamage(ushort.MaxValue, true);
            }
            if (nextDestroy.Value is Animal aData)
            {
                aData.askDamage(byte.MaxValue, aData.transform.up, out EPlayerKill _, out uint _);
            }
            if (nextDestroy.Value is Zombie zData)
            {
                zData.askDamage(byte.MaxValue, zData.transform.up, out EPlayerKill _, out uint _);
            }

            _destroyQueue.Remove(nextDestroy.Key);
            _amountDestroyed++;
            if (_amountDestroyed == _wreckPlugin.ConfigurationInstance.DestructionsPerInterval)
            {
                _lastDestructionRun = DateTime.Now;
            }
        }
        private void OnTimedEvent(RocketPlayer caller)
        {
            try
            {
                if (destroyList[dIdx].Type == "s")
                {
                    try { StructureManager.damage(destroyList[dIdx].Transform, destroyList[dIdx].Transform.position, 65535, 1); }
                    catch { }
                }

                else if (destroyList[dIdx].Type == "b")
                {
                    try { BarricadeManager.damage(destroyList[dIdx].Transform, 65535, 1); }
                    catch { }
                }

                else if (destroyList[dIdx].Type == "v")
                {
                    try { destroyList[dIdx].Vehicle.askDamage(65535); }
                    catch { }
                }
                else if (destroyList[dIdx].Type == "z")
                {
                    EPlayerKill pKill;
                    try
                    {
                        for (int i = 0; i < 100; i++)
                        {
                            destroyList[dIdx].Zombie.askDamage(255, destroyList[dIdx].Zombie.transform.up, out pKill);
                        }
                    }
                    catch { }
                }

                dIdx++;
                if (destroyList.Count == dIdx)
                {
                    RocketChat.Say(caller, Translate("wreckingball_complete", dIdx));
                    StructureManager.save();
                    Abort();
                    processing = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #10
0
 // Token: 0x060033DF RID: 13279 RVA: 0x0015136B File Offset: 0x0014F76B
 public static void damage(Transform barricade, bool isRepairing, float barricadeDamage, float times, out EPlayerKill kill)
 {
     kill = EPlayerKill.NONE;
     if (barricade == null)
     {
         return;
     }
     if (isRepairing)
     {
         BarricadeManager.repair(barricade, barricadeDamage, times);
     }
     else
     {
         BarricadeManager.damage(barricade, barricadeDamage, times, true);
     }
 }
Beispiel #11
0
        internal static void DestructionLoop(WreckType type)
        {
            try
            {
                int         i = 0;
                EPlayerKill pKill;
                uint        xp;
                while (((dIdx < dIdxCount && type == WreckType.Wreck) || (cdIdx < cdIdxCount && type == WreckType.Cleanup)) && i < WreckingBall.Instance.Configuration.Instance.DestructionsPerInterval)
                {
                    Destructible element = type == WreckType.Wreck ? destroyList[dIdx] : cleanupList[cdIdx];

                    if (element.Type == ElementType.Structure)
                    {
                        try
                        {
                            if (WreckingBall.Instance.Configuration.Instance.EnableDestroyedElementDrop)
                            {
                                try
                                {
                                    Item item = new Item(element.ItemID, true);
                                    ItemManager.dropItem(item, element.Transform.position, false, true, true);
                                }
                                catch (Exception ex) { Logger.LogException(ex, "Error in dropping an item for a destroyed structure."); }
                            }
                            StructureManager.damage(element.Transform, element.Transform.position, ushort.MaxValue, 1, false);
                        }
                        catch (Exception ex) { Logger.LogException(ex, "Error in destroying structure."); }
                    }

                    else if (element.Type == ElementType.Barricade || element.Type == ElementType.VehicleBarricade)
                    {
                        try
                        {
                            if ((element.Type == ElementType.VehicleBarricade && WreckingBall.Instance.Configuration.Instance.EnableVehicleElementDrop) || (element.Type == ElementType.Barricade && WreckingBall.Instance.Configuration.Instance.EnableDestroyedElementDrop))
                            {
                                try
                                {
                                    Item item = new Item(element.ItemID, true);
                                    ItemManager.dropItem(item, element.Transform.position, false, true, true);
                                }
                                catch (Exception ex) { Logger.LogException(ex, "Error in dropping an item for a destroyed" + (element.Type == ElementType.VehicleBarricade ? " vehicle" : string.Empty) + " barricade."); }
                            }
                            BarricadeManager.damage(element.Transform, ushort.MaxValue, 1, false);
                        }
                        catch (Exception ex) { Logger.LogException(ex, "Error in destroying barricade."); }
                    }

                    else if (element.Type == ElementType.Vehicle)
                    {
                        try {
                            // Output log entry if a vehicle is destroyed by a cleanup.
                            if (type == WreckType.Cleanup)
                            {
                                bool getPInfo = WreckingBall.isPlayerInfoLibLoaded;
                                Logger.Log(string.Format("Cleanup: Vehicle with InstanceID: {0}, and Type: {1}({2}), at position: {3} destroyed, Element count: {4}, Sign By: {5}, Locked By: {6}.",
                                                         element.Vehicle.instanceID,
                                                         element.Vehicle.asset.vehicleName,
                                                         element.Vehicle.asset.id,
                                                         element.Vehicle.transform.position.ToString(),
                                                         BarricadeManager.tryGetPlant(element.Vehicle.transform, out byte x, out byte y, out ushort plant, out BarricadeRegion barricadeRegion) ? barricadeRegion.drops.Count : 0,
                                                         HasFlaggedElement(element.Vehicle.transform, out ulong vFlagOwner) ? (getPInfo ? WreckingBall.Instance.PInfoGenerateMessage(vFlagOwner) : vFlagOwner.ToString()) : "N/A",
                                                         element.Vehicle.isLocked ? (getPInfo ? WreckingBall.Instance.PInfoGenerateMessage((ulong)element.Vehicle.lockedOwner) : element.Vehicle.lockedOwner.ToString()) : "N/A"));
                            }
                            if (WreckingBall.Instance.Configuration.Instance.EnableVehicleElementDrop)
                            {
                                if (element.Vehicle.asset.engine == EEngine.TRAIN && element.Vehicle.trainCars != null && element.Vehicle.trainCars.Count() > 1)
                                {
                                    foreach (TrainCar car in element.Vehicle.trainCars)
                                    {
                                        WreckingBall.Instance.VehicleElementDrop(element.Vehicle, true, car.root);
                                    }
                                }
                                else
                                {
                                    WreckingBall.Instance.VehicleElementDrop(element.Vehicle);
                                }
                            }
                            if (!element.Vehicle.isDead)
                            {
                                element.Vehicle.askDamage(ushort.MaxValue, false);
                            }
                        }
                        catch (Exception ex) { Logger.LogException(ex, "Error in destroying vehicle."); }
                    }
                    else if (element.Type == ElementType.Zombie)
                    {
                        try
                        {
                            for (int z = 0; z < 1000 && !element.Zombie.isDead; z++)
                            {
                                element.Zombie.askDamage(ushort.MaxValue, element.Zombie.transform.up, out pKill, out xp);
                            }
                        }
                        catch (Exception ex) { Logger.LogException(ex, "Error in killing zombie."); }
                    }
                    else if (element.Type == ElementType.Animal)
                    {
                        try
                        {
                            for (int a = 0; a < 1000 && !element.Animal.isDead; a++)
                            {
                                element.Animal.askDamage(ushort.MaxValue, element.Animal.transform.up, out pKill, out xp);
                            }
                        }
                        catch (Exception ex) { Logger.LogException(ex, "Error in killing animal."); }
                    }
                    if (type == WreckType.Wreck)
                    {
                        dIdx++;
                    }
                    else
                    {
                        cdIdx++;
                    }
                    i++;
                }
                if (destroyList.Count == dIdx && type == WreckType.Wreck)
                {
                    if (originalCaller != null)
                    {
                        UnturnedChat.Say(originalCaller, WreckingBall.Instance.Translate("wreckingball_complete", dIdx));
                    }
                    else
                    {
                        Logger.Log(WreckingBall.Instance.Translate("wreckingball_complete", dIdx));
                    }
                    SaveManager.save();
                    Abort(WreckType.Wreck);
                }
            }
            catch (Exception ex) { Logger.LogException(ex, "General destruction loop error."); }
        }
Beispiel #12
0
        // Token: 0x0600339D RID: 13213 RVA: 0x0014ECF0 File Offset: 0x0014D0F0
        private void OnTriggerEnter(Collider other)
        {
            if (this.isExploded)
            {
                return;
            }
            if (other.isTrigger)
            {
                return;
            }
            if (other.transform.CompareTag("Agent"))
            {
                return;
            }
            this.isExploded = true;
            Vector3 normalized = (base.transform.position - this.lastPos).normalized;

            if (Provider.isServer)
            {
                float num = Mathf.Clamp(base.transform.parent.GetComponent <Rigidbody>().velocity.magnitude, 0f, 20f);
                if (num < 3f)
                {
                    return;
                }
                if (other.transform.CompareTag("Player"))
                {
                    Player player = DamageTool.getPlayer(other.transform);
                    if (player != null)
                    {
                        EPlayerKill eplayerKill;
                        DamageTool.damage(player, EDeathCause.BOULDER, ELimb.SPINE, CSteamID.Nil, normalized, Boulder.DAMAGE_PLAYER, num, out eplayerKill);
                    }
                }
                else if (other.transform.CompareTag("Vehicle"))
                {
                    InteractableVehicle component = other.transform.GetComponent <InteractableVehicle>();
                    if (component != null && component.asset != null && component.asset.isVulnerableToEnvironment)
                    {
                        VehicleManager.damage(component, Boulder.DAMAGE_VEHICLE, num, true);
                    }
                }
                else if (other.transform.CompareTag("Barricade"))
                {
                    Transform             transform  = other.transform;
                    InteractableDoorHinge component2 = transform.GetComponent <InteractableDoorHinge>();
                    if (component2 != null)
                    {
                        transform = component2.transform.parent.parent;
                    }
                    BarricadeManager.damage(transform, Boulder.DAMAGE_BARRICADE, num, true);
                }
                else if (other.transform.CompareTag("Structure"))
                {
                    StructureManager.damage(other.transform, normalized, Boulder.DAMAGE_STRUCTURE, num, true);
                }
                else if (other.transform.CompareTag("Resource"))
                {
                    EPlayerKill eplayerKill2;
                    uint        num2;
                    ResourceManager.damage(other.transform, normalized, Boulder.DAMAGE_RESOURCE, num, 1f, out eplayerKill2, out num2);
                }
                else
                {
                    InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>();
                    if (componentInParent != null)
                    {
                        EPlayerKill eplayerKill3;
                        uint        num3;
                        DamageTool.damage(componentInParent.transform, normalized, componentInParent.getSection(other.transform), Boulder.DAMAGE_OBJECT, num, out eplayerKill3, out num3);
                    }
                }
            }
            if (!Dedicator.isDedicated)
            {
                EffectManager.effect(52, base.transform.position, -normalized);
            }
        }
Beispiel #13
0
        public override void UpdateState(List <UnturnedPlayer> players)
        {
            if (GetValue <int>() == 0)
            {
                return;
            }

            if ((DateTime.Now - _lastRun).TotalSeconds < GetValue <int>())
            {
                return;
            }

            _lastRun = DateTime.Now;

            if (StructureManager.regions != null)
            {
                foreach (var region in StructureManager.regions)
                {
                    if (region == null)
                    {
                        continue;
                    }

                    byte index = 0;

                    var dropsList = region.drops.ToList();
                    foreach (var drop in dropsList)
                    {
                        if (dropsList.Count != region.drops.Count)
                        {
                            break;
                        }

                        if (dropsList.Count != region.structures.Count)
                        {
                            break;
                        }

                        var structure = region.structures.ToList().ElementAt(index);
                        index++;

                        if (structure?.structure == null)
                        {
                            continue;
                        }
                        if (!Region.Type.IsInRegion(new SerializablePosition(structure.point)))
                        {
                            continue;
                        }

                        var asset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structure.structure.id);
                        if (asset == null)
                        {
                            continue;
                        }

                        StructureManager.damage(drop.model, Vector3.zero, 10f, 1f, true);
                    }
                }
            }

            if (BarricadeManager.regions == null)
            {
                return;
            }
            {
                foreach (var region in BarricadeManager.regions)
                {
                    if (region == null)
                    {
                        continue;
                    }

                    byte index     = 0;
                    var  dropsList = region.drops.ToList();
                    foreach (var drop in dropsList)
                    {
                        if (dropsList.Count != region.drops.Count)
                        {
                            break;
                        }

                        if (dropsList.Count != region.barricades.Count)
                        {
                            break;
                        }


                        var barricade = region.barricades.ToList().ElementAt(index);
                        index++;

                        if (barricade?.barricade == null)
                        {
                            continue;
                        }
                        if (!Region.Type.IsInRegion(new SerializablePosition(barricade.point)))
                        {
                            continue;
                        }

                        var asset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, barricade.barricade.id);
                        if (asset == null)
                        {
                            continue;
                        }

                        BarricadeManager.damage(drop.model, 10f, 1f, true);
                    }
                }
            }
        }
Beispiel #14
0
        public static void explode(Vector3 point, float damageRadius, EDeathCause cause, CSteamID killer, float playerDamage, float zombieDamage, float animalDamage, float barricadeDamage, float structureDamage, float vehicleDamage, float resourceDamage, float objectDamage, EExplosionDamageType damageType = EExplosionDamageType.CONVENTIONAL, float alertRadius = 32f, bool playImpactEffect = true)
        {
            DamageTool.explosionRangeComparator.point = point;
            float num = damageRadius * damageRadius;

            DamageTool.regionsInRadius.Clear();
            Regions.getRegionsInRadius(point, damageRadius, DamageTool.regionsInRadius);
            if (structureDamage > 0.5f)
            {
                DamageTool.structuresInRadius.Clear();
                StructureManager.getStructuresInRadius(point, num, DamageTool.regionsInRadius, DamageTool.structuresInRadius);
                DamageTool.structuresInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int i = 0; i < DamageTool.structuresInRadius.Count; i++)
                {
                    Transform transform = DamageTool.structuresInRadius[i];
                    if (!(transform == null))
                    {
                        ushort id;
                        if (ushort.TryParse(transform.name, out id))
                        {
                            ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id);
                            if (itemStructureAsset != null && !itemStructureAsset.proofExplosion)
                            {
                                Vector3 vector    = transform.transform.position - point;
                                float   magnitude = vector.magnitude;
                                Vector3 vector2   = vector / magnitude;
                                if (magnitude > 0.5f)
                                {
                                    RaycastHit raycastHit;
                                    PhysicsUtility.raycast(new Ray(point, vector2), out raycastHit, magnitude - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                                    if (raycastHit.transform != null && raycastHit.transform != transform.transform)
                                    {
                                        goto IL_154;
                                    }
                                }
                                StructureManager.damage(transform, vector.normalized, structureDamage, 1f - magnitude / damageRadius, true);
                            }
                        }
                    }
                    IL_154 :;
                }
            }
            if (resourceDamage > 0.5f)
            {
                DamageTool.resourcesInRadius.Clear();
                ResourceManager.getResourcesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.resourcesInRadius);
                DamageTool.resourcesInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int j = 0; j < DamageTool.resourcesInRadius.Count; j++)
                {
                    Transform transform2 = DamageTool.resourcesInRadius[j];
                    if (!(transform2 == null))
                    {
                        Vector3 vector3    = transform2.transform.position - point;
                        float   magnitude2 = vector3.magnitude;
                        Vector3 vector4    = vector3 / magnitude2;
                        if (magnitude2 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, vector4), out raycastHit, magnitude2 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                            if (raycastHit.transform != null && raycastHit.transform != transform2.transform)
                            {
                                goto IL_26D;
                            }
                        }
                        EPlayerKill eplayerKill;
                        uint        num2;
                        ResourceManager.damage(transform2, vector3.normalized, resourceDamage, 1f - magnitude2 / damageRadius, 1f, out eplayerKill, out num2);
                    }
                    IL_26D :;
                }
            }
            if (objectDamage > 0.5f)
            {
                DamageTool.objectsInRadius.Clear();
                ObjectManager.getObjectsInRadius(point, num, DamageTool.regionsInRadius, DamageTool.objectsInRadius);
                DamageTool.objectsInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int k = 0; k < DamageTool.objectsInRadius.Count; k++)
                {
                    Transform transform3 = DamageTool.objectsInRadius[k];
                    if (!(transform3 == null))
                    {
                        InteractableObjectRubble component = transform3.GetComponent <InteractableObjectRubble>();
                        if (!(component == null))
                        {
                            if (!component.asset.rubbleProofExplosion)
                            {
                                for (byte b = 0; b < component.getSectionCount(); b += 1)
                                {
                                    Transform section = component.getSection(b);
                                    Vector3   vector5 = section.position - point;
                                    if (vector5.sqrMagnitude < num)
                                    {
                                        float   magnitude3 = vector5.magnitude;
                                        Vector3 vector6    = vector5 / magnitude3;
                                        if (magnitude3 > 0.5f)
                                        {
                                            RaycastHit raycastHit;
                                            PhysicsUtility.raycast(new Ray(point, vector6), out raycastHit, magnitude3 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                                            if (raycastHit.transform != null && raycastHit.transform != transform3.transform)
                                            {
                                                goto IL_3CA;
                                            }
                                        }
                                        EPlayerKill eplayerKill;
                                        uint        num2;
                                        ObjectManager.damage(transform3, vector5.normalized, b, objectDamage, 1f - magnitude3 / damageRadius, out eplayerKill, out num2);
                                    }
                                    IL_3CA :;
                                }
                            }
                        }
                    }
                }
            }
            if (barricadeDamage > 0.5f)
            {
                DamageTool.barricadesInRadius.Clear();
                BarricadeManager.getBarricadesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.barricadesInRadius);
                BarricadeManager.getBarricadesInRadius(point, num, DamageTool.barricadesInRadius);
                DamageTool.barricadesInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int l = 0; l < DamageTool.barricadesInRadius.Count; l++)
                {
                    Transform transform4 = DamageTool.barricadesInRadius[l];
                    if (!(transform4 == null))
                    {
                        Vector3 vector7    = transform4.transform.position - point;
                        float   magnitude4 = vector7.magnitude;
                        Vector3 vector8    = vector7 / magnitude4;
                        if (magnitude4 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, vector8), out raycastHit, magnitude4 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                            if (raycastHit.transform != null && raycastHit.transform != transform4.transform)
                            {
                                goto IL_52A;
                            }
                        }
                        ushort id2;
                        if (ushort.TryParse(transform4.name, out id2))
                        {
                            ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id2);
                            if (itemBarricadeAsset != null && !itemBarricadeAsset.proofExplosion)
                            {
                                BarricadeManager.damage(transform4, barricadeDamage, 1f - magnitude4 / damageRadius, true);
                            }
                        }
                    }
                    IL_52A :;
                }
            }
            if ((Provider.isPvP || damageType == EExplosionDamageType.ZOMBIE_ACID || damageType == EExplosionDamageType.ZOMBIE_FIRE || damageType == EExplosionDamageType.ZOMBIE_ELECTRIC) && playerDamage > 0.5f)
            {
                DamageTool.playersInRadius.Clear();
                PlayerTool.getPlayersInRadius(point, num, DamageTool.playersInRadius);
                for (int m = 0; m < DamageTool.playersInRadius.Count; m++)
                {
                    Player player = DamageTool.playersInRadius[m];
                    if (!(player == null) && !player.life.isDead)
                    {
                        if (damageType != EExplosionDamageType.ZOMBIE_FIRE || player.clothing.shirtAsset == null || !player.clothing.shirtAsset.proofFire || player.clothing.pantsAsset == null || !player.clothing.pantsAsset.proofFire)
                        {
                            Vector3 vector9    = player.transform.position - point;
                            float   magnitude5 = vector9.magnitude;
                            Vector3 vector10   = vector9 / magnitude5;
                            if (magnitude5 > 0.5f)
                            {
                                RaycastHit raycastHit;
                                PhysicsUtility.raycast(new Ray(point, vector10), out raycastHit, magnitude5 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                                if (raycastHit.transform != null && raycastHit.transform != player.transform)
                                {
                                    goto IL_760;
                                }
                            }
                            if (playImpactEffect)
                            {
                                EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, -vector10);
                                EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, Vector3.up);
                            }
                            float num3 = 1f - Mathf.Pow(magnitude5 / damageRadius, 2f);
                            if (player.movement.getVehicle() != null && player.movement.getVehicle().asset != null)
                            {
                                num3 *= player.movement.getVehicle().asset.passengerExplosionArmor;
                            }
                            EPlayerKill eplayerKill;
                            DamageTool.damage(player, cause, ELimb.SPINE, killer, vector10, playerDamage, num3, out eplayerKill);
                        }
                    }
                    IL_760 :;
                }
            }
            if (damageType == EExplosionDamageType.ZOMBIE_FIRE || zombieDamage > 0.5f)
            {
                DamageTool.zombiesInRadius.Clear();
                ZombieManager.getZombiesInRadius(point, num, DamageTool.zombiesInRadius);
                for (int n = 0; n < DamageTool.zombiesInRadius.Count; n++)
                {
                    Zombie zombie = DamageTool.zombiesInRadius[n];
                    if (!(zombie == null) && !zombie.isDead)
                    {
                        if (damageType == EExplosionDamageType.ZOMBIE_FIRE)
                        {
                            if (zombie.speciality == EZombieSpeciality.NORMAL)
                            {
                                ZombieManager.sendZombieSpeciality(zombie, EZombieSpeciality.BURNER);
                            }
                        }
                        else
                        {
                            Vector3 vector11   = zombie.transform.position - point;
                            float   magnitude6 = vector11.magnitude;
                            Vector3 vector12   = vector11 / magnitude6;
                            if (magnitude6 > 0.5f)
                            {
                                RaycastHit raycastHit;
                                PhysicsUtility.raycast(new Ray(point, vector12), out raycastHit, magnitude6 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                                if (raycastHit.transform != null && raycastHit.transform != zombie.transform)
                                {
                                    goto IL_90E;
                                }
                            }
                            if (playImpactEffect)
                            {
                                EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, -vector12);
                                EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, Vector3.up);
                            }
                            EPlayerKill eplayerKill;
                            uint        num2;
                            DamageTool.damage(zombie, vector12, zombieDamage, 1f - magnitude6 / damageRadius, out eplayerKill, out num2);
                        }
                    }
                    IL_90E :;
                }
            }
            if (animalDamage > 0.5f)
            {
                DamageTool.animalsInRadius.Clear();
                AnimalManager.getAnimalsInRadius(point, num, DamageTool.animalsInRadius);
                for (int num4 = 0; num4 < DamageTool.animalsInRadius.Count; num4++)
                {
                    Animal animal = DamageTool.animalsInRadius[num4];
                    if (!(animal == null) && !animal.isDead)
                    {
                        Vector3 vector13   = animal.transform.position - point;
                        float   magnitude7 = vector13.magnitude;
                        Vector3 vector14   = vector13 / magnitude7;
                        if (magnitude7 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, vector14), out raycastHit, magnitude7 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                            if (raycastHit.transform != null && raycastHit.transform != animal.transform)
                            {
                                goto IL_A6A;
                            }
                        }
                        if (playImpactEffect)
                        {
                            EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, -vector14);
                            EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, Vector3.up);
                        }
                        EPlayerKill eplayerKill;
                        uint        num2;
                        DamageTool.damage(animal, vector14, animalDamage, 1f - magnitude7 / damageRadius, out eplayerKill, out num2);
                    }
                    IL_A6A :;
                }
            }
            if (vehicleDamage > 0.5f)
            {
                DamageTool.vehiclesInRadius.Clear();
                VehicleManager.getVehiclesInRadius(point, num, DamageTool.vehiclesInRadius);
                for (int num5 = 0; num5 < DamageTool.vehiclesInRadius.Count; num5++)
                {
                    InteractableVehicle interactableVehicle = DamageTool.vehiclesInRadius[num5];
                    if (!(interactableVehicle == null) && !interactableVehicle.isDead)
                    {
                        Vector3 vector15   = interactableVehicle.transform.position - point;
                        float   magnitude8 = vector15.magnitude;
                        Vector3 vector16   = vector15 / magnitude8;
                        if (magnitude8 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, vector16), out raycastHit, magnitude8 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0);
                            if (raycastHit.transform != null && raycastHit.transform != interactableVehicle.transform)
                            {
                                goto IL_B6C;
                            }
                        }
                        VehicleManager.damage(interactableVehicle, vehicleDamage, 1f - magnitude8 / damageRadius, false);
                    }
                    IL_B6C :;
                }
            }
            AlertTool.alert(point, alertRadius);
        }
Beispiel #15
0
        // Token: 0x060033E3 RID: 13283 RVA: 0x00151418 File Offset: 0x0014F818
        public static void explode(Vector3 point, float damageRadius, EDeathCause cause, CSteamID killer, float playerDamage, float zombieDamage, float animalDamage, float barricadeDamage, float structureDamage, float vehicleDamage, float resourceDamage, float objectDamage, out List <EPlayerKill> kills, EExplosionDamageType damageType = EExplosionDamageType.CONVENTIONAL, float alertRadius = 32f, bool playImpactEffect = true, bool penetrateBuildables = false)
        {
            DamageTool.explosionKills.Clear();
            kills = DamageTool.explosionKills;
            DamageTool.explosionRangeComparator.point = point;
            float num = damageRadius * damageRadius;

            DamageTool.regionsInRadius.Clear();
            Regions.getRegionsInRadius(point, damageRadius, DamageTool.regionsInRadius);
            int layerMask;

            if (penetrateBuildables)
            {
                layerMask = RayMasks.BLOCK_EXPLOSION_PENETRATE_BUILDABLES;
            }
            else
            {
                layerMask = RayMasks.BLOCK_EXPLOSION;
            }
            if (structureDamage > 0.5f)
            {
                DamageTool.structuresInRadius.Clear();
                StructureManager.getStructuresInRadius(point, num, DamageTool.regionsInRadius, DamageTool.structuresInRadius);
                DamageTool.structuresInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int i = 0; i < DamageTool.structuresInRadius.Count; i++)
                {
                    Transform transform = DamageTool.structuresInRadius[i];
                    if (!(transform == null))
                    {
                        ushort id;
                        if (ushort.TryParse(transform.name, out id))
                        {
                            ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id);
                            if (itemStructureAsset != null && !itemStructureAsset.proofExplosion)
                            {
                                Vector3 a         = transform.transform.position - point;
                                float   magnitude = a.magnitude;
                                Vector3 direction = a / magnitude;
                                if (magnitude > 0.5f)
                                {
                                    RaycastHit raycastHit;
                                    PhysicsUtility.raycast(new Ray(point, direction), out raycastHit, magnitude - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                                    if (raycastHit.transform != null && raycastHit.transform != transform.transform)
                                    {
                                        goto IL_17D;
                                    }
                                }
                                StructureManager.damage(transform, a.normalized, structureDamage, 1f - magnitude / damageRadius, true);
                            }
                        }
                    }
                    IL_17D :;
                }
            }
            if (resourceDamage > 0.5f)
            {
                DamageTool.resourcesInRadius.Clear();
                ResourceManager.getResourcesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.resourcesInRadius);
                DamageTool.resourcesInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int j = 0; j < DamageTool.resourcesInRadius.Count; j++)
                {
                    Transform transform2 = DamageTool.resourcesInRadius[j];
                    if (!(transform2 == null))
                    {
                        Vector3 a2         = transform2.transform.position - point;
                        float   magnitude2 = a2.magnitude;
                        Vector3 direction2 = a2 / magnitude2;
                        if (magnitude2 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, direction2), out raycastHit, magnitude2 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                            if (raycastHit.transform != null && raycastHit.transform != transform2.transform)
                            {
                                goto IL_2A2;
                            }
                        }
                        EPlayerKill eplayerKill;
                        uint        num2;
                        ResourceManager.damage(transform2, a2.normalized, resourceDamage, 1f - magnitude2 / damageRadius, 1f, out eplayerKill, out num2);
                        if (eplayerKill != EPlayerKill.NONE)
                        {
                            kills.Add(eplayerKill);
                        }
                    }
                    IL_2A2 :;
                }
            }
            if (objectDamage > 0.5f)
            {
                DamageTool.objectsInRadius.Clear();
                ObjectManager.getObjectsInRadius(point, num, DamageTool.regionsInRadius, DamageTool.objectsInRadius);
                DamageTool.objectsInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int k = 0; k < DamageTool.objectsInRadius.Count; k++)
                {
                    Transform transform3 = DamageTool.objectsInRadius[k];
                    if (!(transform3 == null))
                    {
                        InteractableObjectRubble component = transform3.GetComponent <InteractableObjectRubble>();
                        if (!(component == null))
                        {
                            if (!component.asset.rubbleProofExplosion)
                            {
                                for (byte b = 0; b < component.getSectionCount(); b += 1)
                                {
                                    Transform section = component.getSection(b);
                                    Vector3   a3      = section.position - point;
                                    if (a3.sqrMagnitude < num)
                                    {
                                        float   magnitude3 = a3.magnitude;
                                        Vector3 direction3 = a3 / magnitude3;
                                        if (magnitude3 > 0.5f)
                                        {
                                            RaycastHit raycastHit;
                                            PhysicsUtility.raycast(new Ray(point, direction3), out raycastHit, magnitude3 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                                            if (raycastHit.transform != null && raycastHit.transform != transform3.transform)
                                            {
                                                goto IL_40B;
                                            }
                                        }
                                        EPlayerKill eplayerKill;
                                        uint        num2;
                                        ObjectManager.damage(transform3, a3.normalized, b, objectDamage, 1f - magnitude3 / damageRadius, out eplayerKill, out num2);
                                        if (eplayerKill != EPlayerKill.NONE)
                                        {
                                            kills.Add(eplayerKill);
                                        }
                                    }
                                    IL_40B :;
                                }
                            }
                        }
                    }
                }
            }
            if (barricadeDamage > 0.5f)
            {
                DamageTool.barricadesInRadius.Clear();
                BarricadeManager.getBarricadesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.barricadesInRadius);
                BarricadeManager.getBarricadesInRadius(point, num, DamageTool.barricadesInRadius);
                DamageTool.barricadesInRadius.Sort(DamageTool.explosionRangeComparator);
                for (int l = 0; l < DamageTool.barricadesInRadius.Count; l++)
                {
                    Transform transform4 = DamageTool.barricadesInRadius[l];
                    if (!(transform4 == null))
                    {
                        Vector3 a4         = transform4.transform.position - point;
                        float   magnitude4 = a4.magnitude;
                        Vector3 direction4 = a4 / magnitude4;
                        if (magnitude4 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, direction4), out raycastHit, magnitude4 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                            if (raycastHit.transform != null && raycastHit.transform != transform4.transform)
                            {
                                goto IL_568;
                            }
                        }
                        ushort id2;
                        if (ushort.TryParse(transform4.name, out id2))
                        {
                            ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id2);
                            if (itemBarricadeAsset != null && !itemBarricadeAsset.proofExplosion)
                            {
                                BarricadeManager.damage(transform4, barricadeDamage, 1f - magnitude4 / damageRadius, true);
                            }
                        }
                    }
                    IL_568 :;
                }
            }
            if ((Provider.isPvP || damageType == EExplosionDamageType.ZOMBIE_ACID || damageType == EExplosionDamageType.ZOMBIE_FIRE || damageType == EExplosionDamageType.ZOMBIE_ELECTRIC) && playerDamage > 0.5f)
            {
                DamageTool.playersInRadius.Clear();
                PlayerTool.getPlayersInRadius(point, num, DamageTool.playersInRadius);
                for (int m = 0; m < DamageTool.playersInRadius.Count; m++)
                {
                    Player player = DamageTool.playersInRadius[m];
                    if (!(player == null) && !player.life.isDead)
                    {
                        if (damageType != EExplosionDamageType.ZOMBIE_FIRE || player.clothing.shirtAsset == null || !player.clothing.shirtAsset.proofFire || player.clothing.pantsAsset == null || !player.clothing.pantsAsset.proofFire)
                        {
                            Vector3 a5         = player.transform.position - point;
                            float   magnitude5 = a5.magnitude;
                            Vector3 vector     = a5 / magnitude5;
                            if (magnitude5 > 0.5f)
                            {
                                RaycastHit raycastHit;
                                PhysicsUtility.raycast(new Ray(point, vector), out raycastHit, magnitude5 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                                if (raycastHit.transform != null && raycastHit.transform != player.transform)
                                {
                                    goto IL_7AA;
                                }
                            }
                            if (playImpactEffect)
                            {
                                EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, -vector);
                                EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, Vector3.up);
                            }
                            float num3 = 1f - Mathf.Pow(magnitude5 / damageRadius, 2f);
                            if (player.movement.getVehicle() != null && player.movement.getVehicle().asset != null)
                            {
                                num3 *= player.movement.getVehicle().asset.passengerExplosionArmor;
                            }
                            EPlayerKill eplayerKill;
                            DamageTool.damage(player, cause, ELimb.SPINE, killer, vector, playerDamage, num3, out eplayerKill);
                            if (eplayerKill != EPlayerKill.NONE)
                            {
                                kills.Add(eplayerKill);
                            }
                        }
                    }
                    IL_7AA :;
                }
            }
            if (damageType == EExplosionDamageType.ZOMBIE_FIRE || zombieDamage > 0.5f)
            {
                DamageTool.zombiesInRadius.Clear();
                ZombieManager.getZombiesInRadius(point, num, DamageTool.zombiesInRadius);
                for (int n = 0; n < DamageTool.zombiesInRadius.Count; n++)
                {
                    Zombie zombie = DamageTool.zombiesInRadius[n];
                    if (!(zombie == null) && !zombie.isDead)
                    {
                        if (damageType == EExplosionDamageType.ZOMBIE_FIRE)
                        {
                            if (zombie.speciality == EZombieSpeciality.NORMAL)
                            {
                                ZombieManager.sendZombieSpeciality(zombie, EZombieSpeciality.BURNER);
                            }
                        }
                        else
                        {
                            Vector3 a6         = zombie.transform.position - point;
                            float   magnitude6 = a6.magnitude;
                            Vector3 vector2    = a6 / magnitude6;
                            if (magnitude6 > 0.5f)
                            {
                                RaycastHit raycastHit;
                                PhysicsUtility.raycast(new Ray(point, vector2), out raycastHit, magnitude6 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                                if (raycastHit.transform != null && raycastHit.transform != zombie.transform)
                                {
                                    goto IL_964;
                                }
                            }
                            if (playImpactEffect)
                            {
                                EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, -vector2);
                                EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, Vector3.up);
                            }
                            EPlayerKill eplayerKill;
                            uint        num2;
                            DamageTool.damage(zombie, vector2, zombieDamage, 1f - magnitude6 / damageRadius, out eplayerKill, out num2);
                            if (eplayerKill != EPlayerKill.NONE)
                            {
                                kills.Add(eplayerKill);
                            }
                        }
                    }
                    IL_964 :;
                }
            }
            if (animalDamage > 0.5f)
            {
                DamageTool.animalsInRadius.Clear();
                AnimalManager.getAnimalsInRadius(point, num, DamageTool.animalsInRadius);
                for (int num4 = 0; num4 < DamageTool.animalsInRadius.Count; num4++)
                {
                    Animal animal = DamageTool.animalsInRadius[num4];
                    if (!(animal == null) && !animal.isDead)
                    {
                        Vector3 a7         = animal.transform.position - point;
                        float   magnitude7 = a7.magnitude;
                        Vector3 vector3    = a7 / magnitude7;
                        if (magnitude7 > 0.5f)
                        {
                            RaycastHit raycastHit;
                            PhysicsUtility.raycast(new Ray(point, vector3), out raycastHit, magnitude7 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                            if (raycastHit.transform != null && raycastHit.transform != animal.transform)
                            {
                                goto IL_ACC;
                            }
                        }
                        if (playImpactEffect)
                        {
                            EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, -vector3);
                            EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, Vector3.up);
                        }
                        EPlayerKill eplayerKill;
                        uint        num2;
                        DamageTool.damage(animal, vector3, animalDamage, 1f - magnitude7 / damageRadius, out eplayerKill, out num2);
                        if (eplayerKill != EPlayerKill.NONE)
                        {
                            kills.Add(eplayerKill);
                        }
                    }
                    IL_ACC :;
                }
            }
            if (vehicleDamage > 0.5f)
            {
                DamageTool.vehiclesInRadius.Clear();
                VehicleManager.getVehiclesInRadius(point, num, DamageTool.vehiclesInRadius);
                for (int num5 = 0; num5 < DamageTool.vehiclesInRadius.Count; num5++)
                {
                    InteractableVehicle interactableVehicle = DamageTool.vehiclesInRadius[num5];
                    if (!(interactableVehicle == null) && !interactableVehicle.isDead)
                    {
                        if (interactableVehicle.asset != null && interactableVehicle.asset.isVulnerableToExplosions)
                        {
                            Vector3 a8         = interactableVehicle.transform.position - point;
                            float   magnitude8 = a8.magnitude;
                            Vector3 direction5 = a8 / magnitude8;
                            if (magnitude8 > 0.5f)
                            {
                                RaycastHit raycastHit;
                                PhysicsUtility.raycast(new Ray(point, direction5), out raycastHit, magnitude8 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal);
                                if (raycastHit.transform != null && raycastHit.transform != interactableVehicle.transform)
                                {
                                    goto IL_BED;
                                }
                            }
                            VehicleManager.damage(interactableVehicle, vehicleDamage, 1f - magnitude8 / damageRadius, false);
                        }
                    }
                    IL_BED :;
                }
            }
            AlertTool.alert(point, alertRadius);
        }
Beispiel #16
0
 // Token: 0x06002080 RID: 8320 RVA: 0x000B2058 File Offset: 0x000B0458
 private void OnTriggerEnter(Collider other)
 {
     if (Provider.isServer)
     {
         if (other.isTrigger)
         {
             return;
         }
         if (other.CompareTag("Debris"))
         {
             return;
         }
         float num = Mathf.Clamp(this.vehicle.speed * this.vehicle.asset.bumperMultiplier, -10f, 10f);
         if (this.reverse)
         {
             num = -num;
         }
         if (num < 3f)
         {
             return;
         }
         if (other.transform.parent.CompareTag("Vehicle"))
         {
             return;
         }
         if (other.transform.CompareTag("Player"))
         {
             if (Provider.isPvP && this.vehicle.isDriven)
             {
                 Player player = DamageTool.getPlayer(other.transform);
                 if (player != null && player.movement.getVehicle() == null && !this.vehicle.passengers[0].player.player.quests.isMemberOfSameGroupAs(player))
                 {
                     EPlayerKill eplayerKill;
                     DamageTool.damage(player, EDeathCause.ROADKILL, ELimb.SPINE, this.vehicle.passengers[0].player.playerID.steamID, base.transform.forward, (!this.instakill) ? Bumper.DAMAGE_PLAYER : 101f, num, out eplayerKill);
                     EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                     if (this.vehicle.asset.isVulnerableToBumper)
                     {
                         this.vehicle.askDamage(2, true);
                     }
                 }
             }
         }
         else if (other.transform.CompareTag("Agent"))
         {
             Zombie zombie = DamageTool.getZombie(other.transform);
             if (zombie != null)
             {
                 EPlayerKill eplayerKill2;
                 uint        num2;
                 DamageTool.damage(zombie, base.transform.forward, (!this.instakill) ? Bumper.DAMAGE_ZOMBIE : 65000f, num, out eplayerKill2, out num2);
                 EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                 if (this.vehicle.asset.isVulnerableToBumper)
                 {
                     this.vehicle.askDamage(2, true);
                 }
             }
             else
             {
                 Animal animal = DamageTool.getAnimal(other.transform);
                 if (animal != null)
                 {
                     EPlayerKill eplayerKill3;
                     uint        num3;
                     DamageTool.damage(animal, base.transform.forward, (!this.instakill) ? Bumper.DAMAGE_ANIMAL : 65000f, num, out eplayerKill3, out num3);
                     EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                     if (this.vehicle.asset.isVulnerableToBumper)
                     {
                         this.vehicle.askDamage(2, true);
                     }
                 }
             }
         }
         else
         {
             if (other.transform.CompareTag("Barricade"))
             {
                 Transform transform = other.transform;
                 while (transform.parent != LevelBarricades.models && !transform.parent.CompareTag("Vehicle"))
                 {
                     transform = transform.parent;
                 }
                 if (this.instakill && !transform.parent.CompareTag("Vehicle"))
                 {
                     DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, transform, other), true);
                     BarricadeManager.damage(transform, 65000f, num, false);
                     if (this.vehicle.asset.isVulnerableToBumper)
                     {
                         this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                     }
                 }
             }
             else if (other.transform.CompareTag("Structure"))
             {
                 if (this.instakill)
                 {
                     StructureManager.damage(other.transform, base.transform.forward, 65000f, num, false);
                     DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                     if (this.vehicle.asset.isVulnerableToBumper)
                     {
                         this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                     }
                 }
             }
             else if (other.transform.CompareTag("Resource"))
             {
                 DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                 EPlayerKill eplayerKill4;
                 uint        num4;
                 ResourceManager.damage(other.transform, base.transform.forward, (!this.instakill) ? Bumper.DAMAGE_RESOURCE : 65000f, num, 1f, out eplayerKill4, out num4);
                 if (this.vehicle.asset.isVulnerableToBumper)
                 {
                     this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                 }
             }
             else
             {
                 InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>();
                 if (componentInParent != null)
                 {
                     EPlayerKill eplayerKill5;
                     uint        num5;
                     DamageTool.damage(componentInParent.transform, base.transform.forward, componentInParent.getSection(other.transform), (!this.instakill) ? Bumper.DAMAGE_OBJECT : 65000f, num, out eplayerKill5, out num5);
                     if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f)
                     {
                         this.lastDamageImpact = Time.realtimeSinceStartup;
                         DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                         if (this.vehicle.asset.isVulnerableToBumper)
                         {
                             this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                         }
                     }
                 }
                 else if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f)
                 {
                     ObjectAsset asset = LevelObjects.getAsset(other.transform);
                     if (asset != null && !asset.isSoft)
                     {
                         this.lastDamageImpact = Time.realtimeSinceStartup;
                         DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                         if (this.vehicle.asset.isVulnerableToBumper)
                         {
                             this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                         }
                     }
                 }
             }
             if (!this.vehicle.isDead && this.vehicle.asset.isVulnerableToBumper && !other.transform.CompareTag("Border") && ((this.vehicle.asset.engine == EEngine.PLANE && this.vehicle.speed > 20f) || (this.vehicle.asset.engine == EEngine.HELICOPTER && this.vehicle.speed > 10f)))
             {
                 this.vehicle.askDamage(20000, false);
             }
         }
     }
 }
Beispiel #17
0
 // Token: 0x06002219 RID: 8729 RVA: 0x000BB8A8 File Offset: 0x000B9CA8
 private void OnTriggerEnter(Collider other)
 {
     if (other.isTrigger)
     {
         return;
     }
     if (Time.realtimeSinceStartup - this.lastActive < 0.25f)
     {
         return;
     }
     if (other.transform == base.transform.parent)
     {
         return;
     }
     if (Provider.isServer)
     {
         if (this.isExplosive)
         {
             if (other.transform.CompareTag("Player"))
             {
                 if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle"))
                 {
                     EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position);
                     List <EPlayerKill> list;
                     DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
                 }
             }
             else
             {
                 EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position);
                 List <EPlayerKill> list2;
                 DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list2, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
             }
         }
         else if (other.transform.CompareTag("Player"))
         {
             if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle"))
             {
                 Player player = DamageTool.getPlayer(other.transform);
                 if (player != null)
                 {
                     EPlayerKill eplayerKill;
                     DamageTool.damage(player, EDeathCause.SHRED, ELimb.SPINE, CSteamID.Nil, Vector3.up, this.playerDamage, 1f, out eplayerKill);
                     if (this.isBroken)
                     {
                         player.life.breakLegs();
                     }
                     EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                     BarricadeManager.damage(base.transform.parent, 5f, 1f, false);
                 }
             }
         }
         else if (other.transform.CompareTag("Agent"))
         {
             Zombie zombie = DamageTool.getZombie(other.transform);
             if (zombie != null)
             {
                 EPlayerKill eplayerKill2;
                 uint        num;
                 DamageTool.damage(zombie, base.transform.forward, this.zombieDamage, 1f, out eplayerKill2, out num);
                 EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                 BarricadeManager.damage(base.transform.parent, (!zombie.isHyper) ? 5f : 10f, 1f, false);
             }
             else
             {
                 Animal animal = DamageTool.getAnimal(other.transform);
                 if (animal != null)
                 {
                     EPlayerKill eplayerKill3;
                     uint        num2;
                     DamageTool.damage(animal, base.transform.forward, this.animalDamage, 1f, out eplayerKill3, out num2);
                     EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                     BarricadeManager.damage(base.transform.parent, 5f, 1f, false);
                 }
             }
         }
     }
 }
Beispiel #18
0
 /// <inheritdoc />
 public override void UnsafeDamage(ushort damage)
 {
     ThreadUtil.assertIsGameThread();
     BarricadeManager.damage(Model, damage, 1, false, damageOrigin: EDamageOrigin.Unknown);
 }