-
Notifications
You must be signed in to change notification settings - Fork 7
Support using Mod Call
Some minions are special and require a Mod.Call
to properly display and work for various things Summoners' Association adds (such as the Summoners' Association Card or the Minion Loadout Book). These include minions composed of multiple projectile types (Twins) and minions where the projectile count doesn't necessarily match up with the number of minions (Stardust Dragon).
Note: If your simple minion is not properly displaying, first make sure your minion summon item has buffType
set and shoot
set to the minion projectile type. Also make sure that the projectile has minionSlots
assigned as well.
Note: If your summon weapon is not appearing in the Loadout Books, make sure it has all of these properties: Counts as Summon damage class, not a sentry, not a whip, has to spawn a projectile on use via Item.shoot
. There is NO way to manually add items to the Loadout Books via calls.
IF something doesn't work with your minions, you'll need to use a Mod.Call
call in Mod(System).PostSetupContent
to inform Summoners' Association. Make sure to follow the message format perfectly.
Mod.Call
allows for mods to communicate with each other and cooperate, more info on Mod.Call
can be learned from the tModLoader wiki. This guide will go through each Mod.Call
pattern and corresponding arguments in detail below.
-
If you have any weapons that summon a non-whole number amount of minion slots on use, make sure to assign
ItemID.Sets.StaffMinionSlotsRequired[Item.type] = amount;
for your item accordingly -
"AddMinionInfo", int itemID, int buffID, int projectileID, float slots
becomes:"AddMinionInfo", int itemID, int buffID, Dictionary<string, object> projModel
-
"AddMinionInfo", int itemID, int buffID, List<int> projectileIDs, List<float> slots
becomes:"AddMinionInfo", int itemID, int buffID, List<Dictionary<string, object>> projData
-
"GetSupportedMinions"
return type is the same, except the underlying data previously storingProjectileIDs
andSlots
is now unified into a single object of typeList<Dictionary<string, object>>
indexed via"ProjData"
Disclaimer: The calls here are up-to-date with 1.4.4. If you are modding on an older version, some of the calls may be different or won't exist.
"AddMinionInfo", int itemID, int buffID, int projectileID
"AddMinionInfo", int itemID, int buffID, List<int> projectileIDs
"AddMinionInfo", int itemID, int buffID, Dictionary<string, object> projModel
"AddMinionInfo", int itemID, int buffID, List<Dictionary<string, object>> projData
This call registers a minion weapon, a minion buff, and one or multiple minion projectiles to Summoners' Association for use in various features.
1. is generally not necessary if your item it set up properly and the weapon only summons 1 minion (See the note above, the mod auto-registers minion info like this).
2. is required if your item summons more than one projectile in general (i.e. all at once/cycling/random) - All minions need to be included in the call.
The remaining calls (3. and 4.) utilize a dictionary approach to specify data about the projectile(s) via a "model", it's syntax is as follows:
new Dictionary<string, object>() {
["ProjID"] = ProjectileType<MinionProjectile>(),
["Slot"] = 1f, //Optional, inferred from minionSlots
}
This is required whenever the default behavior (i.e. fetching the slot via minionSlots
) is insufficient. It can be useful if you have a Stardust Dragon type minion (which has 4 segments, 2 of which have 0.5 slots): The default behavior would show something completely wrong on the Summoners' Association Card, so instead what you can do is specify one of the middle segments and give it a "Slot" of 1f, and give all other segments 0f slots.
"AddTeleportConditionMinion", int projectileID
"AddTeleportConditionMinion", int projectileID, Func<Projectile, bool> condition
This call is required so that your minion will not teleport when the Minion Control Rod teleport ability is used. The second variation accepts a custom condition to be able to dynamically allow or prevent it if needed. Examples: Storm Tiger-like "counter" projectile that is a minion but should not be teleported, or if a minion hovers over your head and should never move.
"GetSupportedMinions", Mod mod, string apiVersionString
This call lets you access all the information about minions that Summoners' Association has generated (and collected from other mods via Mod.Call
). It should be called in ModSystem.PostAddRecipes
instead of PostSetupContent
to ensure it contains all info registered by other mods.
-
Mod mod
: Your own mod. usually theMod
property, orthis
if already in your Mod class. -
string apiVersionString
: The version of Summoners' Association that you have last used with your mod, in the form ofnew Version(1, 2, 3, 4).ToString()
It returns a List<Dictionary<string, object>>
, where each element contains the following info:
-
"ItemID" (int)
: The item type -
"BuffID" (int)
: The buff type -
"ProjData" (List<Dictionary<string, object>>)
: the projectile(s) (only 1 entry if 1 minion). Each element in the list is structured like explained in the AddMinionInfo call.
See SummonersAssociationIntegrationExample.cs for the full breakdown of how to call it, store its return, and how to act on that data. You are free to copy that file into your own mod aswell.
"AddPersistentBuff", int buffID
New in v0.5.3!
Flags a buff as persistent on death and world exit. Use this on any buffs that provide max minion or sentry slots.
Here's a code snippet that can be put into a Mod
or ModSystem
class into the PostSetupContent
method showcasing the calls (not everything is showcased here)
if (!ModLoader.TryGetMod("SummonersAssociation", out Mod summonersAssociation))
{
return;
}
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<ItemClass>(), ModContent.BuffType<BuffClass>(), ModContent.ProjectileType<ProjectileClass>());
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<ItemClass>(), ModContent.BuffType<BuffClass>(), new List<int>
{
ModContent.ProjectileType<ProjectileClass1>(),
ModContent.ProjectileType<ProjectileClass2>(),
ModContent.ProjectileType<ProjectileClass3>(),
});
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<ItemClass>(), ModContent.BuffType<BuffClass>(), new List<Dictionary<string, object>>
{
new Dictionary<string, object>()
{
["ProjID"] = ModContent.ProjectileType<ProjectileClass1>(),
},
new Dictionary<string, object>()
{
["ProjID"] = ModContent.ProjectileType<ProjectileClass2>(),
["Slot"] = 0.5f,
},
});
summonersAssociation.Call("AddTeleportConditionMinion", ModContent.ProjectileType<ProjectileClass>());
summonersAssociation.Call("AddTeleportConditionMinion", ModContent.ProjectileType<ProjectileClass>(), (Projectile p) => ((ProjectileClass)p.ModProjectile).CanTeleport);
// "GetSupportedMinions" is showcased in SummonersAssociationIntegrationExample.cs
summonersAssociation.Call("AddPersistentBuff", ModContent.BuffType<SummoningPotionForSentries>());