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

Cannon Storage 1.0.0

Sign in to download
Attaches a small stash to every cannon for storing cannonballs, automatically feeding ammo during reload
Works With
Cannon Storage gives every cannon on your server its own ammunition storage via an attached small stash. When a player mounts the cannon, ammunition automatically loads from the stash into the cannon's magazine, eliminating the need to manually reload from your inventory. While mounted, players see a text overlay above the cannon showing the total ammo count in the stash. When the cannon is destroyed, the stash drops its contents and is removed.


Recommended Compatible Plugins

Cannon Storage integrates with other plugins to extend cannon functionality:
  • Cannon Rockets -- Allows cannons to fire rockets instead of cannonballs. Cannon Rockets automatically draws rocket ammo from the stash when needed

Configuration

JSON:
{
  "Version": "1.0.0",
  "Stash Inventory Size (Default: 6)": 6,
  "Stash Position": {
    "x": 0.4,
    "y": 0.5,
    "z": -0.11
  },
  "Stash Rotation": {
    "x": 90.0,
    "y": 90.0,
    "z": 0.0
  }
}
  • Stash Inventory Size -- Number of inventory slots in each cannon's stash. Default is 6
  • Stash Position -- Where the stash spawns relative to the cannon. Adjust these coordinates to reposition the stash if it conflicts with other mods or looks wrong
  • Stash Rotation -- Rotation of the stash relative to the cannon in degrees

Localization

JSON:
{
  "Hud.AmmoCount": "Ammo: {0}"
}

Developer API

API_GetStash

C#:
StashContainer API_GetStash(Cannon cannon)
Returns the stash container attached to the specified cannon, or null if the cannon has no stash.
Parameters:
  • cannon -- The cannon entity
Returns: The StashContainer attached to the cannon, or null


API_GetAmmoCountByShortName

C#:
int API_GetAmmoCountByShortName(Cannon cannon, string shortName)
Counts how many items with the specified short name exist in the cannon's stash.
Parameters:
  • cannon -- The cannon entity
  • shortName -- Item short name to search for (e.g., "ammo.rocket.basic")
Returns: Total count of the specified item, or 0 if none found or if the cannon has no stash


API_TakeAmmoByShortName

C#:
bool API_TakeAmmoByShortName(Cannon cannon, string shortName, int amount)
Removes a specific amount of an item from the cannon's stash.
Parameters:
  • cannon -- The cannon entity
  • shortName -- Item short name to remove (e.g., "ammo.rocket.basic")
  • amount -- How many to remove
Returns: true if the full amount was successfully removed, false otherwise
Example:
C#:
if (CannonStorage == null)
    return;

bool success = CannonStorage.Call<bool>("API_TakeAmmoByShortName", cannon, "ammo.rocket.basic", 5);
if (success)
{
    Puts("Successfully took 5 rockets from cannon stash");
}
Note: This method removes items starting from the end of the inventory list. If an item stack has fewer items than requested, it removes the entire stack and continues to the next matching stack until the requested amount is fulfilled or no more matching items remain.
Author
VisEntities
Downloads
5
First release
Last update

Ratings

0.00 star(s) 0 reviews

Also by VisEntities

  • Patrol Heli Crash Sites
    Patrol Heli Crash Sites
    Prevents patrol helicopters from crashing at certain monuments
  • No Water Sleep
    No Water Sleep
    Kills players if they go to sleep while underwater
  • Mod Mail
    Mod Mail
    Provides an in-game mailbox system for players to contact admins
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