From d7256752c9bc3defc2e35c84bd602c1705621ec6 Mon Sep 17 00:00:00 2001 From: Joel Doyle Date: Thu, 2 Jun 2022 12:51:51 -0500 Subject: [PATCH 1/2] Only In Safe Zones Option --- README.md | 1 + Recycle.cs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6435058..5f43654 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ "Refund Ratio": 0.5, "NPCs Only": false, "Allowed In Safe Zones": true, + "Only In Safe Zones": false, "Instant Recycling": false, "Send Recycled Items To Inventory": false, "Send Items To Inventory Before Bag": true, diff --git a/Recycle.cs b/Recycle.cs index 9149a34..b6af344 100644 --- a/Recycle.cs +++ b/Recycle.cs @@ -8,7 +8,7 @@ namespace Oxide.Plugins { - [Info("Recycle", "5Dev24", "3.0.4")] + [Info("Recycle", "5Dev24", "3.0.5")] [Description("Recycle items into their resources")] public class Recycle : RustPlugin { @@ -159,6 +159,7 @@ private void LoadMessages() { { "Denied -> Elevator", youCannot("on an elevator") }, { "Denied -> Balloon", youCannot("on a balloon") }, { "Denied -> Safe Zone", youCannot("in a safe zone") }, + { "Denied -> Only Safe Zone", "You must be in a safe zone to use the recycler" }, { "Denied -> Hook Denied", "You can't recycle right now" }, { "Cooldown -> In", "You need to wait {0} before recycling" }, { "Timings -> second", "second" }, @@ -234,6 +235,8 @@ public class SettingsWrapper { public bool NPCOnly = false; [JsonProperty("Allowed In Safe Zones")] public bool AllowedInSafeZones = true; + [JsonProperty("Only In Safe Zones")] + public bool OnlyInSafeZones = false; [JsonProperty("Instant Recycling")] public bool InstantRecycling = false; [JsonProperty("Send Recycled Items To Inventory")] @@ -296,7 +299,8 @@ private void ValidateConfig() { "Ammunition", "Attire", "Common", "Component", "Construction", "Electrical", "Fun", "Items", "Medical", "Misc", "Tool", "Traps", "Weapon" }), Blacklist = this.GetSetting("blacklist", new List()), - AllowedInSafeZones = this.GetSetting("allowSafeZone", true) + AllowedInSafeZones = this.GetSetting("allowSafeZone", true), + OnlyInSafeZones = this.GetSetting("onlyInSafeZone", true) } }; this.UpdateAndSave(); @@ -342,7 +346,7 @@ private void OpenContainer(BasePlayer p, StorageContainer con) { p.EndLooting(); if (!p.inventory.loot.StartLootingEntity(con, false)) return; p.inventory.loot.AddContainer(con.inventory); - p.inventory.loot.SendImmediate(); + //p.inventory.loot.SendImmediate(); p.ClientRPCPlayer(null, p, "RPC_OpenLootPanel", con.panelName); p.SendNetworkUpdate(); }); @@ -382,7 +386,7 @@ private void DropRecyclerContents(BaseEntity e) { bag.enableSaving = false; bag.TakeFrom(r.inventory); bag.Spawn(); - bag.lootPanelName = "smallwoodbox"; + bag.lootPanelName = "generic_resizable"; bag.playerSteamID = p.userID; this.DroppedBags.Add(bag.net.ID, new EntityAndPlayer { Entity = bag, Player = p }); } @@ -490,6 +494,7 @@ public bool CanPlayerOpenRecycler(BasePlayer p) { else if (p.GetComponentInParent()) this.PrintToChat(p, this.GetMessage("Denied", "Balloon", p)); else if (p.GetComponentInParent()) this.PrintToChat(p, this.GetMessage("Denied", "Elevator", p)); else if (!this.Data.Settings.AllowedInSafeZones && p.InSafeZone()) this.PrintToChat(p, this.GetMessage("Denied", "Safe Zone", p)); + else if (this.Data.Settings.OnlyInSafeZones && !p.InSafeZone()) this.PrintToChat(p, this.GetMessage("Denied", "Only Safe Zone", p)); else { object ret = Interface.Call("CanOpenRecycler", p); if (ret != null && ret is bool && !((bool) ret)) this.PrintToChat(p, this.GetMessage("Denied", "Hook Denied", p)); @@ -529,4 +534,4 @@ public void RemoveNPC(string id) { } -} +} \ No newline at end of file From d6d3fd48a637fd5de80985550939a56a661fb7e1 Mon Sep 17 00:00:00 2001 From: Joel Doyle Date: Sat, 4 Jun 2022 11:33:32 -0500 Subject: [PATCH 2/2] Restore Commented Line --- Recycle.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Recycle.cs b/Recycle.cs index b6af344..dfe5592 100644 --- a/Recycle.cs +++ b/Recycle.cs @@ -346,7 +346,7 @@ private void OpenContainer(BasePlayer p, StorageContainer con) { p.EndLooting(); if (!p.inventory.loot.StartLootingEntity(con, false)) return; p.inventory.loot.AddContainer(con.inventory); - //p.inventory.loot.SendImmediate(); + p.inventory.loot.SendImmediate(); p.ClientRPCPlayer(null, p, "RPC_OpenLootPanel", con.panelName); p.SendNetworkUpdate(); }); @@ -534,4 +534,4 @@ public void RemoveNPC(string id) { } -} \ No newline at end of file +}