Join the Game4Freak Discord Get exclusive plugin sneak peeks, talk directly with VisEntities, never miss important updates, and unlock special discount codes!
Automated Cannons

Automated Cannons 1.0.0

Hire NPC gunners to man your boat cannons and automatically engage enemy ships


Player-built boats in Rust are vulnerable while sailing, especially when the crew is busy navigating or managing the vessel. Automated Cannons solves this by letting players hire NPC gunners that mount boat cannons and automatically scan for, aim at, and fire on enemy ships.

Gunners operate independently once hired. They pull ammo from the cannon's stash, pick targets based on range and line of sight, and avoid shooting allied vessels. A per-cannon management UI lets authorized players control everything without chat commands.

Features

  • NPC gunners - Hire AI-controlled gunners that mount cannons, scan for threats, and fire automatically
  • Per-cannon management UI - Walk near any cannon to open a panel with health, ammo, AI status, and action buttons
  • Weapons free / hold fire - Toggle each cannon between active engagement and standby mode
  • Auto-rehire - Optionally respawn gunners after death with a configurable delay
  • Ally detection - Integrates with Rust teams, Clans, and Friends to prevent friendly fire
  • Player takeover - Dismount the NPC and manually control any cannon, then hand it back when done
  • Bulk actions - Hire all, dismiss all, or repair all cannons on a boat with one click
  • Owner notifications - Toast alerts when enemies are detected, ammo runs out, or a gunner dies
  • Cannon-side awareness - Gunners only engage targets on their side of the boat, preventing self-damage
  • Admin test mode - Spawn circling target boats to test cannon accuracy and engagement behavior
  • Gear Core integration - Outfit gunners with randomized gear sets via Gear Core

Ammo System

Gunners pull cannonballs from the stash attached to each cannon by Cannon Storage. This plugin must be installed for gunners to have any ammo supply. Without it, they'll mount the cannon but never fire.

Permissions

  • automatedcannons.use -- Required to hire gunners and interact with the cannon management UI
  • automatedcannons.unlimited -- Bypasses gunner limits per boat and per player

How It Works

Cannon Tracking

When a player boat spawns or the server starts, the plugin scans all cannons attached to finished player boats and registers them. Each tracked cannon gets a visible interaction sphere (configurable color and radius) that triggers the management UI when an authorized player walks near it.

Hiring a Gunner

Walk into a cannon's interaction sphere to open the UI. Click Hire Gunner to spawn an NPC that mounts the cannon and begins scanning for targets. The gunner is assigned a display name and optional gear set from the config. If Default Cannonballs Loaded Into Stash When Hired is set above 0, the plugin automatically loads that many cannonballs into the cannon's stash.

Engagement Cycle

Once hired, a gunner cycles through these states:
  1. Scanning -- Periodically checks for enemy boats within engagement range
  2. Aiming -- Smoothly rotates the cannon toward the target, checking line of sight
  3. Reloading -- Pulls a cannonball from the stash and loads the cannon
  4. Firing -- Lights the fuse and fires. Includes a self-hit check to avoid damaging the own boat
  5. Cooldown -- Waits for the configured delay between shots before scanning again
  6. No Ammo -- Stash is empty. Gunner idles and periodically rechecks. Owner is notified

Target Selection

Gunners only target other player boats that meet all of these conditions:
  • Within the configured engagement range (and beyond the minimum range)
  • Not the gunner's own boat
  • Owned by a non-allied player (checked against teams, clans, and friends)
  • Has at least one living player aboard
  • On the cannon's side of the boat (port/starboard awareness)
  • Visible with line-of-sight check from the cannon's fire point

Player Takeover

Click Take Control in the UI to dismount the NPC gunner and manually mount the cannon yourself. When you dismount, the NPC automatically remounts and resumes scanning.

Auto-Rehire

When enabled per cannon, a killed gunner will respawn after the configured delay and remount the same cannon. This can be toggled on/off per cannon via the UI.

Configuration

JSON:
{
  "Gunner Settings": {
    "Gunner Health Points": 150.0,
    "Gunner Display Name (shown above the NPC's head)": "Cannon Crew",
    "Make Gunners Invincible (gunners cannot be damaged or killed)": true,
    "Respawn Delay In Seconds After Gunner Death (set to 0 to disable auto-respawn)": 10.0,
    "Gear Set Names (randomly picks one per gunner, requires Gear Core plugin)": [
      "cannoncrew_default"
    ],
    "Maximum Gunners Allowed Per Boat": 10,
    "Maximum Gunners Allowed Per Player Across All Boats": 20,
    "Automatically Rehire Gunner After Death By Default": false,
    "Default Cannonballs Loaded Into Stash When Hired": 20
  },
  "Combat Settings": {
    "Maximum Engagement Range (how far cannons can detect and shoot targets)": 150.0,
    "Minimum Engagement Range (targets closer than this are ignored)": 15.0,
    "Seconds Between Target Scans (lower values find targets faster but cost more performance)": 2.0,
    "Aim Accuracy Offset (higher values make shots less precise)": 2.0,
    "Seconds Between Shots (includes reload and fuse time)": 6.0
  },
  "Ally Settings": {
    "Do Not Shoot Teammates (Rust built-in team system)": true,
    "Do Not Shoot Clanmates (requires Clans plugin)": true,
    "Do Not Shoot Friends (requires Friends plugin)": true
  },
  "Notification Settings": {
    "Notify Boat Owner When Enemy Ship Detected": true,
    "Notify Boat Owner When Cannon Runs Out Of Ammo": true,
    "Notify Boat Owner When Gunner Is Killed": true
  },
  "Trigger Zone Settings": {
    "Interaction Sphere Radius (how close a player must walk to a cannon to open the UI)": 1.0,
    "Sphere Color (Blue, Red, Green, Purple, Black)": "Black"
  }
}

Gunner Settings

  • Gunner Health Points -- Base health for spawned NPC gunners
  • Gunner Display Name -- Name shown above the NPC's head in-game. A number is appended for each gunner (e.g. "Cannon Crew 1", "Cannon Crew 2")
  • Make Gunners Invincible -- When true, gunners cannot take damage from any source
  • Respawn Delay In Seconds After Gunner Death -- How long to wait before respawning a killed gunner (only applies when auto-rehire is enabled). Set to 0 to disable auto-respawn entirely
  • Gear Set Names -- List of Gear Core gear set names. One is randomly selected per gunner on spawn. Requires the Gear Core plugin
  • Maximum Gunners Allowed Per Boat -- Hard cap on how many gunners can be active on a single boat
  • Maximum Gunners Allowed Per Player Across All Boats -- Hard cap on total gunners a single player can have across all their boats
  • Automatically Rehire Gunner After Death By Default -- Default auto-rehire state for newly hired cannons. Players can override this per cannon via the UI
  • Default Cannonballs Loaded Into Stash When Hired -- Number of cannonballs automatically placed into the cannon's stash when a gunner is hired. Set to 0 to start empty

Combat Settings

  • Maximum Engagement Range -- How far cannons can detect and shoot targets, in meters
  • Minimum Engagement Range -- Targets closer than this distance are ignored. Useful to prevent point-blank shots that might hit the own boat
  • Seconds Between Target Scans -- How often the gunner scans for new targets. Lower values find targets faster but use more server resources
  • Aim Accuracy Offset -- Random offset applied to aim direction. Higher values make shots less precise, 0 is perfectly accurate
  • Seconds Between Shots -- Minimum delay between consecutive shots, including reload and fuse time

Ally Settings

  • Do Not Shoot Teammates -- Skip targets owned by players on the same Rust team
  • Do Not Shoot Clanmates -- Skip targets owned by players in the same clan. Requires the Clans plugin
  • Do Not Shoot Friends -- Skip targets owned by players on the friend list. Requires the Friends plugin

Notification Settings

  • Notify Boat Owner When Enemy Ship Detected -- Send a toast notification when a gunner first spots an enemy vessel (throttled to once per 30 seconds)
  • Notify Boat Owner When Cannon Runs Out Of Ammo -- Send a toast notification when a gunner's ammo stash is empty
  • Notify Boat Owner When Gunner Is Killed -- Send a toast notification when a gunner dies

Trigger Zone Settings

  • Interaction Sphere Radius -- How close a player must walk to a cannon for the management UI to appear
  • `Sphere Color (accepts: Blue, Red, Green, Purple, Black) -- Color of the visible interaction sphere around each cannon

Management UI

The cannon management UI appears automatically when an authorized player walks into a cannon's trigger zone and closes when they leave.

Cannon Section

Displays cannon health as a progress bar with current/max values. A warning icon appears when health drops below 30%. The Repair button consumes resources from the player's inventory to restore cannon health (same repair mechanics as vanilla Rust, subject to damage cooldown). The Ammo Stash row shows the current cannonball count in the cannon's stash, or a Respawn Stash button if the stash was destroyed.

Gunner Section (When Hired)

Shows gunner health, current AI status (Scanning, Aiming, Reloading, Firing, Cooldown, Out of Ammo, Player Control), and the auto-rehire toggle. Action buttons:
  • Dismiss Gunner -- Kills and removes the NPC from the cannon
  • Take Control -- Dismounts the NPC so the player can manually use the cannon
  • Auto-Rehire toggle -- Switches between On (gunner respawns after death) and Off

Gunner Section (When Not Hired)

Shows a Hire Gunner (or Replace Gunner if one was previously assigned but died) button with a description of what hiring does.

Weapons Mode

A toggle button switches between:
  • Weapons Free -- Gunner actively scans and engages all enemy vessels in range
  • Hold Fire -- Gunner stands down and will not engage any targets

Bulk Actions

A side panel provides boat-wide controls:
  • Hire All -- Hire gunners on all unmanned cannons on the boat
  • Dismiss All -- Dismiss all active gunners on the boat
  • Repair All -- Repair all cannons on the boat (consumes resources)

Admin Panel

Visible only to server admins. Provides a Spawn Target / Kill Target button that spawns PT boats circling the player's boat at varying distances to test cannon engagement.

Stored Data

JSON:
{
  "Hired Cannon Network Ids": [12345, 67890],
  "Weapons Free Per Cannon": {
    "12345": true,
    "67890": false
  },
  "Auto Rehire Per Cannon": {
    "12345": true,
    "67890": false
  }
}
  • Hired Cannon Network Ids -- Set of network IDs for cannons that currently have hired gunners. Used to restore gunners after server restart
  • Weapons Free Per Cannon -- Per-cannon weapons free/hold fire state. true means weapons free, false means hold fire
  • Auto Rehire Per Cannon -- Per-cannon auto-rehire toggle. true means the gunner will respawn after death

Localization

JSON:
{
  "Alert.EnemyDetected": "Enemy ship detected at {0}m!",
  "Alert.AmmoEmpty": "A gunner is out of ammo! Refill the ammo box.",
  "Alert.NpcKilled": "A gunner has been killed!",
  "UI.Gunner.Hired": "Gunner hired and deployed!",
  "UI.Gunner.Dismissed": "Gunner dismissed.",
  "UI.Gunner.Replaced": "Gunner replaced.",
  "UI.Weapons.Free": "Weapons free, engaging targets on sight.",
  "UI.Weapons.Hold": "Holding fire, standing down.",
  "UI.AutoRehire.On": "Gunner will respawn when killed.",
  "UI.AutoRehire.Off": "Gunner will not respawn when killed.",
  "UI.Stash.Respawned": "Stash has been respawned on the cannon.",
  "UI.Stash.RespawnFailed": "Failed to respawn stash.",
  "UI.Stash.NoPlugin": "CannonStorage plugin is not loaded. Install it to enable ammo stash functionality.",
  "UI.Stash.Missing": "Stash is missing. It may have been destroyed. Click Respawn Stash to restore it.",
  "UI.Status.CannonCritical": "Cannon critically damaged!",
  "UI.Gunner.Critical": "Gunner critically injured!",
  "UI.Gunner.NoAmmo": "Gunner out of ammo!",
  "UI.Repair.Success": "Repaired.",
  "UI.Repair.Full": "Fully repaired!",
  "UI.Repair.Cooldown": "Recently damaged. Wait {0}s.",
  "UI.Repair.NoResources": "Not enough resources to repair.",
  "UI.Repair.NotDamaged": "Cannon is not damaged.",
  "UI.Bulk.HireAll": "All cannons hired!",
  "UI.Bulk.DismissAll": "All gunners dismissed!",
  "UI.Bulk.RepairAll": "All cannons repaired!"
}

Recommended Compatible Plugins

For servers going all-in on naval gameplay, these pair nicely with Automated Cannons.
  • Boat Auto Pilot -- Automatically navigates player boats to map marker destinations. Set a course and let your gunners handle threats along the way
Author
VisEntities
License duration
Unlimited
Price
19.99 USD
First release
Last update

Ratings

0.00 star(s) 0 reviews

Also by VisEntities

  • Barrel Health
    Barrel Health
    Sets custom health for loot barrels
  • Gamemode Aim Train
    Gamemode Aim Train
    Train your aim and master weapon recoil patterns with fully customizable AI training bots that move, crouch, and adapt to your practice needs
  • Always Driver Seat
    Always Driver Seat
    Forces players into the driver's seat when they mount certain vehicles
Back
Top
Chat commands start with a /, while console commands can be entered directly in the F1 console or server console. Use find <keyword> in console to search for available commands related to the plugin. Parameters in < > are required, while [ ] are optional.
This plugin uses Oxide's permission system. Grant or revoke permissions using oxide.grant and oxide.revoke. You can assign them to individual players or groups using their Steam id or group name.
Settings are stored in the config file found under the config/ directory. You can edit this file manually, then reload the plugin to apply your changes.
Persistent data is saved in the data/ directory. This includes things like saved settings, usage stats, or player progress depending on the plugin. Deleting a data file will reset stored progress or customizations.
Language files are located in the lang/ folder. To translate messages, copy the en.json file into your target language folder (e.g. fr, de) and edit the values. Reload the plugin after changes to apply new messages.
This section lists public methods exposed by the plugin for use in other plugins. You can call these via the CallHook method. Ensure the plugin is loaded before calling its API to avoid null reference errors.
These are custom hooks that other plugins can listen for. Simply define a method with the same name and expected parameters in your plugin to handle the event. Hooks are triggered at key moments and are useful for extending or reacting to plugin behavior.
These hooks are injected into the game's code using Harmony. They let the plugin run code at key points in the game's internal logic. You can return values to block or modify behavior. Use with caution — these are powerful and can affect core mechanics.
Cart