You are viewing a potentially older version of this package. View all versions.
JacobG5-ReservedJsonSlots-1.2.0 icon

ReservedJsonSlots

Allows adding item slots with JSON files.

Date uploaded a week ago
Version 1.2.0
Download link JacobG5-ReservedJsonSlots-1.2.0.zip
Downloads 2351
Dependency string JacobG5-ReservedJsonSlots-1.2.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100
FlipMods-ReservedItemSlotCore-2.0.35 icon
FlipMods-ReservedItemSlotCore

V62 Compatible! The core mod for all ReservedItemSlot mods. Adds functionality for all ReservedItemSlot mods and adds API functions!

Preferred version: 2.0.35
Rune580-LethalCompany_InputUtils-0.7.10 icon
Rune580-LethalCompany_InputUtils

API/Library for creating Unity InputActions with in-game re-binding support. Provides an alternative UI that allows for supporting mods to have in-game re-bindable keybinds.

Preferred version: 0.7.10
JacobG5-JLL-1.9.5 icon
JacobG5-JLL

Jacob's Lethal Libraries - For Jacob's Mods

Preferred version: 1.9.5

README

Reserved Json Slots

This mod allows users to easily add item slots for whatever they want in their game using JSON files.

Everyone in the lobby has to have the SAME .json files.

How To Set Up

If you're familiar with .json formatting this should be pretty easy to set up on your own.

On the first launch, it will generate an example reserved tool belt slot.

Go to BepinEx/config/JsonReservedSlots

In that folder, you will find UtilityBeltSlot.json and PlayerBones.txt

JSON Formatting

After the first launch the mod should generate UtilityBeltSlot.json

You can open this file and use it as an example for building your own utility slots.

reservedSlotName is the name of your slot. Proper formatting should be all lowercase and underscores with no spaces.

slotPriority is used by ReservedItemSlotCore to determine the position of your item slot on the side of the screen relative to other item slots. Negative numbers are used to place slots on the left side of the screen instead of the right. Make sure your config for ReservedItemSlotCore is set up correctly.

purchasePrice is the price of buying the slot from the terminal if you have buying slots enabled in ReservedItemSlotCore enabled. When the price is set to 0 it will automatically be unlocked even if buying slots is enabled.

itemsForSlot is an array of all the items the player can put inside your slot.

The only thing each item in itemsForSlot requires is itemName. itemName is case-sensitive and should be the name of an in-game item. You can add as many of these as you'd like.

If you want to get more advanced you can also give each item in itemsForSlot a bone, position, and rotation value. If you set the bone to anything other than 0 it will show the item cosmetically on the player's body.

requiredMods is a list of strings you can use to define BepinEx Plugin GUIDs. As long as one of the mods listed in this field are loaded the slot will be registered. If none of the mods are present the slot will not be registered.

Keybinds Formatting

There are two keybinds you can add to your reserved slot: useKeybind && equipKeybind

equipKeybind is a keybind to hold the item in that slot.

useKeybind is a keybind to trigger the item in your custom slot's use rpc. This allows you to interact with an item without even holding it. Because some items may not account correctly for being triggered while not held by a player, and this mod does not include any patches for any items, it may not work with all items. You can feel free to experiment and see if it works with items you want to play with but if it ultimately does not work then don't be suprised. I will not be making patches for any items in this mod.

A keybind is defined as an object with 3 properties: defaultBind, toggle & repocket

defaultBind sets the default key on the keybaord to trigger this action. When left empty will register the keybind as unbound. You manually will have to bind a key in the in game menu.

toggle determines if you have to hold down the button for it to remain active or if it should toggle on/off each time you press it.

repocket only applies to useKeybind and when set to true will send the pocket item rpc immediantly after triggering the use item rpc. This can serve as a way to reset an item to realize it is pocketed after using it. I recomend having this turned off for most items but if you notice weird behavior you can try turning this on and seeing if it fixes it.

PlayerBones

When the config folder is generated you should find PlayerBones.txt inside.

This text file contains the IDs of every player bone. You can use this to set what bone items are attached to to make them visible on the player's body. If you set it to 0, the id for None, or if you don't include a bone, it will not show the item on the player's body.

As of v1.2.0 you can now just type the name of bones as listed in the PlayerBones.txt file. The IDs also work for legacy reasons. This file is still useful to view valid names for player bones.

REMINDER:

This mod only looks for .json files located inside the BepInEx/config/JsonReservedSlots folder. If your .json files are not in this folder then they WILL NOT be registered in game.

ReservedItemSlotCore

This mod uses ReservedItemSlotCore by FlipMods

You should totally check out their other mods because they make some great stuff.

Examples:

Here is an example of a reserved Key slot:

{
  "reservedSlotName": "key_slot",
  "slotPriority": -100,
  "purchasePrice": 0,
  "itemsForSlot": [
    {
      "itemName": "Key"
    }
  ]
}

Here is an example of Reserved Flashlight Slot in JSON format:

{
  "reservedSlotName": "flashlight",
  "slotPriority": 200,
  "purchasePrice": 200,
  "itemsForSlot": [
    {
      "itemName": "Flashlight",
      "bone": 4,
      "position": {
        "x": 0.2,
        "y": 0.25,
        "z": 0.0
      },
      "rotation": {
        "x": 90.0,
        "y": 0.0,
        "z": 0.0
      }
    },
    {
      "itemName": "Pro-flashlight",
      "bone": 4,
      "position": {
        "x": 0.2,
        "y": 0.25,
        "z": 0.0
      },
      "rotation": {
        "x": 90.0,
        "y": 0.0,
        "z": 0.0
      }
    },
    {
      "itemName": "Laser pointer",
      "bone": 4,
      "position": {
        "x": 0.2,
        "y": 0.25,
        "z": 0.0
      },
      "rotation": {
        "x": 90.0,
        "y": 0.0,
        "z": 0.0
      }
    }
  ],
  "useKeybind": {
    "defaultBind": "f",
    "toggle": true,
    "repocket":  true
  }
}

Here is an example of Reserved Walkie Slot in JSON format:

{
  "reservedSlotName": "walkie_talkie",
  "slotPriority": 150,
  "purchasePrice": 150,
  "itemsForSlot": [
    {
      "itemName": "Walkie-talkie",
      "bone": 4,
      "position": {
        "x": 0.15,
        "y": -0.05,
        "z": 0.25
      },
      "rotation": {
        "x": 0.0,
        "y": -90.0,
        "z": 100.0
      }
    }
  ],
  "useKeybind": {
    "defaultBind": "r",
    "toggle": false
  },
  "equipKeybind": {
    "toggle": false
  }
}

CHANGELOG

v1.2.0

  • PlayerBone fields now allow you to type the bone name in the form of a string. Putting an integer like before still works too.
  • Added requiredMods field. Set this to a list of BepinEx Plugin GUIDS and if none of the plugins listed are loaded the slot won't be registered.
  • Keybinds should now be unusable when in the terminal menu.
  • Added JLL as a dependancy so I can reuse some code.
  • Json Reserved Slots now get registered during the PreInitScene instead of plugin awake to ensure PluginInfos are set up for all mods before initialization.
  • Removed some extra debug logging.
  • Updated Example Belt slot to show how to set up some of the new features.

v1.1.2

  • Readme Update
  • Repocket should now only happen when the item triggered with the keybind is not the actively held item.
  • Keybinds should now be able to trigger slot items in other slots that are not the active slot or a reserved slot.

v1.1.1

  • Readme Update

v1.1.0

  • You can now define keybinds in your json for using the item and equipping your reserved slot via hotkey.
  • Keybinds can be set as either a toggle or a hold to use in the json. Additionally there is a boolean for repocketing on the use keybind. This will trigger the pocket item rpc after triggering it's use rpc. Depending on the item this could fix some odd behavior such as using a flashlight and the light staying parented to the player's hand instead of becoming docked on their shoulder. Please note that the use keybind will not work on all items. You are free to experiment but some items may cause errors. This is use at your own risk.
  • Added LethalCompanyInputUtils as a dependancy for making keybinds easier.
  • Json Slots now have a display name field used for logs and as the name displayed in the keybinds menu when applicable. If this field is left empty it will use the filename of the json file as the display name.
  • When the reservedSlotName is left blank it now will not be registered instead of causing problems.
  • reservedSlotName now is forced to be lowercase with _'s in place of spaces. You where supposed to already be doing this but some people weren't so now I'm forcing the formatting on you.
  • If the name is left blank for an item in the slot's item infos it now gets removed during initialization.
  • Removed some unnecessary logging.

v1.0.1

  • Changed price and priority values for the Belt Bag slot it generates on first launch.
  • Added more examples to README.
  • Changed the order of text in the README a bit.

v1.0.0 Release

  • Allows creation of ReservedItemSlots through JSON files.