Пример #1
0
        public static bool RepairObject(this Transform transform)
        {
            if (transform == null)
            {
                return(false);
            }

            var vehicle = transform.GetComponent <InteractableVehicle>();

            if (vehicle != null)
            {
                VehicleManager.repair(vehicle, vehicle.asset.health, 1);
                return(true);
            }

            if (transform.GetComponent <InteractableDoorHinge>() != null)
            {
                transform = transform.parent;
            }

            if (BarricadeManager.tryGetInfo(transform, out _, out _, out _, out _, out _))
            {
                BarricadeManager.repair(transform, 99999, 1);
                return(true);
            }

            if (!StructureManager.tryGetInfo(transform, out _, out _, out _, out _))
            {
                return(false);
            }

            StructureManager.repair(transform, 99999, 1);
            return(true);
        }
Пример #2
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);
     }
 }
        // WIP
        public static void RunRepairTool(UnturnedPlayer _, RaycastResult Raycast)
        {
            if (Raycast.Vehicle != null)
            {
                VehicleManager.repair(Raycast.Vehicle, 9999, 2);
            }

            if (Raycast.Barricade != null)
            {
                Raycast.Barricade.barricade.askRepair(9999);
                BarricadeManager.repair(Raycast.BarricadeRootTransform, 9999, 2);
            }
            if (Raycast.Structure != null)
            {
                Raycast.Structure.structure.askRepair(9999);
            }
        }
Пример #4
0
        public void repairBarricades()
        {
            Transform transform;
            int       transformCount = 0;

            BarricadeRegion barricadeRegion;

            for (int k = 0; k < BarricadeManager.BarricadeRegions.GetLength(0); k++)
            {
                for (int l = 0; l < BarricadeManager.BarricadeRegions.GetLength(1); l++)
                {
                    barricadeRegion = BarricadeManager.BarricadeRegions[k, l];
                    transformCount  = barricadeRegion.drops.Count;
                    for (int i = 0; i < transformCount; i++)
                    {
                        transform = barricadeRegion.drops[i].model;
                        BarricadeManager.repair(transform, 100, 1);
                    }
                }
            }
        }
Пример #5
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer p    = (UnturnedPlayer)caller;
            var            res  = new List <Transform>();
            float          dist = float.Parse(command[0]);

            res = TransformFinder.FindAll().FindAll(x => Vector3.Distance(p.Position, x.position) <= dist);
            if (res.Count > 0)
            {
                UnturnedChat.Say(caller, Plugin.Instance.Translate("search", res.Count, command[0]));
                foreach (var v in res)
                {
                    BarricadeManager.repair(v, -30000, 1);
                    StructureManager.repair(v, -30000, 1);
                }
                UnturnedChat.Say(caller, Plugin.Instance.Translate("success"));
            }
            else
            {
                UnturnedChat.Say(caller, Plugin.Instance.Translate("not_found"));
            }
        }
Пример #6
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer Player = (UnturnedPlayer)caller;
            Transform      trans  = Base.Tracer.TraceToHit(Player).transform;

            if (trans == null)
            {
                Base.Messages.CommonMessage(Utilities.Messages.CommonMessages.CNoObjectFound, caller);
                return;
            }
            InteractableVehicle vehicle = trans.gameObject.GetComponent <InteractableVehicle>();

            if (vehicle != null)
            {
                vehicle.askRepair(10000);
                UnturnedChat.Say(caller, Base.Instance.Translate("repair_vehicle"));
            }
            else
            {
                if (trans.GetComponent <InteractableDoorHinge>() != null)
                {
                    trans = trans.parent.parent;
                }

                if (BarricadeManager.tryGetInfo(trans, out byte x, out byte y, out ushort plant, out ushort index, out BarricadeRegion BarricRegion))
                {
                    BarricadeManager.repair(trans, 10000, 1);
                    UnturnedChat.Say(caller, Base.Instance.Translate("repair_object"));
                    return;
                }
                if (StructureManager.tryGetInfo(trans, out x, out y, out index, out StructureRegion StructRegion))
                {
                    StructureManager.repair(trans, 10000, 1);
                    UnturnedChat.Say(caller, Base.Instance.Translate("repair_object"));
                    return;
                }
                Base.Messages.CommonMessage(Utilities.Messages.CommonMessages.CNoObjectFound, caller);
            }
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            Transform transform;
            int       transformCount = 0;

            BarricadeRegion barricadeRegion;

            for (int k = 0; k < BarricadeManager.BarricadeRegions.GetLength(0); k++)
            {
                for (int l = 0; l < BarricadeManager.BarricadeRegions.GetLength(1); l++)
                {
                    barricadeRegion = BarricadeManager.BarricadeRegions[k, l];
                    transformCount  = barricadeRegion.drops.Count;
                    for (int i = 0; i < transformCount; i++)
                    {
                        transform = barricadeRegion.drops[i].model;
                        BarricadeManager.repair(transform, 100, 1);
                    }
                }
            }

            UnturnedChat.Say(caller, "Done repairing barricades.", Color.cyan);
        }
Пример #8
0
 /// <inheritdoc />
 public override void UnsafeHeal(ushort amount)
 {
     ThreadUtil.assertIsGameThread();
     BarricadeManager.repair(Model, amount, 1);
 }