Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 8 additions & 3 deletions Recycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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<object>()),
AllowedInSafeZones = this.GetSetting("allowSafeZone", true)
AllowedInSafeZones = this.GetSetting("allowSafeZone", true),
OnlyInSafeZones = this.GetSetting("onlyInSafeZone", true)
}
};
this.UpdateAndSave();
Expand Down Expand Up @@ -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 });
}
Expand Down Expand Up @@ -490,6 +494,7 @@ public bool CanPlayerOpenRecycler(BasePlayer p) {
else if (p.GetComponentInParent<HotAirBalloon>()) this.PrintToChat(p, this.GetMessage("Denied", "Balloon", p));
else if (p.GetComponentInParent<Lift>()) 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));
Expand Down