Features
Vehicle Decay Protection allows you to scale or nullify vehicle decay damage multiple ways.- Scale decay damage when a vehicle is under a roof (does not use permission)
- Scale decay damage when a vehicle is near a tool cupboard (does not use permission)
- Nullify decay damage for a configurable amount of time after a vehicle has been used (does not use permission)
- Nullify decay damage if a vehicle is owned (or had a lock deployed onto it) by a player with permission
No-Plugin Alternative
Vehicle decay is already somewhat configurable in the vanilla game using the following convars.Minicopters, Scrap Transport Helicopters, and Attack Helicopters:
- playerhelicopter.insidedecayminutes
- playerhelicopter.outsidedecayminutes
- motorrowboat.outsidedecayminutes
- motorrowboat.deepwaterdecayminutes
- tugboat.tugdecayminutes
- basesubmarine.outsidedecayminutes
- basesubmarine.deepwaterdecayminutes
- snowmobile.outsidedecayminutes
- basesiegeweapon.outsidedecayminutes
- baseridableanimal.decayminutes
- bike.outsidedecayminutes
- hotairballoon.outsidedecayminutes
- modularcar.outsidedecayminutes
Additional convars:
- motorrowboat.decaystartdelayminutes -- Determines how long until decay begins for the vehicle after it was last used, applying to Row Boats, RHIBs, Kayaks, Duo Submarines, and Solo Submarines.
- tugboat.tugdecaystartdelayminutes -- Determines how long until decay begins for the vehicle after it was last used, applying to Tug Boats.
- Horses: 2.0x decay damage while under a roof
- Modular Cars and all Siege Weapons: 0.1x decay damage while under a roof
- All Boats and Submarines, except Tug Boats: no decay damage while under a roof
- In vanilla, they also have to be in shallow water, but this plugin removes that restriction
- Hot Air Balloons: no decay damage while under a roof
- Snowmobiles and Tomahas: no decay damage while under a roof
- All Bikes: no decay damage while under a roof
Permissions
This plugin uses the permission system. To assign a permission, use oxide.grant <user or group> <name or steam id> <permission>. To remove a permission, use oxide.revoke <user or group> <name or steam id> <permission>.Note: This plugin has four different features for protecting vehicles against decay. Only one of those features uses permissions: "no decay based on vehicle ownership". If you simply want to make vehicles not decay if they have been recently used, or if you want to scale decay for vehicles under a roof or near a tool cupboard, those features DO NOT use permissions, so skip ahead to the configuration section of the plugin.
Granting the following permissions to a player will cause their owned vehicles to not decay under any circumstances. You can grant permissions by vehicle type, or for all vehicles with a single permission.
- vehicledecayprotection.nodecay.allvehicles (all in one)
- vehicledecayprotection.nodecay.attackhelicopter
- vehicledecayprotection.nodecay.ballista
- vehicledecayprotection.nodecay.batteringram
- vehicledecayprotection.nodecay.catapult
- vehicledecayprotection.nodecay.duosubmarine
- vehicledecayprotection.nodecay.hotairballoon
- vehicledecayprotection.nodecay.kayak
- vehicledecayprotection.nodecay.minicopter
- vehicledecayprotection.nodecay.modularcar
- vehicledecayprotection.nodecay.motorbike.sidecar
- vehicledecayprotection.nodecay.motorbike
- vehicledecayprotection.nodecay.pedalbike
- vehicledecayprotection.nodecay.pedaltrike
- vehicledecayprotection.nodecay.rhib
- vehicledecayprotection.nodecay.ridablehorse
- vehicledecayprotection.nodecay.rowboat
- vehicledecayprotection.nodecay.scraptransporthelicopter
- vehicledecayprotection.nodecay.siegetower
- vehicledecayprotection.nodecay.sled.xmas
- vehicledecayprotection.nodecay.sled
- vehicledecayprotection.nodecay.snowmobile
- vehicledecayprotection.nodecay.solosubmarine
- vehicledecayprotection.nodecay.tomaha
- vehicledecayprotection.nodecay.tugboat
How vehicle ownership is determined
Vehicle ownership is determined by the OwnerID property of the vehicle, which is usually a player's Steam ID, or 0 for no owner. Most plugins that spawn vehicles for a player will assign that player as the owner. For vehicles spawned by the vanilla game, it's recommended to use one of the following plugins to grant vehicle ownership.- Vehicle Vendor Options - Automatically assigns ownership of vehicles purchased at vanilla NPC vendors if the player has permission
- Claim Vehicle - Allows players with permission to claim ownership of unowned vehicles using a command on cooldown
- Vehicle Deployed Locks - Optionally assigns ownership to vehicles when a lock is deployed onto them
Tug Boats are a special case. As long as any authorized user has the nodecay permission, the tugboat will not decay.
Configuration
The settings and options can be configured in the VehicleDecayProtection file under the config directory. The use of an editor and validator is recommended to avoid formatting issues and syntax errors.Default configuration (equivalent to vanilla):
- Enable permission (true or false) -- Determines whether the permission feature is enabled. If you are not using permissions to prevent vehicle decay, set this to false to improve performance.
- Allow the plugin to influence decay (true or false) -- Determines whether the plugin will influence decay for this vehicle type. If you don't want to alter decay for a given vehicle type, you may set this to false to ensure that vanilla decay is used.
- Decay multiplier while inside -- Determines how much to scale decay damage for vehicles that are inside (under a roof). Set to 0.0 to completely nullify decay damage to vehicles while they are inside. Setting to 1.0 will improve performance by avoiding even checking if the vehicle is inside.
- Decay multiplier near tool cupboard -- Determines how much to scale decay damage for vehicles that are near any tool cupboard (regardless of whether the vehicle owner is authorized). Defaults to 1.0 which has no effect. Set to 0.0 to completely nullify decay damage near tool cupboards.
- Protect from decay after recent use (minutes) -- Determines how many minutes to protect vehicles from decay after they have been used.
- Note: This option does not appear in the config for boats because there are already vanilla convars for that:
- motorrowboat.decaystartdelayminutes -- Applies to Row Boats, RHIBs, Kayaks, Duo Submarines, and Solo Submarines.
- tugboat.tugdecaystartdelayminutes -- Applies to Tug Boats.
- Note: This option does not appear in the config for boats because there are already vanilla convars for that:
- Decay interval (seconds) -- Determines how often each vehicle can take decay damage. Raise this value to deal decay damage less frequently and to improve performance. The plugin will automatically compensate for slower schedules by dealing higher amounts of decay damage, so you don't have to worry about this affecting damage over time.
Performance tips
When carefully tuned, this plugin can actually improve the performance of decay calculation compared to vanilla. Here are some tips that can help you maximize performance.- Set Enable permission to false when not using the permissions feature, to avoid checking vehicle owner permissions.
- Raise Protect from decay after recent use (minutes) to increase the likelihood that other expensive checks are skipped.
- Set Decay multiplier while inside to 1.0 to skip checking whether the vehicle is inside.
- Set Decay multiplier near tool cupboard to 1.0 to skip building privilege checks, which are the most expensive type of check.
- Raise Decay interval (seconds) to reduce the frequency at which the various checks are performed. The default configuration of the plugin is 60.0 to match vanilla Rust, but 600.0 is recommended as a starting point.
Developer Hooks
- Called when this plugin is about to replace decay logic for a vehicle.
- Returning false will prevent this plugin from replacing that vehicle's decay logic.
- Returning null will result in the default behavior.