Volcanoids

Volcanoids

Not enough ratings
Interior Device modding guide
By Captain
Welcome to the Interior device modding guide! We will take a look at how to make your own devices. This guide will be quite advanced, but we can do it together. Interior Devices can enhance your drillship interior experience. Also if you are a skilled programmer, you can make them as interactive as you like.

   
Award
Favorite
Favorited
Unfavorite
1. Setting everything up
First of all you have to have Volcanoids Mod SDK installed and your mod created. In this guide we will be working with this set up.

Prerequisities:
  1. ModSDK Installed
  2. Created new mod
  3. Interior Devices Mod imported into SDK for inspiration. (Optional)
Video tutorial
- We have made a simple tutorial for you on the basic equipment for the ship.
- You too can create your own device!

Volcanoids - Interior Device modding tutorial
(old) Volcanoids - Interior Device modding tutorial


2. Setting up models
You can use your own models, or you can create one by combining existing meshes.
Device Modding scene:









  1. select preferable Device size and setting up the scene -

    First - make sure to toggle on the Gizmos display








    Next, select any Grid size you want. Those are templates, based on existing devices, but they can be adjusted to any size.
    Although before tweaking them, keep in mind that going wider or higher might penetrate the drillship walls.

    To adjust the grid size, select the GridProxy object,and in the inspector, tweak the component values








  2. Gather the kit components together













    This step is straight forward - play with the shape galery. Duplicate, scale, rotate, experiment, and create something good looking within the gizmo boundaries

    Pro tip - start with one of the base shapes












  3. Merging the mesh

    To do so, we need to open the Mesh baker Tool

    3.1 -Go to Tools > Mesh baker
















    3.2 Create new GameObject, put device parts as children














    3.3 Drag GameObject into Bake Root field








    3.4 Create another new GameObject, give it a name ,drag it into Preview field
    This will be the final output


    3.5 Click "Bake" (it asks to save the mesh...so save it)

    If you creating new mesh, make sure the output mesh window is empty ,otherwise it will overwrite the previous one

    Now in the new mesh, click on the inspector and assign materials to the Mesh Renderer component. If some parts of your model aren't visible, click on the + button to add more elements into the materials and assign them. Assets from the device modding scene use a single universal material DeviceLow.

    Thats it! New object is done and ready to be implemented in the mod prefab!
3. Finalizing prefab
First off, check that you have proper stucture of your prefab. You should have one object named after your modded device under which you will put your mesh that you created in the previous step (named 'ThroneOBJ' in the image). Here you should also create colliders and other objects your device might need (case of more advanced modding)















To create colliders, create empty object under your parent object (Throne).
Rename the object to 'Collider' or something to your liking. Click on it and in inspector add 'Collider' components (box, sphere, capsule).

In 'Material' you can choose what sound will your device make when it gets hit.
Scale and move the collider so it fits your model.
You can add multiple colliders if you wish to.








You now have all objects ready for your device, but it still needs some basic components in order for it to work properly in the game.

Click on the main parent object (BoosterDevice) and in the inspector, you can start adding components















There are many components with each having its unique use.

For interior devices, you will definitely need these:
  1. Grid module + grid module sync - Here you will assign item definition once you create it - there will be a reminder further in this modding guide.
    You can also assign item variant Icon and Name if you wish to, otherwise it will use default.
    Setup the grid size so it matches the size of your model - this grid is used for placement of your device into the drillship.














  2. Grid subpart + subpart sync - for the wall mounted devices
    Similar to Grid module, but this one is for wall mounted devices.
    Only difference is that here you just write the name of slots you want your device to be placeable on.













  3. LOD Group - here you set up Level of Detail groups, for correct rendering at distance
    You really only need a single LOD group, but you can add more if you want to optimize your model for different distance ranges.












  4. Drillship object health + Health sync - adds HP bar to your device and makes it destructible

  5. Death destroy - makes the device destroyable. In case of wall mounted devices, you also need a Subpart death component

  6. Game object events - needed for proper function of some components (assign to Drillship object health, Death destroy, Subpart death)

  7. UI Hit effect - HUD indicator showing that you hit something, set to 'HitDrillship'

  8. Production module + Functional - not mandatory, just in caase you want to add some use for your device. Sets up production booster for faster manufacturing.
If you are not sure how to set-up any of the components, go check out the Interior device sample mod
4. Creating the Icon







In the Device modding scene select game window.
  • Turn on _IconLights_ object in inspector.
  • Turn off WorldLight object in inspector
  • Place the new modded prefab under _PlaceObjectsHere_
  • Reset transforms of your prefab and hide the indication cube.






Take a printscreen in game view window.
























Now you can put the image into your mod folder, change the type from Default to Sprite and you have your mod icon ready.
5. Setting up the item
Now you have set up your model, created a prefab from it, so you have to register an item.

What do you need to do:
  1. Right-click in your Mod folder and click Create/Item/GenericItem
  2. It will create an Item Definition asset.
  3. Fill in the item name and description
  4. Fill in Category
  5. Set Icon
  6. This part is important. To the prefabs list, add your device prefab you’ve created in the steps above. You can add multiple prefabs to a single item definition. This is usefull when you want to have different color variants of the same device or maybe have both floor and wall device variants.

Example fill "Item Definition"
























Don't forget to go back into the device prefab and assign the item definition to Grid module/Grid subpart component - 'Item' window.

Now you can build your mod, upload it on steam and test it in your game!

How to build the mod is explained in the basic modding guide , section 5. Building your first mod
6. Getting into advanced modding
Now we’ve made a simple Booster Device and we will move into creating a Chair-like module. We will use Throne as an example. In general, the main point of making it work is:
  • Player has special component
  • Chair has special component that identifies module as chair

Prerequisites:
  1. Created Assembly Definition and added into mod
    (add Rock.base, Rock.Unity, Volcanoids, Unity.InputSystem, Unity.MultiplayerHLAPI.Runtime references)
  2. Copied ChairWindow from Throne in CosmeticDevices mod into your Mod folder.

First of all, create these three scripts:

Warning! Rename “Chair” in script and in file name, because it might interact with other chairs from other mods. For example if you are making a computer chair mod, name the file ComputerChair.cs. Rename the second one to ComputerChairSitter.cs. Also the third one to PlayerComputerChairSitter.cs Remember to replace those names also in the script.

Chair.cs
using UnityEngine; //This is component that will be on your Chair and will be used for interaction public class Chair : MonoBehaviour { }

ChairSitter.cs
using System.Collections; using UnityEngine; using Object = UnityEngine.Object; //Player component, used for interaction with Chair. public class ChairSitter : MonoBehaviour { [NotNull, SerializeField] public User User = null; [NotNull, SerializeField] public Animator Animator = null; [NotNull, SerializeField] public GameWindow ChairWindowPrefab = null; [NotNull, SerializeField, Tooltip("GameObject and components disabled when sitting")] private Object[] m_disabled = EmptyArray<Object>.Value; ActiveUsers m_chair; GameWindow m_windowInstance; //Currently used Chair public ActiveUsers Chair { get { return m_chair; } } private void Awake() { User.UseObjectChanged += OnUseObjectChanged; } private void OnDestroy() { User.UseObjectChanged -= OnUseObjectChanged; } public void EnterChair(ActiveUsers Chair) { User.Use(Chair); } public void LeaveChair() { if (m_chair != null) { User.Use(null); } } //Occurs when used object changes. private void OnUseObjectChanged(ActiveUsers previous, ActiveUsers current) { if (m_chair != null) { OnChairLeft(); m_chair = null; } if (current != null && current.TryGetComponent(out Chair _)) { m_chair = current; OnChairEnter(); } } //Occurs when player is going to sit on the chair private void OnChairEnter() { ActivateObjects(true); if (Player.Local == gameObject) { m_windowInstance = GameWindowManager.Instance.Open(ChairWindowPrefab, null); StartCoroutine(SittingOnChair()); } } //Occurs when player is leaving the chair private void OnChairLeft() { ActivateObjects(false); if (Player.Local == gameObject) { StopAllCoroutines(); GameWindowManager.Instance.Close(ChairWindowPrefab); } } //Changes objects void ActivateObjects(bool isSleeping) { foreach (var obj in m_disabled) { obj.SetActive(!isSleeping); } } //Invoking when sitting on the chair IEnumerator SittingOnChair() { yield return null; yield return null; //Checking for window close or Cancel button press. while (!Inputs.GetButtonDown(Axis.Cancel) && m_windowInstance.isActiveAndEnabled) { yield return null; } m_windowInstance.CloseScreen(); if (m_chair != null) { User.Use(null); } } }

PlayerChairSitter.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; //Can be opened via right-click menu navigating to Mods/PlayerChairSitter [CreateAssetMenu(menuName = "Mods/PlayerChairSitter")] public class PlayerChairSitter : BundleInitAsset { //Here you assign player prefab from the game public GameObject PlayerPrefab; //Here you assign UI Window public GameWindow ChairWindow; public override void Init() { //ContentPatch attaches scripts to the player and removes it on game end. var comp = ContentPatch.AddComponent<ChairSitter>(PlayerPrefab); comp.User = PlayerPrefab.GetComponent<User>(); comp.Animator = PlayerPrefab.GetComponent<Animator>(); comp.ChairWindowPrefab = ChairWindow; } }

Now wait for it to compile and right-click in your project folder and select Mods/PlayerChairSitter. Attach Player prefab and your window prefab, that you have copied from Throne in Cosmetic Devices mod.

By now you should have already added basic components to your device, but you will need few more for it to act like a chair. Add Active Users, Active User Slots, Proxy Use Component and Chair which you just created script for.

In Active User Slots, setup your character transforms.
You can check Interior device sample mod if you want to see how are individual components set up.

Now it shoud work and you can use it as you want. You can also upload your mod to Steam.