WheteThunger / MonumentAddons

Add entities, spawn points and more to monuments
https://umod.org/plugins/monument-addons
MIT License
7 stars 9 forks source link

Video Tutorial

Video Tutorial

Features

Easily spawn permanent entities at monuments, which auto respawn after restarts and wipes.

Required plugins

Recommended compatible plugins

What kinds of things can I do with this plugin?

List of spawnable entities: https://github.com/OrangeWulf/Rust-Docs/blob/master/Entities.md

Permissions

Getting started

Installing existing profiles

Let's face it, you are probably planning to use this plugin the same way as many other server owners. That means there may already be profiles that you can install to do just that.

Several example profiles are included below. Run the corresponding command snippet to install each profile.

These example profiles are installed from https://github.com/WheteThunger/MonumentAddons/blob/master/Profiles/. Don't see what you're looking for? Want to showcase a profile you created? Fork the repository on GitHub, commit the changes, and submit a pull request!

Spawning static entities

Follow these steps to spawn static entities.

  1. Go to any monument, such as a gas station.
  2. Aim somewhere, such as a floor, wall or ceiling.
  3. Run the command maspawn <entity> to spawn an entity of your choice. For example, maspawn modularcarlift.static. Alternatively, if you are holding a deployable item, you can simply run maspawn to spawn the corresponding entity.

How this works:

Creating puzzles

Follow these steps to create an example puzzle.

  1. Go to any monument, such as a gas station.
  2. Aim at the floor, then run the command maspawn generator.static. This will be the root of your puzzle, automatically resetting it on a schedule. It's recommended to place the generator near the center of the puzzle so it can evenly detect nearby players for the purpose of delaying the puzzle from resetting.
  3. Aim at a wall, outside the puzzle room, then run the command maspawn fusebox.
  4. Aim at the floor in a doorway, then run the command maspawn security.blue. Reposition the door with Telekinesis if needed.
  5. Aim at the wall next to the front side of the doorway, then run the commands maspawn cardreader and maspawn doormanipulator.
  6. Aim at the wall next to the back side of the doorway, then run the commands maspawn pressbutton, and maspawn orswitch.
  7. Aim at the card reader, then run the command macardlevel 2 to make it a blue card reader.
  8. Equip a wire tool, then run the command mawire.
  9. Connect generator.static -> fusebox -> cardreader -> orswitch -> doormanipulator.
  10. Connect pressbutton -> orswitch.

Creating spawn points

Follow these steps to create example spawn points.

  1. Go to any monument, such as a gas station.
  2. Aim somewhere on the ground.
  3. Run the command maspawngroup create MyFirstSpawnGroup to create a spawn group and a spawn point.
  4. Run the command maspawngroup add radtown/crate_normal 30.
  5. Run the command maspawngroup add radtown/crate_normal_2 70.
  6. Run the command maspawngroup add crate_basic 100.
  7. Aim somewhere else on the ground, and run the command maspawnpoint create MyFirstSpawnGroup to create a second spawn point in the spawn group you created earlier.
  8. Aim at the 2nd spawn point, and run the command maspawnpoint set RandomRadius 1.5.
  9. Aim at either spawn point, and run the command maspawngroup set MaxPopulation 2.
  10. Aim at either spawn point, and run the command maspawngroup respawn. Run this as many times as you want to see the loot crates respawn.

Commands

The following commands only work on objects managed by this plugin. The effect of these commands automatically applies to all copies of the object at matching monuments, and also updates the data files.

Puzzles

Spawn points and spawn groups

Spawn groups

Note: masg can be used in place of maspawngroup.

Spawn points

Note: masp can be used in place of maspawnpoint.

Profiles

Profiles allow you to organize entities into groups. Each profile can be independently enabled or reloaded. Each profile uses a separate data file, so you can easily share profiles with others.

Configuration

{
  "Debug display settings": {
    "Default display duration (seconds)": 60.0,
    "Display distance": 100.0,
    "Display distance abbreviated": 200.0,
    "Max addons to show unabbreviated": 1,
    "Entity color": "#FF00FF",
    "Spawn point color": "#FF8000",
    "Paste color": "#00FFFF",
    "Custom addon color": "#00FF00",
    "Custom monument color": "#00FF00",
    "Inactive profile color": "#808080"
  },
  "Save entities between restarts/reloads to preserve their state throughout a wipe": {
    "Enable saving for storage entities": false,
    "Enable saving for non-storage entities": false,
    "Override saving enabled by prefab": {}
  },
  "Dynamic monuments": {
    "Entity prefabs to consider as monuments": [
      "assets/content/vehicles/boats/cargoship/cargoshiptest.prefab"
    ]
  },
  "Addon defaults": {
    "Spawn group defaults": {
      "MaxPopulation": 1,
      "SpawnPerTickMin": 1,
      "SpawnPerTickMax": 2,
      "RespawnDelayMin": 1500.0,
      "RespawnDelayMax": 2100.0,
      "InitialSpawn": true,
      "PreventDuplicates": false,
      "PauseScheduleWhileFull": false,
      "RespawnWhenNearestPuzzleResets": false
    },
    "Spawn point defaults": {
      "Exclusive": true,
      "SnapToGround": true,
      "CheckSpace": false,
      "RandomRotation": false,
      "RandomRadius": 0.0,
      "PlayerDetectionRadius": 0.0
    },
    "Puzzle defaults": {
      "PlayersBlockReset": true,
      "PlayerDetectionRadius": 30.0,
      "SecondsBetweenResets": 1800.0
    }
  },
  "Deployable overrides": {
    "arcade.machine.chippy": "assets/bundled/prefabs/static/chippyarcademachine.static.prefab",
    "autoturret": "assets/content/props/sentry_scientists/sentry.bandit.static.prefab",
    "bbq": "assets/bundled/prefabs/static/bbq.static.prefab",
    "boombox": "assets/prefabs/voiceaudio/boombox/boombox.static.prefab",
    "box.repair.bench": "assets/bundled/prefabs/static/repairbench_static.prefab",
    "cctv.camera": "assets/prefabs/deployable/cctvcamera/cctv.static.prefab",
    "chair": "assets/bundled/prefabs/static/chair.static.prefab",
    "computerstation": "assets/prefabs/deployable/computerstation/computerstation.static.prefab",
    "connected.speaker": "assets/prefabs/voiceaudio/hornspeaker/connectedspeaker.deployed.static.prefab",
    "hobobarrel": "assets/bundled/prefabs/static/hobobarrel_static.prefab",
    "microphonestand": "assets/prefabs/voiceaudio/microphonestand/microphonestand.deployed.static.prefab",
    "modularcarlift": "assets/bundled/prefabs/static/modularcarlift.static.prefab",
    "research.table": "assets/bundled/prefabs/static/researchtable_static.prefab",
    "samsite": "assets/prefabs/npc/sam_site_turret/sam_static.prefab",
    "small.oil.refinery": "assets/bundled/prefabs/static/small_refinery_static.prefab",
    "telephone": "assets/bundled/prefabs/autospawn/phonebooth/phonebooth.static.prefab",
    "vending.machine": "assets/prefabs/deployable/vendingmachine/npcvendingmachine.prefab",
    "wall.frame.shopfront.metal": "assets/bundled/prefabs/static/wall.frame.shopfront.metal.static.prefab",
    "workbench1": "assets/bundled/prefabs/static/workbench1.static.prefab",
    "workbench2": "assets/bundled/prefabs/static/workbench2.static.prefab"
  },
  "Xmas tree decorations (item short names)": [
    "xmas.decoration.gingerbreadmen",
    "xmas.decoration.star",
    "xmas.decoration.tinsel",
    "xmas.decoration.candycanes",
    "xmas.decoration.pinecone",
    "xmas.decoration.lights"
  ]
}

Localization

How underwater labs work

Since underwater labs are procedurally generated, this plugin does not spawn entities relative to the monuments themselves. Instead, entities are spawned relative to specific modules. For example, if you spawn an entity in a moonpool module, the entity will also be spawned at all moonpool modules in the same lab and other labs.

Note that some modules have multiple possible vanilla configurations, so multiple instances of the same module might have slightly different placement of vanilla objects. That happens because Rust spawns semi-random dwelling entities in them, which you can learn about via the mashowvanilla command. You can use that command to get an idea of where dwellings spawn, in order to avoid placing your addons at those locations. After spawning something into a lab module, it's also recommended to inspect other instances of that module to make sure the entity placement isn't overlapping a dwelling entity.

Instructions for sharing profiles

How to share a profile via a website

Sharing a profile via a website allows recipients to install the profile with a single command. Here's how it works:

  1. Profile author locates the oxide/data/MonumentAddons/PROFILE_NAME.json file, where PROFILE_NAME is replaced with the profile's actual name.
  2. Profile author uploads the file to a website of their choice and obtains a raw download link. For example, if hosting on pastebin or GitHub, click the "raw" button before copying the URL.
  3. Recipient runs a command like mainstall <url> using the URL provided by the profile author.

Sharing a profile via a website will eventually have additional perks, including the ability to download updates to the profile automatically, while preserving customizations you have made.

How to share a profile via direct file transfer

If you don't have a website to host a profile, you can simply send the profile data file to someone else over Discord or wherever. Here's how it works:

  1. Profile author locates the oxide/data/MonumentAddons/PROFILE_NAME.json file, where PROFILE_NAME is replaced with the profile's actual name.
  2. Profile author sends the file to the recipient.
  3. Recipient downloads the file and places it in the same location on their server.
  4. Recipient runs the command: maprofile enable <name>. Alternatively, if the recipient already had a version of the profile installed and enabled, they would run maprofile reload <name>.

Instructions for plugin integrations

Sign Artist integration

Use the following steps to set persistent images for signs or photo frames. Requires the Sign Artist plugin to be installed with the appropriate permissions granted.

  1. Spawn a sign with maspawn sign.large. You can also use other sign entities, photo frames, neon signs, or carvable pumpkins.
  2. Use a Sign Artist command such as sil, silt or sili to apply an image to the sign.

That's all you need to do. This plugin detects when you use a Sign Artist command and automatically saves the corresponding image URL or item short name in the profile's data file for that particular sign. When the plugin reloads, Sign Artist is called to reapply that image. Any change to a sign will also automatically propagate to all copies of that sign at duplicate monuments.

Notes:

Entity Scale Manager integration

Use the following steps to resize entities. Requires the Entity Scale Manager plugin to be installed with the appropriate permissions granted.

  1. Spawn any entity with maspawn <entity>.
  2. Resize the entity with scale <size>.

That's all you need to do. This plugin detects when an entity is resized and automatically applies that scale to copies of the entity as matching monuments, and saves the scale in the profile's data file. When the plugin reloads, Entity Scale manager is called to reapply that scale.

Instructions for specific addons

Heli & boat vendors

Use the following steps to set up a heli vendor at a custom location.

  1. Aim where you want to spawn the vendor and run maspawn bandit_conversationalist.
  2. Aim where you want purchased helicopters to spawn and run maspawn airwolfspawner.

Use the following steps to set up a boat vendor at a custom location.

  1. Aim where you want to spawn the vendor and run maspawn boat_shopkeeper.
  2. Aim where you want purchased boats to spawn and run maspawn boatspawner.

Notes:

CCTV cameras & computer stations

Use the following steps to set up CCTV cameras and computer stations.

  1. Spawn a CCTV camera with maspawn cctv.static.
  2. Update the camera's RC identifier with masetid <id> while looking at the camera.
  3. Update the direction the camera is facing with masetdir while looking at the camera. This will cause the camera to face you, just like with deployable CCTV cameras.
  4. Spawn a static computer station with maspawn computerstation.static.

That's all you need to do. The rest is automatic. Read below if you are interested in how it works.

Note: As of this writing, there is currently a client bug where having lots of RC identifiers saved in a computer station may cause some of them to not be displayed. This is especially an issue at large underwater labs. If you add custom CCTVs in such a location, some of them may not show up in the list at the computer station. One thing you can do to partially mitigate this issue is to use shorter RC identifier names.

Bandit wheel

Use the following steps to set up a custom bandit wheel to allow players to gamble scrap.

  1. Spawn a chair with maspawn chair.static. You can also use other mountable entities.
  2. Spawn a betting terminal next to the chair with maspawn bigwheelbettingterminal. This needs to be close to the front of the chair so that players can reach it while sitting. Getting this position correct is the hardest part.
  3. Keep spawning as many chairs and betting terminals as you want.
  4. Spawn a bandit wheel with maspawn big_wheel. This needs to be within 30 meters (equivalent to 10 foundations) of the betting terminals to find them.

Notes:

CH47 drop zones

To place a CH47 drop zone, run the command maprefab dropzone. It can be removed using the makill command.

Note: In order for a CH47 to drop a crate at this location, it must be within a monument that the chinook will visit. You can use the Better Chinook Patrol plugin to customize which monuments can be visited.

Common puzzle entities

Note: Kinetic IO elements such as wheelswitch and sliding_blast_door are not currently able to be controlled by electricity.

Tips

Troubleshooting

Uninstallation

Ensure the plugin is loaded with saving disabled for all types of entities, then simply remove the plugin. All addons will be automatically removed.

Developer API

API_RegisterCustomAddon (experimental)

Coming soon. For early access, see Custom Addons API documentation.

API_RegisterCustomMonument

See Custom Monuments API documentation.

Developer hooks

OnMonumentAddonsInitialized

void OnMonumentAddonsInitialized()

OnMonumentEntitySpawned

void OnMonumentEntitySpawned(BaseEntity entity, UnityEngine.Component monument, Guid guid)

OnMonumentPrefabCreated

void OnMonumentPrefabCreated(GameObject gameObject, Component monument, Guid guid)

OnDynamicMonument

object OnDynamicMonument(BaseEntity entity)