Cookie_K-GearSwapAPI icon

GearSwapAPI

Development API for swapping gear in an expedition. Mainly just for my own mods

Last updated 3 days ago
Total downloads 526
Total rating 0 
Categories Dev Tools
Dependency string Cookie_K-GearSwapAPI-1.0.2
Dependants 1 other mod depends on this mod

This mod requires the following mods to function

BepInEx-BepInExPack_GTFO-2.0.1 icon
BepInEx-BepInExPack_GTFO

BepInEx pack for GTFO. Preconfigured and includes Unity Base DLLs.

Preferred version: 2.0.1

README

Gear Swap API

A bepinex plugin API that allows for swapping your local player's gear whilst in an expedition

Note: this is an API for plugin developers and does not have any effect on game play on its own

Methods and Properties

GearSwapManager#RequestToEquip(GearId id)
GearSwapManager#SwappableGearSlots
GearSwapManager#SetPickUpSentryOnToolChange

Everything needed to use this API is exposed via the GearSwapManager class

  1. GearSwapManager#RequestToEquip(GearId id): Requests to equip the given GearId (you can find GearIds through methods like GearManager#GetAllGearForSlot(InventorySlot slot)). As the name suggests this does not equip the gear right away. The swap will be postponed until certain conditions are met to avoid a plethora of issues surrounding change of weapons and tools (see Blocking Operations below for more details).

  2. GearSwapManager#SwappableGearSlots: List of InventorySlot that this API can swap. Currently it can swap GearMelee, GearStandard, GearSpecial, and GearClass.

  3. GearSwapManager#SetPickUpSentryOnToolChange(bool pickUp): Sets whether to pick up any sentry guns deployed by the player when tool is swapped (default false). If set to true, any sentry gun deployed by the player will be picked up and have its tool ammo refunded to the player. Otherwise it will leave the sentry deployed even if different tool is given.

Blocking Operations

Gear can not be swapped while these conditions are true to avoid issues and annoyances surrounding changing weapons

  1. Gear is Aimed or is Firing (counts bio charging and c-foam firing)
  2. Player is hacking
  3. Melee not in idle
  4. Player is interacting with world (pick up item, climb ladder, etc)
  5. Player is carrying level items (cell, turbine, etc)

Things To Note About Gear Swapping

  • Ammo is kept consistent by the % value not by the hidden ammo value in player ammo storage
  • 1% ammo is given to the player to compensate for precision errors causing players to slowly lose ammo
  • Sentry guns hold the player's tool ammo and the player will have 0 tool ammo on them selves
  • Deployed sentries can be picked up by the owner to recover tool ammo (even if you no longer have the sentry in your inventory)
  • Picking up mines whilst holding another tool will only refund a single clip of tool and not the % amount the mine is worth

Patches

1.0.2

  • Updated for R7

1.0.1

  • Fixed issue where level items some times disappeared when changing weapons while interacting

Developed by Cookie_K

Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2022-8-4 1.0.2 39 Version 1.0.2 Install
2021-10-24 1.0.1 405 Version 1.0.1 Install
2021-10-16 1.0.0 82 Version 1.0.0 Install