banner
Rating
Voted0

ReservedItemSlotCore

0
Mod version:1
Game version:2.0.33
The mod has been successfully tested for the absence of viruses
1349.29K12.84K

Report mod

  • image
modalImage

About This Mod

ReservedItemSlotCore.

The main mod for all ReservedItemSlot mods.

This mode is required for ReservedItemSlot mods such as ReservedFlashlightSlot and ReservedWalkieSlot.

These modes provide an empty inventory slot reserved for each item. These slots appear on the right side of the screen and are arranged vertically.


You cannot manually scroll the screen to move to these slots. Instead, you can switch to these items by holding down the Alt key (the default shortcut key) and swiping up and down.

This way you can navigate to and from these items or perform other actions, such as charging or saving them.


Clients using this mode must synchronize their searches for reserved items and their slots between the main Quick Access Panel and the reserved Quick Access Panel.

When appropriate, these modes have special key bindings for activating elements, even if they are not selected.


All clients running in this kernel mode will synchronize with the host and have the same reserved item slot as the host, regardless of which reserved item slot mode is set.

Using a mode that does not use a reserved host element slot will not cause any problems, but will not allow you to take advantage of additional mode features, such as reserved element-specific hotkeys.

This may change or be adjusted in the future, but it is now intended to keep the same inventory size for all to facilitate synchronization.

This also means that if I add the ability to create custom reserved item slots to the configuration or create ReservedCustomItemSlot mode, I can send custom reserved item slots from the host to other clients. Useful for.


~Use of this mode is allowed again when the host does not have a mode, but expect bugs and synchronization issues. Use with caution.

If a host does not have this mode, for various reasons this mode will be disabled on non-host clients.

Stubbornness can force the configuration to resolve it. Attention.



Buying reserved slots (new in version 2.0.0)

Reserved item slots can be purchased at the terminal. Currently buying a reserved slot items will unlock this slot for all players. There is currently no way to unlock it for each individual player.

Enter "reserved" in the terminal and you will get a hint about how to purchase a reserved slot.

Modes that support reserved slots can set a price in the settings. All of my pre-order slots have this configuration.

Purchased slots items are saved in the game save. When you cancel the save and reboot, all previously unlocked item slots will be rebooted. Unlocked slots are reset when you start a new game.

Purchasing slots items can be disabled in the settings.


Custom.

Each Reserved Item Slot mode must support the following configurations:

Added support for allowing Dedicated Item Slot modes to price slots of items in configuration.

Allows Dedicated Item Slot mode to prioritize item slots in the configuration.

The higher the priority, the lower the item slot queue on the right side of the screen.

If the priority is set to a negative value, the item slot will be displayed on the right side of the screen unless it is disabled in the configuration.

Items can now be added to reserved slots in configuration.

Added support for removing existing items from reserved slot in configuration.


Support for InputUtils.

The hotkeys associated with this mod can be controlled from the in-game keyboard shortcuts menu.

InputUtils is not a dependency, but is recommended.


API functions (new in version 2.0.0).

API functionality was added to allow developers to easily create their own Reserved Item Slot mods and add items to existing Reserved Item Slots. When creating a ReservedItemData for a specific item, developers can optionally specify the target bone for the item's skin for the player (and disguised enemies) and specify position/turn offset.


First of all, you need to add the latest version of ReservedItemSlotCore.dll to the VS project reference.

Warning:

Adding items that do not exist in ReservedItemSlotData (accidentally or from unloaded mods) will not break anything.

Adding an item created from an unloaded mod to an existing ReservedItemSlotData will not break.


Add items from MOD to an existing ReservedItemSlot

If ReservedItemSlotCore is enabled, you can use it to add items from your own mod to an existing ReservedItemSlot created by another mod.


Create a class like this in a separate file.


ReservedItemSlotCore.Data;


public static class ReservedItemSlotsCompat.

{

  public static void AddItemsToReservedItemSlots().

  {

    // Name of the item to be displayed in the game.

    ReservedItemData myReservedItemData = new ReservedItemData("ItemDisplayName");

     

    // It does not matter if the mode that created this slot for the item is not enabled on the client. Nothing will be broken.

    ReservedItemSlotData.TryAddItemDataToReservedItemSlot(myReservedItemData, "nameOfItemSlot");

  }

}


} or make the object visible while it is in the sleeve:



ReservedItemSlotCore.Data;


public static class ReservedItemSlotsCompat.

{

  public static void AddItemsToReservedItemSlots().

  {

    // Arguments: ItemDisplayName, ParentBone(enum), PositionOffset, RotationOffset

    ReservedItemData myReservedItemData = new ReservedItemData("ItemDisplayName", PlayerBone.Spine3, new Vector3(0.2f, 0.25f, 0), new Vector3(90, 0, 0))

   

    // The mode that created this slot for the item does not need to be enabled on the client. Nothing is broken.

    ReservedItemSlotData.TryAddItemDataToReservedItemSlot(myReservedItemData, "nameOfItemSlot");

  }  

}


Then add the following to the Wake (or Initialise) method of the Plugin class (preferably after the configuration binding):

If your mod isn't tied to ReservedItemSlotCore and only optionally adds items if there are reserved items slots available, it's very important to check if that mod is valid.


if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("FlipMods.ReservedItemSlotCore"))

  ReservedItemSlotsCompat.AddItemsToReservedItemSlots(); // this is a function call.


Finally, add this SoftDependency header above the Plugin class definition.

If your mod depends on ReservedItemSlotCore, you can change the BepInDependency.DependencyFlags.SoftDependency header to BepInDependency. Can be changed to HardDependency.


[BepInDependency("FlipMods.ReservedItemSlotCore", "BepInDependency.DependencyFlags.SoftDependency")] // Add the following lines.

[BepInPlugin("EXAMPLE_MOD_GUID", "EXAMPLE_MOD_NAME", "1.0.0")] // You should already have this line above the plugin class definition.

Public class Plugin : BaseUnityPlugin.

{

  .

}

Create your own ReservedItemSlot slot

This is an example of creating your own ReservedItemSlotData and adding MOD items (or existing in-game items) to an item slot.

Write this code in the Awake (or Start) method of the Plugin class. You do not need to create a separate file or class when you add this code.


ReservedItemSlotCore.Data;


// Make sure that this header is at the top of the Plugin class.

[BepInDependency("FlipMods.ReservedItemSlotCore", BepInDependency.DependencyFlags.HardDependency)]

[BepInPlugin("EXAMPLE_MOD_GUID", "EXAMPLE_MOD_NAME", "1.0.0")] // You should already have this string above the definition of the Plugin class.

Public class Plugin : BaseUnityPlugin.

{

  private void Awake().

  {

    // Existing Code...


    // This saves your ReservedItemSlotData and will be added to the game if the host mode is started.

    // Arguments Arguments: ItemSlotName (format is not very important), ItemSlotPriority, ItemSlotPrice

    ReservedItemSlotData myReservedItemSlot = ReservedItemSlotData.CreateReservedItemSlotData("my_item_slot_name", 20, 100);


    // Create a ReservedItemData for the element.

    // Additional arguments can be added so that this item can be displayed to the player in the sleeve (see the previous example)

    ReservedItemData myReservedItemData = new ReservedItemData("ItemDisplayName");


    // Add ReservedItemData to ReservedItemSlotData and you're done!

    myReservedItemSlot.AddItemToReservedItemSlot(myReservedItemData);

  }

}


Other API Functions

The following is an example of receiving and managing a player's reserved items.


PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;

for (int i = 0; i < SessionManager.numReservedItemSlotsUnlocked; i++)

{

  ReservedItemSlotData itemSlotData = SessionManager.GetUnlockedReservedItemSlot(i);

  if (itemSlotData ! = null)

  {

    // Get the index of this slot in the player's inventory.

    int indexInPlayerInventory = itemSlotData.GetIndexInventory(localPlayerController); // Any player controller can be transferred.



    // Get the object that is currently in this slot from this player.

    GrabbableObject heldObjectInSlot = itemSlotData.GetHeldObjectInSlot(localPlayerController); 



    // Obtains the item slot frame (HUD display component) for this item slot. Valid only for local player.

    Image itemSlotFrameHUD = itemSlotData.GetItemSlotFrameHUD();



    // To check if a reserved item slot accepts a certain item (the item name as it looks in the game).

    // You can also pass the link to GrabbableObject.

    if (itemSlotData.ContainsItem("Flashlight"))

      Plugin.Log("This slot contains a flashlight");

  }

}


If you are creating your own ReservedItemSlotData, also add the following line to the dependencies list in the manifest.json file.

"FlipMods-ReservedItemSlotCore-2.0.7".



If you want to see more examples, feel free to look at the available ReservedItemSlot mods on my github!

If you think that I missed something or ran into any problems, please let me know! I'm quite active in the Lethal Company modding discod, so come and find me!

You can also post problems on github Fashion!


ReservedItemSlot Fashions

ReservedFlashlightSlot

ReservedWalkieSlot

Reserved Weapon Slot

Reserved Auxiliary Slot

Reserved Spray Slot

More fashion for reserved slots items can be found at the Thunderstore!


Mode Compatibility

HotbarPlus is compatible!

LethalThings Utility Belt is compatible (should be compatible) (hopefully still intact).

This mod may not be compatible with Advanced Company. Use at your own risk!

Other mods that add hotbar slots are not guaranteed to work.

Other mods that move hotbar (HUD) slots do not guarantee working with these mods, but can technically work.

Similar Mods/Addons

Game Version *

2.0.33 (FlipMods-ReservedItemSlotCore-2.0.33.zip)