Configurable online and/or offline raid protection at the cost of a resource

Supported Games

NOTE: This is a new version of the previously titled plugin Scrap Raid Protection. I renamed it as scrap is no longer the only way you can pay for protection! Make sure to remove the ScrapRaidProtection plugin from your plugins folder before installing RaidProtection!

Features

  • Protect Your Base (for a price)
    • Players can choose to receive raid protection at the cost of some resource, by default this that resource is Scrap in their toolcupboard, but can be configured to be any item, Economics currency, or Server Rewards RP.
  • Different Levels of Protection
    • You can configure multiple levels of protection by using permissions
    • For example you can have protection level 1 provide 50% protection, but protection level 2 (for VIP players) offers 75% protection
  • Offline and/or Online Protection
    • Protection can be configured to only be available when all authorized players are offline, or online if you prefer, or mix and match them!
  • Economics and Server Rewards Compatible
    • Integration with Economics or Server Rewards is available to match the needs of your server
  • Charge Scrap on Damage Taken
    • If you want to offer protection, but still give the most determined raiders a chance, you can set it so each damage dealt to the structure deducts some protection balance. When their balance is depleted, BOOM, unprotected.
  • Intiutive and Vanilla Friendly UI
    • Provides a simple UI that blends nicely with the default look of Rust
    • An optional indicator shows players if their structure is currently protected

Usage

General Usage

In order to protect a structure, the following requirements must be met:

  • Atleast one player that is authorized on the toolcupboard has the raidprotection.level.X permission
  • So if multiple people with different levels of protection are authorized on a toolcupboard, it will select the highest protection level among the players (even if that level has worse stat, so setup your protection levels accordingly!)
  • There is atleast a protection balance of atleast 1.
  • The structure has not recently taken damage.
    • If it has, protection will start after the amount of time designated in the config, by default this is 10 seconds.
Protection Levels
  • You can define any number of protection levels in the configuration file.

  • Each protection level can offer its own online and offline protection percentages as well as optional cost overrides from the default values.

  • Players can be assigned a protection level with the raidprotection.level.X permission, where the X is the level of protection.

  • Here is an example of multiple protection levels, each with their own costs.

    "Protection levels": {
       "0": {
         "Online protection percentage (0-100)": 0.0,
         "Offline protection percentage (0-100)": 100.0
       },
       "1": {
         "Online protection percentage (0-100)": 100.0,
         "Offline protection percentage (0-100)": 100.0,
         "Hourly building cost" : 10,
         "Hourly base cost" : 90,
         "Cost per damage": 0.1
       }
    },
    
    • As you can see there is no cost settings specified for protection level 0, this level will use the default values specified in the Cost Settings section.
    • Protection level 1 on the other hand has its own settings specified, it will use these settings instead of the ones in the Cost settings section.
    • In addition protection level 0 only offers Offline protection, but is at the affordable default price of 1 per building block and 9 fixed price per hour.
    • Protection level 1 offers both online and offline protection, but is much more expensive with 10 building cost, and 90 fixed price cost per hour.
Raiding Protected Bases
  • There are multiple ways you can configure this plugin to allow raiding to occur even when bases are protected.
  • Each protected base will have a protection balance. Once this protection balance reaches 0, the base will become unprotected, and therefore will be open for raiding.
    • Protection balances can be depleted naturally over time as they are charged hourly based on the values defined for Hourly building cost and Hourly base cost.
    • Protection balances can also be depleted by raiders if the Structure damage cost setting is greater than 0 for the protected base. If so, then raiders will deduct some amount of the protection balance every time they deal damage to a protected entity in the structure.
Offline and Online Only Protection
  • You can configure players to only receive protection while offline or conversely only receive protection while online by modifying the Online protection percentage and Offline protection percentage values for a given protection level.
Economics and Server Rewards
  • If you have either of these plugins installed on your server and have the Use economics balance or Use reward points settings enabled respectively, then protection balances will be based on those currencies instead of in game items.
  • If you have both of these settings enabled, then one of them will be disabled (see the console logs for warnings).

Permissions

  • raidprotection.level.X - Sets the protection level for a player
    • The X should be a number corresponding to a protection level defined in the configuration file
    • So for example, raidprotection.level.0 will assign a player the lowest protection level
    • If a player is assigned multiple protection levels, the highest one is the one that will be used (even if its worse)
  • raidprotection.admin - Allows the player to see full information with the /protection command, even when they are not authorized in the building zone. NOTE: If you have this permission, then you will NOT count as an authorized player for a toolcupboard. Revoke this permission if you wish to receive protection.

Commands

  • /protection - Displays protection information on the current building zone. Players who are authed in that zone will see full information while unauthed players will see only limited details.

Configuration

Be sure to always delete your old configuration file if you are upgrading from an older minor release!

General Settings
  • Currency item ID:
  • Use economics balance:
    • If set to true then the currency from the Economics plugin will be used instead of the item specified by Currency item ID
  • Use reward points:
    • If set to true then the currency from the Server Rewards plugin will be used instead of the item specified by Currency item ID
Protection Settings
  • Protection levels:
    • You can define any number of Protection Levels which can be assigned to a player (see permissions). A protection level can have the following attributes:
      • Online protection percentage:
        • The amount of protection a protected area receives when atleast one of its authorized players is online. Must be a number between 0 - 100.
      • Offline protection percentage:
        • The amount of protection a protected area receives when all of the authorized players are offline. Must be a number between 0 - 100.
    • Hourly building cost (optional):
      • Overrides the default hourly building cost.
    • Hourly base cost (optional):
      • Overrides the default hourly base cost.
    • Structure damage cost (optional):
      • Overrides the default structure damage cost.
  • Delay after taking damage:
    • The amount of delay in seconds after taking damage before protection can be started.
  • Delay for offline protection:
    • The amount of delay in seconds after the last authorized player disconnects before offline protection begins. (Only applicable if they have no Online protection and do have Offline protection).
  • Protect buildings and deployables:
    • If set to true then all building blocks, containers, and deployables (excluding traps and electronics) will be protected.
  • Protect players:
    • If set to true then all players in the building area will be protected.
  • Protect vehicles and horses:
    • If set to true then all vehicles and mountable entities (such as horses) will be protected.
Cost Settings
  • Material cost multipliers:
    • You can set multipliers for each material used to amplify the value set by Hourly building cost.
  • Default hourly building cost:
    • The cost per hour players are charged based on the size of their base. Only blocks that provide surface area, such as foundations and floors, are charged this price per hour. For example, a 2x2 building will be charged for 8 blocks (4 foundations and 4 floors).
  • Default hourly base cost:
    • The fixed-price cost per hour players are charged on top of other costs (such as building cost).
  • Default structure damage cost:
    • The amount that is deducted per damage from the protection balance whenever a protected structure takes damage. For example, if a Rocket deals 350 damage to a protected structure and this value is set to 0.1 then 0.1 * 350 = 35 scrap will be deducted from the tool cupboard. Setting this value to 0 will disable this feature
Indicator Settings
  • Enabled:
    • If set to true then an indicator will appear in the top-right when players attempt to deal damage to a protected structure. This indicator will only appear every few seconds to reduce spamming.
  • Persistent:
    • If set to true then the indicator will always appear when within a building blocked zone. If you are authorized on the toolcupboard it will always show, if you are not authorized it will only show when protected. If set to false then the indicator will only appear when the protection status changes or when an entity is protected from attempted damage.
  • Image url:
    • The url of the image the indicator will use.

Preset Configs

These are configuration files that have been tailored and balanced for specific server types. These can be copy/pasted and replace the contents of the file found in /oxide/config/RaidProtection.json.

PVE Config (Default)
  • Tailored for PVE servers, features online offline protection and protects all entities within the area including players, vehicles, and electronics.
{
  "General settings": {
    "Currency item ID (if not using economics)": -932201673,
    "Use economics balance (requires economics plugin)": false,
    "Use reward points (requires server rewards plugin)": false
  },
  "Protection settings": {
    "Protection levels": {
      "0": {
        "Online protection percentage (0-100)": 100.0,
        "Offline protection percentage (0-100)": 100.0
      }
    },
    "Delay after taking damage (seconds)": 10,
    "Delay for offline protection (seconds)": 600,
    "Protect buildings and deployables (true/false)": true,
    "Protect players (true/false)": true,
    "Protect vehicles and horses (true/false)": true,
    "Protect traps and electronics (true/false)": true
  },
  "Cost settings": {
    "Material cost multipliers": {
      "twig": 1.0,
      "wood": 1.0,
      "stone": 1.0,
      "metal": 1.0,
      "armored": 1.0
    },
    "Default hourly building cost": 1.0,
    "Default hourly base cost": 9.0,
    "Default structure damage cost": 0.0
  },
  "Indicator settings": {
    "Enabled": true,
    "Persistent": false,
    "Image url": "https://i.imgur.com/ue05FGg.png"
  }
}
PVP Config
  • Tailored for PVP servers, features offline only protection, damage dealt to protected structures will drain protection balance, and only building blocks and deployables are protected. Players, traps, electronics vehicles will not be protected.
{
  "General settings": {
    "Currency item ID (if not using economics)": -932201673,
    "Use economics balance (requires economics plugin)": false,
    "Use reward points (requires server rewards plugin)": false
  },
  "Protection settings": {
    "Protection levels": {
      "0": {
        "Online protection percentage (0-100)": 0.0,
        "Offline protection percentage (0-100)": 100.0
      }
    },
    "Delay after taking damage (seconds)": 10,
    "Delay for offline protection (seconds)": 600,
    "Protect buildings and deployables (true/false)": true,
    "Protect players (true/false)": false,
    "Protect vehicles and horses (true/false)": false,
    "Protect traps and electronics (true/false)": false
  },
  "Cost settings": {
    "Material cost multipliers": {
      "twig": 1.0,
      "wood": 1.0,
      "stone": 1.0,
      "metal": 1.0,
      "armored": 1.0
    },
    "Default hourly building cost": 1.0,
    "Default hourly base cost": 9.0,
    "Default structure damage cost": 0.01
  },
  "Indicator settings": {
    "Enabled": true,
    "Persistent": false,
    "Image url": "https://i.imgur.com/ue05FGg.png"
  }
}
PVP Performance Config
  • Same as the PVP config, but with some features turned off to maximize server performance. Building cost is disabled and replaced by a higher flat-rate base cost, and damage dealt to structures will no longer deduct from the protection balance. Other settings are the same as the pvp config.
{
  "General settings": {
    "Currency item ID (if not using economics)": -932201673,
    "Use economics balance (requires economics plugin)": false,
    "Use reward points (requires server rewards plugin)": false
  },
  "Protection settings": {
    "Protection levels": {
      "0": {
        "Online protection percentage (0-100)": 0.0,
        "Offline protection percentage (0-100)": 100.0
      }
    },
    "Delay after taking damage (seconds)": 10,
    "Delay for offline protection (seconds)": 600,
    "Protect buildings and deployables (true/false)": true,
    "Protect players (true/false)": false,
    "Protect vehicles and horses (true/false)": false,
    "Protect traps and electronics (true/false)": false
  },
  "Cost settings": {
    "Material cost multipliers": {
      "twig": 1.0,
      "wood": 1.0,
      "stone": 1.0,
      "metal": 1.0,
      "armored": 1.0
    },
    "Default hourly building cost": 0,
    "Default hourly base cost": 25.0,
    "Default structure damage cost": 0
  },
  "Indicator settings": {
    "Enabled": true,
    "Persistent": false,
    "Image url": "https://i.imgur.com/ue05FGg.png"
  }
}

Donate

I make plugins for free, but donating keeps me motivated and is a great way to show appreciation if you use this plugin a lot. Totally optional, but if you're interested you can buy me a coffee with this link.

Credits

  • Lauren, the artist who made the icons for this plugin.
MIT License

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.