nivex
Recycle items into their resources

Supported Games
GameServerKingsGameServerKings
works with
used by

Recycle allows players to recycle items into their resources.

Permissions

  • recycle.use -- Allows players to use the recycler
  • recycle.admin -- Allows players to destroy all recyclers or dropped bags currently created by Recycle
  • recycle.bypass -- Allows players to bypass the cooldown of recycling

Commands

  • recycle -- Opens a recycler, can be configured
  • recycle reloadconfig -- Reloads the configuration file
  • purgerecyclers -- Destroys all recyclers and drops their contents to a locked bag at the owner's position
  • purgebags -- Destroys all bags created by Recycle

Configuration

{
  "Settings": {
    "Cooldown (in minutes)": 5.0,
    "Maximum Radiation": 1.0,
    "Refund Ratio": 0.5,
    "NPCs Only": false,
    "Allowed In Safe Zones": true,
    "Instant Recycling": false,
    "Send Recycled Items To Inventory": false,
    "Send Items To Inventory Before Bag": true,
    "Command To Open Recycler": "recycle",
    "NPC Ids": [],
    "Recyclable Types": [
      "Ammunition",
      "Attire",
      "Common",
      "Component",
      "Construction",
      "Electrical",
      "Fun",
      "Items",
      "Medical",
      "Misc",
      "Tool",
      "Traps",
      "Weapon"
    ],
    "Blacklisted Items": []
  },
  "VERSION": "3.1.3"
}

For Developers

Hooks

Invoked when checking if a recycler is safe to open.

private bool CanOpenRecycler(BasePlayer player)

API Calls

Adds an NPC to the NPC list

private void AddNPC(string npcID)

Removes an NPC from the NPC list

private void RemoveNPC(string npcID)

Checks if an entity is a recycler managed by Recycler.

private bool IsRecycleBox(BaseNetworkable entity)

Checks if a player can safely open a recycler.

private bool CanPlayerOpenRecycler(BasePlayer player)

Checks if the player is current on cooldown from using the recycler.

private bool IsOnCooldown(BasePlayer player)

Forcefully opens a recycler for the player

!! No checks are done, including calling the hook !!

private void OpenRecycler(BasePlayer player)

Credits

  • Calytic, the original author of this plugin
  • 5Dev24, for maintaining this plugin
  • nivex, for maintaining this plugin

MIT License


Copyright (c) 2020 Jake Halaska


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.