Adds mobile safe zones and optional NPC auto turrets to workcarts
Supported Games
works with
Features
- Allows creating mobile safe zones on workcarts
- Allows spawning NPC auto turrets on workcarts with the safe zone
- Prevents damage to workcarts that have safe zones
This plugin is intended primarily to be used with Automated Workcarts, but this plugin can also be used standalone.
Permissions
workcartsafezones.use-- Required to use thesafecart.addandsafecart.removecommands
Commands
safecart.add-- Adds a safe zone to the workcart you are aiming at.safecart.remove-- Removes the safe zone from the workcart you are aiming at.
These commands will also find the workcart you are standing on or mounted on if you aren't aiming at one nearby.
Configuration
Default configuration:
{
"AddToAllWorkcarts": false,
"AddToAutomatedWorkcarts": true,
"SafeZoneRadius": 0.0,
"DisarmOccupants": false,
"EnableTurrets": false,
"TurretPositions": [
{
"Position": {
"x": 0.85,
"y": 2.62,
"z": 1.25
},
"RotationAngle": 180.0
},
{
"Position": {
"x": 0.7,
"y": 3.84,
"z": 3.7
},
"RotationAngle": 0.0
}
]
}
AddToAllWorkcarts(trueorfalse) -- Whiletrue, all workcarts will automatically receive safe zones.- Note: Workcarts controlled by the Cargo Train Event plugin will always be ignored.
AddToAutomatedWorkcarts(trueorfalse) -- Whiletrue, only workcarts automated via the Automated Workcarts plugin will receive safe zones. This is the default behavior of the plugin.SafeZoneRadius-- Radius of the safe zone around the workcart.- Set to
0to apply the safe zone only to players standing on the workcart. Otherwise, a radius of at least5is recommended.
- Set to
DisarmOccupants(trueorfalse) -- Whiletrue, players who board the workcart with a weapon drawn will automatically have it holstered. This effectively prevents them from attacking others while they are on board.- Note: This only applies to the workcart itself, even if you have extended the safe zone radius.
EnableTurrets(trueorfalse) -- Whether to spawn NPC auto turrets with workcart safe zones.- Note: It's recommended to enable the NPC auto turrets only if you have disabled AI or disabled tunnel dwellers from spawning, since fighting them will consider you hostile, causing the NPC auto turrets to attack you.
TurretPositions-- List of turret positions relative to the workcart. Only applies whenEnableTurretsistrue.- Each entry in this list will cause a separate auto turret to be spawned (on every workcart that has a safe zone).
Localization
{
"Error.NoPermission": "You don't have permission to do that.",
"Error.NoWorkcartFound": "Error: No workcart found.",
"Error.SafeZonePresent": "That workcart already has a safe zone.",
"Error.NoSafeZone": "That workcart doesn't have a safe zone.",
"Add.Success": "Successfully added safe zone to the workcart.",
"Add.Error": "Error: Unable to add a safe zone to that workcart.",
"Remove.Success": "Successfully removed safe zone from the workcart.",
"Warning.Hostile": "You are <color=red>hostile</color> for <color=red>{0}</color>. No safe zone protection."
}
Developer API
API_CreateSafeZone
Plugins can call this API to create a safe zone on a workcart.
bool API_CreateSafeZone(TrainEngine workcart)
- Returns
trueif a safe zone was successfully added, or if the workcart already had a safe zone - Returns
falseif another plugin blocked it with theOnWorkcartSafeZoneCreatehook
Developer Hooks
OnWorkcartSafeZoneCreate
- Called when a safe zone is about to be created on a workcart
- Returning
falsewill prevent the safe zone from being created - Returning
nullwill result in the default behavior
bool? OnWorkcartSafeZoneCreate(TrainEngine workcart)
OnWorkcartSafeZoneCreated
- Called after a safe zone has been created on a workcart
- No return behavior
void OnWorkcartSafeZoneCreated(TrainEngine workcart)
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.
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.

