Пример #1
0
 public static void OnEntityDestroyed(DestroyEvent de)
 {
     if (de.Attacker != null && de.Entity != null && !de.IsDecay)
     {
         if (((Fougerite.Player)de.Attacker).UID == de.Entity.UOwnerID)
         {
             return;
         }
         if ((de.WeaponName.ToLower().Contains("explosive") || de.WeaponName.ToLower().Contains("grenade") ||
              de.WeaponName.ToLower().Contains("hatchet") || de.WeaponName.ToLower().Contains("axe") ||
              de.WeaponName.ToLower().Contains("rock")) && (de.Entity.Name.ToLower().Contains("wall") ||
                                                            de.Entity.Name.ToLower().Contains("door")))
         {
             Fougerite.Entity entity = de.Entity;
             OwnerTimeData[entity.UOwnerID] = TimeSpan.FromTicks(DateTime.Now.Ticks).TotalSeconds;
             //DataStore.GetInstance().Add("LegitRaidA", ((Fougerite.Player)de.Attacker).UID, true);
             if (RaiderTime.ContainsKey(entity.UOwnerID))
             {
                 if (MaxRaidTime < RaiderTime[entity.UOwnerID] + RaidTime)
                 {
                     RaiderTime[entity.UOwnerID] = MaxRaidTime;
                     return;
                 }
                 RaiderTime[entity.UOwnerID] = RaiderTime[entity.UOwnerID] + RaidTime;
             }
             else
             {
                 RaiderTime[entity.UOwnerID] = RaidTime;
             }
         }
     }
 }
Пример #2
0
 public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     if (e.Name.ToLower().Contains("camp") || e.Name.ToLower().Contains("furnace") || e.Name.ToLower().Contains("storage") || e.Name.ToLower().Contains("box") || e.Name.ToLower().Contains("bench") || e.Name.ToLower().Contains("sleeping") || e.Name.ToLower().Contains("stash") || e.Name.ToLower().Contains("ceiling") || e.Name.ToLower().Contains("foundation"))
     {
         var location = new Vector3(e.Location.x, e.Location.y, e.Location.z);
         if (e.Name.ToLower().Contains("foundation"))
         {
             location = new Vector3(e.Location.x, e.Location.y + 6f, e.Location.z);
         }
         else if (e.Name.ToLower().Contains("bench"))
         {
             location = new Vector3(e.Location.x, e.Location.y + 1f, e.Location.z);
         }
         if (SearchForRock(location))
         {
             actualplacer.MessageFrom(Name + Version, red + "Not allowed to build so close/inside a Rock " + white + " Your " + e.Name + " has been destroyed");
             if (!actualplacer.Admin)
             {
                 e.Destroy();
             }
             else
             {
                 actualplacer.MessageFrom(Name + Version, green + "Admin Bypass ");
             }
         }
     }
 }
Пример #3
0
 public static void OnEntityHurt(HurtEvent he)
 {
     if (he.AttackerIsPlayer && he.VictimIsEntity)
     {
         if (he.Attacker != null && he.Entity != null)
         {
             Fougerite.Entity   entity = he.Entity;
             Fougerite.Player   player = (Fougerite.Player)he.Attacker;
             Data.Entities.User user   = Data.Globals.GetInternalUser(player);
             if (user.SpectingOwner)
             {
                 string OwnerName = Data.Globals.GetUserNameBySteamid(entity.OwnerID);
                 player.SendClientMessage($"Dueño: {entity.OwnerName} - {GetHouseOwner(entity.Location).ToString()}");
                 SetMaterialOfHouse(entity.Location);
                 user.SpectingOwner = false;
             }
             if (entity.Name.ToLower().Contains("box") || entity.Name.ToLower().Contains("stash"))
             {
                 if (entity.IsStorage())
                 {
                     if (entity.hasInventory)
                     {
                         if (entity.Inventory.FreeSlots < entity.Inventory.Items.Length)
                         {
                             he.DamageAmount = 0f;
                             player.Notice("No puedes destruir cofres con cosas adentro.");
                         }
                     }
                 }
             }
         }
     }
 }
Пример #4
0
 public void OnEntityDeployedWithPlacer(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     if (IsShopAround(e.Location))
     {
         actualplacer.MessageFrom(Name, red + "You cant place Storages closed to the Shop!!");
         e.Destroy();
     }
 }
Пример #5
0
        public bool IsNotEligible(Fougerite.Entity en)
        {
            if (en.IsDeployableObject())
            {
                return(false);
            }
            StructureComponent comp = (StructureComponent)en.GetObject <StructureComponent>();

            return(comp._master.ComponentCarryingWeight((StructureComponent)en.Object));
        }
Пример #6
0
 public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     if (e.Name.ToLower().Contains("Wood shelter"))
     {
         e.Destroy();
         {
             pl.MessageFrom("ShelterBlocker", "You cannot place shelters on this server");
             pl.Notice("✘", "Shelters are forbidden");
             return;
         }
     }
 }
Пример #7
0
 public void OnEntityHurt(HurtEvent he)
 {
     if (he.AttackerIsPlayer && he.VictimIsEntity)
     {
         if (he.Attacker != null && he.Entity != null)
         {
             Fougerite.Entity entity = he.Entity;
             if (entity.Name.ToLower().Contains("box") || entity.Name.ToLower().Contains("stash"))
             {
                 if (!he.WeaponName.Contains("explosive") && !he.WeaponName.Contains("grenade") &&
                     !Guns.Contains(he.WeaponName) && !OwnerTimeData.ContainsKey(entity.UOwnerID))
                 {
                     he.DamageAmount = 0f;
                 }
             }
         }
     }
 }
Пример #8
0
        public void CallBack(TimedEvent e)
        {
            var dict = e.Args;

            e.Kill();
            Fougerite.Player pl  = (Fougerite.Player)dict["player"];
            Fougerite.Entity ent = (Fougerite.Entity)dict["entity"];
            try
            {
                ent.Destroy();
            }
            catch (Exception exc)
            {
                Logger.Log(Name + " ERROR: Failed to destroy " + ent.Name + " at position " + ent.Location.ToString());
                Logger.Log(Name + exc.ToString());
            }
            if (pl.IsAlive && !pl.IsDisconnecting)
            {
                pl.Message("Your " + green + ent.Name + white + " has been removed for exceeding the maximum time allowed");
            }
        }
Пример #9
0
        public void EntityDeployed(Fougerite.Player Player, Fougerite.Entity Entity, Fougerite.Player actualplacer)
        {
            try
            {
                if (Entity != null)
                {
                    if (Entity.Name.Contains("Foundation") || Entity.Name.Contains("Ramp") ||
                        Entity.Name.Contains("Pillar") || Entity.Name == "WoodDoor" || Entity.Name == "MetalDoor")
                    {
                        string name     = Entity.Name;
                        var    location = Entity.Location;
                        if (Ramp && name.Contains("Ramp"))
                        {
                            RaycastHit cachedRaycast;
                            bool       cachedBoolean;
                            Facepunch.MeshBatch.MeshBatchInstance cachedhitInstance;
                            if (Facepunch.MeshBatch.MeshBatchPhysics.Raycast(location + new Vector3(0f, 0.1f, 0f), Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance))
                            {
                                if (cachedhitInstance != null)
                                {
                                    var cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>();
                                    if (cachedComponent.type == StructureComponent.StructureComponentType.Foundation || cachedComponent.type == StructureComponent.StructureComponentType.Ceiling)
                                    {
                                        var weight = cachedComponent._master._weightOnMe;
                                        int ramps  = 0;
                                        if (weight != null && weight.ContainsKey(cachedComponent))
                                        {
                                            ramps += weight[cachedComponent].Count(structure => structure.type == StructureComponent.StructureComponentType.Ramp);
                                        }
                                        if (ramps > 1)
                                        {
                                            Entity.Destroy();
                                            if (GiveBack && actualplacer.IsOnline)
                                            {
                                                switch (name)
                                                {
                                                case "WoodFoundation":
                                                    name = "Wood Foundation";
                                                    break;

                                                case "MetalFoundation":
                                                    name = "Metal Foundation";
                                                    break;

                                                case "WoodRamp":
                                                    name = "Wood Ramp";
                                                    break;

                                                case "MetalRamp":
                                                    name = "Metal Ramp";
                                                    break;

                                                case "WoodPillar":
                                                    name = "Wood Pillar";
                                                    break;

                                                case "MetalPillar":
                                                    name = "Metal Pillar";
                                                    break;
                                                }
                                                actualplacer.Inventory.AddItem(name, 1);
                                            }
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        if (Struct)
                        {
                            bool  isdoor = false;
                            float d      = 4.5f;
                            if (name.Contains("Pillar"))
                            {
                                d = 0.40f;
                            }
                            else if (name.Contains("Door"))
                            {
                                isdoor = true;
                                d      = 0.40f;
                            }
                            else if (name.ToLower().Contains("smallstash"))
                            {
                                d = 0.40f;
                            }
                            else if (name.Contains("Foundation"))
                            {
                                d = 4.5f;
                            }
                            else if (name.Contains("Ramp"))
                            {
                                if (!CheckForRampLoot)
                                {
                                    return;
                                }
                                d = 3.5f;
                            }
                            var x = Physics.OverlapSphere(location, d);
                            if (
                                x.Any(
                                    l =>
                                    l.name.ToLower().Contains("woodbox") || l.name.ToLower().Contains("smallstash") ||
                                    (l.name.ToLower().Contains("door") && !isdoor)))
                            {
                                Entity.Destroy();
                                if (actualplacer.IsOnline && GiveBack)
                                {
                                    switch (name)
                                    {
                                    case "WoodFoundation":
                                        name = "Wood Foundation";
                                        break;

                                    case "MetalFoundation":
                                        name = "Metal Foundation";
                                        break;

                                    case "WoodRamp":
                                        name = "Wood Ramp";
                                        break;

                                    case "MetalRamp":
                                        name = "Metal Ramp";
                                        break;

                                    case "WoodPillar":
                                        name = "Wood Pillar";
                                        break;

                                    case "MetalPillar":
                                        name = "Metal Pillar";
                                        break;

                                    case "WoodDoor":
                                        name = "Wood Door";
                                        break;

                                    case "MetalDoor":
                                        name = "Metal Door";
                                        break;
                                    }
                                    actualplacer.Inventory.AddItem(name, 1);
                                }
                                return;
                            }
                        }
                        if (BarricadePillar)
                        {
                            if (name.Contains("Pillar"))
                            {
                                if (Physics.OverlapSphere(location, 0.34f).Where(collider => collider.GetComponent <DeployableObject>() != null).Any(collider => collider.GetComponent <DeployableObject>().name.Contains("Barricade_Fence")))
                                {
                                    actualplacer.Message("Pillar Barricade glitching no esta permitido!");
                                    Entity.Destroy();
                                    if (actualplacer.IsOnline && GiveBack)
                                    {
                                        switch (name)
                                        {
                                        case "WoodPillar":
                                            name = "Wood Pillar";
                                            break;

                                        case "MetalPillar":
                                            name = "Metal Pillar";
                                            break;
                                        }
                                        actualplacer.Inventory.AddItem(name, 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogDebug("[GlitchFix] Some error showed up. Report this. " + ex);
            }
        }
Пример #10
0
        public HurtEvent(ref DamageEvent d)
        {
            //Logger.LogDebug(string.Format("[DamageEvent] {0}", d.ToString()));
            try
            {
                this._sleeper    = false;
                this.DamageEvent = d;
                this.WeaponData  = null;
                this.IsDecay     = false;
                this._status     = d.status;
                string weaponName = "Unknown";
                if (d.victim.idMain is DeployableObject)
                {
                    if (d.victim.id.ToString().ToLower().Contains("sleeping"))
                    {
                        this._sleeper = true;
                        DeployableObject sleeper = (DeployableObject)d.victim.idMain;
                        this.Victim = new Sleeper(sleeper);
                    }
                    else
                    {
                        this.Victim        = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                        this._ent          = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                        this._entityvictim = true;
                    }
                    this._playervictim = false;
                }
                else if (d.victim.idMain is StructureComponent)
                {
                    this.Victim        = new Entity(d.victim.idMain.GetComponent <StructureComponent>());
                    this._ent          = new Entity(d.victim.idMain.GetComponent <StructureComponent>());
                    this._playervictim = false;
                    this._entityvictim = true;
                }
                else if (d.victim.id is SpikeWall)
                {
                    this._playerattacker = false;
                    this.Victim          = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                    this._ent            = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                    this._entityvictim   = true;
                }
                else if (d.victim.client != null)
                {
                    this.Victim        = !Fougerite.Server.Cache.ContainsKey(d.victim.client.userID) ? Fougerite.Player.FindByPlayerClient(d.attacker.client) : Fougerite.Server.Cache[d.victim.client.userID];
                    this._playervictim = true;
                }
                else if (d.victim.character != null)
                {
                    this.Victim        = new NPC(d.victim.character);
                    this._npcvictim    = true;
                    this._playervictim = false;
                }
                if (!(bool)d.attacker.id)
                {
                    if (d.victim.client != null)
                    {
                        weaponName           = this.DamageType;
                        this._playerattacker = false;
                        this.Attacker        = null;
                    }
                }
                else if (d.attacker.id is SpikeWall)
                {
                    this._playerattacker = false;
                    this.Attacker        = new Entity(d.attacker.idMain.GetComponent <DeployableObject>());
                    this._entityattacker = true;
                    weaponName           = d.attacker.id.ToString().Contains("Large") ? "Large Spike Wall" : "Spike Wall";
                }
                else if (d.attacker.id is SupplyCrate)
                {
                    this._playerattacker = false;
                    this.Attacker        = new Entity(d.attacker.idMain.gameObject);
                    this._entityattacker = true;
                    weaponName           = "Supply Crate";
                }
                else if (d.attacker.id is Metabolism && d.victim.id is Metabolism)
                {
                    this.Attacker            = !Fougerite.Server.Cache.ContainsKey(d.attacker.client.userID) ? Fougerite.Player.FindByPlayerClient(d.attacker.client) : Fougerite.Server.Cache[d.attacker.client.userID];
                    this._playerattacker     = false;
                    this._metabolismattacker = true;
                    this.Victim = this.Attacker;
                    ICollection <string> list = new List <string>();
                    Fougerite.Player     vic  = this.Victim as Fougerite.Player;
                    if (vic.IsStarving)
                    {
                        list.Add("Starvation");
                    }
                    if (vic.IsRadPoisoned)
                    {
                        list.Add("Radiation");
                    }
                    if (vic.IsPoisoned)
                    {
                        list.Add("Poison");
                    }
                    if (vic.IsBleeding)
                    {
                        list.Add("Bleeding");
                    }

                    if (list.Contains("Bleeding"))
                    {
                        if (this.DamageType != "Unknown" && !list.Contains(this.DamageType))
                        {
                            list.Add(this.DamageType);
                        }
                    }
                    weaponName = list.Count > 0 ? string.Format("Self ({0})", string.Join(",", list.ToArray())) : this.DamageType;
                }
                else if (d.attacker.client != null)
                {
                    if (!Fougerite.Server.Cache.ContainsKey(d.attacker.client.userID))
                    {
                        this.Attacker = Fougerite.Player.FindByPlayerClient(d.attacker.client);
                    }
                    else
                    {
                        this.Attacker = Fougerite.Server.Cache[d.attacker.client.userID];
                    }
                    this._playerattacker = true;
                    if (d.extraData != null)
                    {
                        WeaponImpact extraData = d.extraData as WeaponImpact;
                        this.WeaponData = extraData;
                        if (extraData != null && extraData.dataBlock != null)
                        {
                            weaponName = extraData.dataBlock.name;
                        }
                    }
                    else
                    {
                        if (d.attacker.id is TimedExplosive)
                        {
                            weaponName = "Explosive Charge";
                        }
                        else if (d.attacker.id is TimedGrenade)
                        {
                            weaponName = "F1 Grenade";
                        }
                        else
                        {
                            weaponName = "Hunting Bow";
                        }
                        if (d.victim.client != null)
                        {
                            if (!d.attacker.IsDifferentPlayer(d.victim.client) && !(this.Victim is Entity))
                            {
                                weaponName = "Fall Damage";
                            }
                            else if (!d.attacker.IsDifferentPlayer(d.victim.client) && (this.Victim is Entity))
                            {
                                weaponName = "Hunting Bow";
                            }
                        }
                    }
                }
                else if (d.attacker.character != null)
                {
                    this.Attacker        = new NPC(d.attacker.character);
                    this._playerattacker = false;
                    this._npcattacker    = true;
                    weaponName           = string.Format("{0} Claw", (this.Attacker as NPC).Name);
                }
                this.WeaponName = weaponName;
            }
            catch (Exception ex)
            {
                Logger.LogDebug(string.Format("[HurtEvent] Error. " + ex.ToString()));
            }
        }
Пример #11
0
 public DecayEvent(Fougerite.Entity en, ref float dmg)
 {
     this.Entity       = en;
     this.DamageAmount = dmg;
 }
Пример #12
0
 public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     /*
      * //Informacion extra (solo devs)
      * if (actualplacer.Admin)
      * {
      *  actualplacer.MessageFrom(Name, "Name: " + e.Name);
      *  actualplacer.MessageFrom(Name, "Dis: " + Convert.ToDouble(World.GetWorld().GetGroundDist(e.Location)));
      * }
      * // ***********************
      */
     if (e.Name == "Wood_Shelter" || e.Name == "Campfire" || e.Name == "Wood Barricade" || e.Name == "Workbench")
     {
         var dict = new Dictionary <string, object>();
         dict["entity"] = e;
         dict["player"] = actualplacer;
         if (e.Name == "Wood_Shelter" && DecayShelter)
         {
             actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayShelter + " minutes");
             Timer1(TimeDecayShelter * 60000, dict).Start();
         }
         else if (e.Name == "Campfire" && DecayCampFire)
         {
             if (DeleteOnlyCampFireOnGround)
             {
                 var distance = World.GetWorld().GetGroundDist(e.Location);
                 var dis      = Convert.ToDouble(distance);
                 if (dis < 0.20)
                 {
                     actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayCampFire + " minutes");
                     Timer1(TimeDecayCampFire * 60000, dict).Start();
                 }
             }
             else
             {
                 actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayCampFire + " minutes");
                 Timer1(TimeDecayCampFire * 60000, dict).Start();
             }
         }
         else if (e.Name == "Wood Barricade" && DecayBarricade)
         {
             if (DeleteOnlyBarricadeOnGround)
             {
                 var distance = World.GetWorld().GetGroundDist(e.Location);
                 var dis      = Convert.ToDouble(distance);
                 if (dis < 0.20)
                 {
                     actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayBarricade + " minutes");
                     Timer1(TimeDecayBarricade * 60000, dict).Start();
                 }
             }
             else
             {
                 actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayBarricade + " minutes");
                 Timer1(TimeDecayBarricade * 60000, dict).Start();
             }
         }
         else if (e.Name == "Workbench" && DecayWorkBench)
         {
             if (DeleteOnlyWorkBenchOnGround)
             {
                 var distance = World.GetWorld().GetGroundDist(e.Location);
                 var dis      = Convert.ToDouble(distance);
                 if (dis < 0.20)
                 {
                     actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayBarricade + " minutes");
                     Timer1(TimeDecayWorkBench * 60000, dict).Start();
                 }
             }
             else
             {
                 actualplacer.MessageFrom(Name, "This " + orange + e.Name + white + " will be removed automatically in " + TimeDecayBarricade + " minutes");
                 Timer1(TimeDecayWorkBench * 60000, dict).Start();
             }
         }
     }
 }
Пример #13
0
 public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     HasRustPP = true;
     if (HasRustPP == true)
     {
         foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 25f))
         {
             if (e.Name == "WoodFoundation")
             {
                 if (xx.Name == "WoodFoundation")
                 {
                     if (xx.OwnerID == actualplacer.SteamID)
                     {
                     }
                     else
                     {
                         var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                         if (friendc.ContainsKey(xx.UOwnerID))
                         {
                             var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                             bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                             if (isfriend)
                             {
                             }
                             else
                             {
                                 e.Destroy();
                                 {
                                     actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                     actualplacer.Inventory.AddItem(e.Name, 1);
                                     actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("bench"))
                 {
                     if (xx.OwnerID == actualplacer.SteamID)
                     {
                         break;
                     }
                     else
                     {
                         var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                         if (friendc.ContainsKey(xx.UOwnerID))
                         {
                             var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                             bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                             if (isfriend)
                             {
                                 break;
                             }
                             else
                             {
                                 e.Destroy();
                                 {
                                     actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                     actualplacer.Inventory.AddItem(e.Name, 1);
                                     actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("spike"))
                 {
                     if (xx.OwnerID == actualplacer.SteamID)
                     {
                         break;
                     }
                     else
                     {
                         var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                         if (friendc.ContainsKey(xx.UOwnerID))
                         {
                             var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                             bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                             if (isfriend)
                             {
                                 break;
                             }
                             else
                             {
                                 e.Destroy();
                                 {
                                     actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                     actualplacer.Inventory.AddItem(e.Name, 1);
                                     actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("sleepingbaga"))
                 {
                     if (!AllowSleepingBags)
                     {
                         if (xx.OwnerID == actualplacer.SteamID)
                         {
                             break;
                         }
                         else
                         {
                             var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                             if (friendc.ContainsKey(xx.UOwnerID))
                             {
                                 var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                                 bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                                 if (isfriend)
                                 {
                                     break;
                                 }
                                 else
                                 {
                                     e.Destroy();
                                     {
                                         actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                         actualplacer.Inventory.AddItem(e.Name, 1);
                                         actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                     }
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("bed"))
                 {
                     if (!AllowBeds)
                     {
                         if (xx.OwnerID == actualplacer.SteamID)
                         {
                             break;
                         }
                         else
                         {
                             var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                             if (friendc.ContainsKey(xx.UOwnerID))
                             {
                                 var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                                 bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                                 if (isfriend)
                                 {
                                     break;
                                 }
                                 else
                                 {
                                     e.Destroy();
                                     {
                                         actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                         actualplacer.Inventory.AddItem(e.Name, 1);
                                         actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                     }
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("barricade"))
                 {
                     if (!AllowBarricade)
                     {
                         if (xx.OwnerID == actualplacer.SteamID)
                         {
                             break;
                         }
                         else
                         {
                             var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                             if (friendc.ContainsKey(xx.UOwnerID))
                             {
                                 var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                                 bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                                 if (isfriend)
                                 {
                                     break;
                                 }
                                 else
                                 {
                                     e.Destroy();
                                     {
                                         actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                         actualplacer.Inventory.AddItem(e.Name, 1);
                                         actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                     }
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("storage"))
                 {
                     if (!AllowBoxes)
                     {
                         if (xx.OwnerID == actualplacer.SteamID)
                         {
                             break;
                         }
                         else
                         {
                             var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                             if (friendc.ContainsKey(xx.UOwnerID))
                             {
                                 var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                                 bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                                 if (isfriend)
                                 {
                                     break;
                                 }
                                 else
                                 {
                                     e.Destroy();
                                     {
                                         actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                         actualplacer.Inventory.AddItem(e.Name, 1);
                                         actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                     }
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("gate"))
                 {
                     if (xx.OwnerID == actualplacer.SteamID)
                     {
                         break;
                     }
                     else
                     {
                         var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                         if (friendc.ContainsKey(xx.UOwnerID))
                         {
                             var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                             bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                             if (isfriend)
                             {
                                 break;
                             }
                             else
                             {
                                 e.Destroy();
                                 {
                                     actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                     actualplacer.Inventory.AddItem(e.Name, 1);
                                     actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                 }
                             }
                         }
                     }
                 }
                 else if (e.Name.ToLower().Contains("ramp"))
                 {
                     if (!AllowRamps)
                     {
                         if (xx.OwnerID == actualplacer.SteamID)
                         {
                             break;
                         }
                         else
                         {
                             var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists();
                             if (friendc.ContainsKey(xx.UOwnerID))
                             {
                                 var  fs       = (RustPP.Social.FriendList)friendc[xx.UOwnerID];
                                 bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID);
                                 if (isfriend)
                                 {
                                     break;
                                 }
                                 else
                                 {
                                     e.Destroy();
                                     {
                                         actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here");
                                         actualplacer.Inventory.AddItem(e.Name, 1);
                                         actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #14
0
 public DoorEvent(Fougerite.Entity e)
 {
     this.Open   = false;
     this.Entity = e;
 }
Пример #15
0
        public void EntityDeployed(Fougerite.Player Player, Fougerite.Entity Entity)
        {
            if (Entity != null)
            {
                if (Entity.Name.Contains("Foundation") || Entity.Name.Contains("Ramp") || Entity.Name.Contains("Pillar"))
                {
                    string             name       = Entity.Name;
                    var                location   = Entity.Location;
                    DeployableObject[] deploylist = UnityEngine.Object.FindObjectsOfType(typeof(DeployableObject)) as DeployableObject[];
                    if (deploylist != null && deploylist.Where(ent => ent.name.Contains("WoodBox") || ent.name.Contains("Stash")).Any(ent => !(Util.GetUtil().GetVectorsDistance(location, ent.gameObject.transform.position) > 3.7)))
                    {
                        if (Player.IsOnline && GiveBack)
                        {
                            switch (name)
                            {
                            case "WoodFoundation":
                                name = "Wood Foundation";
                                break;

                            case "MetalFoundation":
                                name = "Metal Foundation";
                                break;

                            case "WoodRamp":
                                name = "Wood Ramp";
                                break;

                            case "MetalRamp":
                                name = "Metal Ramp";
                                break;

                            case "WoodPillar":
                                name = "Wood Pillar";
                                break;

                            case "MetalPillar":
                                name = "Metal Pillar";
                                break;
                            }
                            Player.Inventory.AddItem(name, 1);
                        }
                        Entity.Destroy();
                        return;
                    }
                    StructureComponent[] structurelist = UnityEngine.Object.FindObjectsOfType(typeof(StructureComponent)) as StructureComponent[];
                    if (structurelist != null && structurelist.Where(structure => structure.name.Contains("Ramp") && Entity.InstanceID != structure.GetInstanceID()).Any(structure => Util.GetUtil().GetVectorsDistance(location, structure.gameObject.transform.position) == 0))
                    {
                        if (GiveBack && Player.IsOnline)
                        {
                            switch (name)
                            {
                            case "WoodFoundation":
                                name = "Wood Foundation";
                                break;

                            case "MetalFoundation":
                                name = "Metal Foundation";
                                break;

                            case "WoodRamp":
                                name = "Wood Ramp";
                                break;

                            case "MetalRamp":
                                name = "Metal Ramp";
                                break;

                            case "WoodPillar":
                                name = "Wood Pillar";
                                break;

                            case "MetalPillar":
                                name = "Metal Pillar";
                                break;
                            }
                            Player.Inventory.AddItem(name, 1);
                        }
                        Entity.Destroy();
                        return;
                    }
                }
            }
        }
Пример #16
0
        void EntityDeployed(Fougerite.Player Player, Fougerite.Entity Entity)
        {
            if (Config.GetSetting("Settings", "enabled").ToLower() == "true" && Entity != null)
            {
                if (Entity.Name == "WoodFoundation" || Entity.Name == "MetalFoundation" || Entity.Name == "WoodRamp" || Entity.Name == "MetalRamp")
                {
                    var  name     = Entity.Name;
                    bool GiveBack = Config.GetSetting("Settings", "giveback").ToLower() == "true";
                    var  two      = Util.GetUtil().CreateVector(Entity.X, Entity.Y, Entity.Z);
                    foreach (Entity ent in World.GetWorld().Entities)
                    {
                        var one  = Util.GetUtil().CreateVector(ent.X, ent.Y, ent.Z);
                        var dist = Util.GetUtil().GetVectorsDistance(one, two);

                        if (ent.Name == "WoodRamp" || ent.Name == "MetalRamp")
                        {
                            if (Entity != ent && Entity.InstanceID != ent.InstanceID && dist == 0)
                            {
                                if (GiveBack && Player != null)
                                {
                                    if (name == "WoodRamp")
                                    {
                                        name = "Wood Ramp";
                                    }
                                    else if (name == "MetalRamp")
                                    {
                                        name = "Metal Ramp";
                                    }
                                    Player.Inventory.AddItem(name, 1);
                                }
                                Entity.Destroy();
                                return;
                            }
                        }
                        else if (ent.Name != "WoodRamp" && ent.Name != "MetalRamp" && ent.Name != "WoodFoundation" && ent.Name != "WoodDoorFrame" && ent.Name != "WoodWall" && ent.Name != "WoodPillar" && ent.Name != "WoodCeiling" && ent.Name != "MetalDoor" && ent.Name != "WoodStairs" && ent.Name != "WoodWindowFrame" && ent.Name != "MetalFoundation" && ent.Name != "MetalDoorFrame" && ent.Name != "MetalWall" && ent.Name != "MetalPillar" && ent.Name != "MetalCeiling" && ent.Name != "MetalStairs" && ent.Name != "MetalWindowFrame" && ent.Name != "Wood_Shelter" && ent.Name != "Barricade_Fence_Deployable" && ent.Name != "Wood Box" && ent.Name != "Metal Bars Window" && ent.Name != "CampFire" && ent.Name != "Wood Spike Wall" && ent.Name != "Large Wood Spike Wall")
                        {
                            if (Entity != ent && Entity.InstanceID != ent.InstanceID && dist <= 2.5)
                            {
                                if (Player != null)
                                {
                                    Player.Notice("Ya can't place chest under foundation bitch!");
                                    if (GiveBack)
                                    {
                                        if (name == "WoodFoundation")
                                        {
                                            name = "Wood Foundation";
                                        }
                                        else if (name == "MetalFoundation")
                                        {
                                            name = "Metal Foundation";
                                        }
                                        Player.Inventory.AddItem(name, 1);
                                    }
                                }
                                Entity.Destroy();
                                return;
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
 public HurtEvent(ref DamageEvent d, Fougerite.Entity en)
     : this(ref d)
 {
     this.Entity = en;
 }
Пример #18
0
 public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer)
 {
     if (e.Name == "Wood_Shelter")
     {
         if (BlockShelterCloseToDoor)
         {
             foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 5f))
             {
                 if (xx.Name == "WoodDoorFrame")
                 {
                     e.Destroy();
                     pl.MessageFrom(sys, orange + "You cannot place Wood Shelter so close to DoorWays");
                 }
                 else if (xx.Name == "MetalDoorFrame")
                 {
                     e.Destroy();
                     pl.MessageFrom(sys, orange + "You cannot place Wood Shelter so close to DoorWays");
                 }
             }
         }
     }
     else if (e.Name.ToLower().Contains("spike"))
     {
         if (BlockSpikeCloseToDoor)
         {
             foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 5f))
             {
                 if (xx.Name == "WoodDoorFrame")
                 {
                     if (xx.OwnerID == pl.SteamID)
                     {
                         return;
                     }
                     else
                     {
                         e.Destroy();
                         pl.MessageFrom(sys, orange + "You cannot place " + e.Name + " so close to doorways");
                     }
                 }
                 else if (xx.Name == "MetalDoorFrame")
                 {
                     if (xx.OwnerID == pl.SteamID)
                     {
                         return;
                     }
                     else
                     {
                         e.Destroy();
                         pl.MessageFrom(sys, orange + "You cannot place " + e.Name + " so close to doorways");
                     }
                 }
             }
         }
     }
     else if (e.Name.ToLower().Contains("barricade"))
     {
         if (BlockBarricadeCloseToDoor)
         {
             foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 5f))
             {
                 if (xx.Name == "WoodDoorFrame")
                 {
                     if (xx.OwnerID == pl.SteamID)
                     {
                         return;
                     }
                     else
                     {
                         e.Destroy();
                         pl.MessageFrom(sys, orange + "You cannot place " + e.Name + " so close to doorways");
                     }
                 }
                 else if (xx.Name == "MetalDoorFrame")
                 {
                     if (xx.OwnerID == pl.SteamID)
                     {
                         return;
                     }
                     else
                     {
                         e.Destroy();
                         pl.MessageFrom(sys, orange + "You cannot place " + e.Name + " so close to doorways");
                     }
                 }
             }
         }
         else if (e.Name == "WoodGate")
         {
             if (AntiGatewayStag)
             {
                 foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 3f))
                 {
                     if (xx.Name == "WoodGate")
                     {
                         e.Destroy();
                         {
                             pl.MessageFrom(sys, orange + "You cannot double the Gates on this server :)");
                         }
                     }
                 }
             }
         }
     }
 }