Skip to content

Mod.Call

pbone edited this page Apr 26, 2026 · 1 revision

Other mods may implement support for Extra Equipment Loadouts by using its Mod.Call method.

For a nicer interface to these, consider copying in the LoadoutHelper file into your mod. It calls these methods when Extra Equipment Loadouts is loaded, or transparently falls back to the appropriate Vanilla variables and methods if it is not.

Terminology

Extra Equipment Loadouts uses the following terms to refer to different concepts:

  • Extra loadout vs Default loadout: An extra loadout is a loadout added by Extra Equipment Loadouts, whereas a default loadout is one of the three Vanilla loadouts. The indices of extra loadouts (as used by numerous Mod.Call methods) begin at 0 for loadout 4, 1 for loadout 5...
  • Vanilla vs ModLoader: In the context of a loadouts, Vanilla refers to the loadout's Terraria.EquipmentLoadout (storing the Vanilla Terraria armor, accessory, and dye slots) and ModLoader refers to the loadout's Terraria.ModLoader.Default.ModAccessorySlotPlayer.ExEquipmentLoadout object (storing ModAccessorySlot armor, accessory, and dye items).

Mod.Call argument format

The first argument of every Mod.Call is a string indicating a "method" to call. The remaining arguments depend on the method type

Methods

AreWeCallYet.0

Takes no additional arguments. Returns true if this version of Extra Equipment Loadouts support Mod.Call (version >= 2.0.0).

CurrentExtraLoadoutIndex.0

Takes a Player argument. If the player is on an extra loadout, returns the extra loadouts index; otherwise, returns -1.

TotalExtraLoadouts.0

Takes no additional arguments. Returns the number of loadouts added by the mod.

GetExtraLoadoutVanilla.0

Takes a Player argument and an int extra loadout index. Returns the Vanilla EquipmentLoadout object for the player's extra loadout with the given index.

GetExtraLoadoutModLoader.0

Takes a Player argument and an int extra loadout index. Returns the ModLoader ExEquipmentLoadout object for the player's extra loadout with the given index.

SwitchToExtraLoadout.0

Takes a Player argument and an int extra loadout index. Switches the player to the extra loadout of the given index.

AddPostSwapLoadoutCallback.0

Takes an Action<Player, bool, int, bool, int> argument. Registers a callback to be called when a player switches loadouts, after all loadout swapping has occurred. This is provided as an alternative to the ModPlayer.OnEquipmentLoadoutSwitch, as this is only called when switching between default loadouts to avoid causing issues with mods that do not expect loadout indices outside of the default range (0-3).

AddPreSwapLoadoutCallback.0

Takes an Action<Player, bool, int, bool, int> argument. Registers a callback to be called when a player switches loadouts, before all loadout swapping has occurred. This is provided as an alternative to IL editing on hooking Player.TrySwitchingLoadouts to insert your call, as Extra Equipment edits this method as well and two mods editing the same method may experience incompatibilities.