Mod Calls

From Calamity Mod Wiki
Jump to navigation Jump to search

Mod Calls are special functions that can be used with tModLoader's .Call() function to get or set different values from other mods. This page lists the Mod Calls that are provided by the Calamity Mod along with what they are used for.

Note that Rogue damage and Rogue crit are affected by vanilla Throwing stats, and adding to Rogue stats through these calls will add on top of any throwing stats the player is given.

An asterisk (*) after a parameter type indicates that the function accepts multiple arguments of that type at once. Optional arguments will be specified, along with their default value if applicable.

Mod Calls Table

Function Returns Parameters
GetBossDowned (bool) Whether the boss or event has been defeated. (string) The boss or event to check for. Many different aliases are accepted.
GetInZone (bool) Whether the specified player is in a given Calamity biome or area. (Player) The player whose locale is being questioned.
(string) The zone or area name to check. Many aliases are accepted.
GetDifficultyActive (bool) Whether the Calamity difficulty modifier is currently active. (string) The difficulty modifier to check for. Many aliases are accepted.
SetDifficultyActive (bool) If it has succeeded or not. (string) The difficulty modifier to toggle on or off. Many aliases are accepted.
GetRogueVelocity (float) The specified player's rogue projectile speed modifier. 1f = no bonus, 2f = +100%. (Player) The player whose rogue velocity is being queried.
AddRogueVelocity (float) The specified player's new rogue projectile speed modifier. (Player) The player whose rogue damage is being modified.
(float) The amount of rogue velocity to add or subtract (if negative).
GetCurrentStealth (float) The specified player's current stealth. 0.1f = 10, 0.5f = 50. (Player) The player whose stealth is being queried.
GetMaxStealth (float) The specified player's maximum stealth. 0.1f = 10, 0.5f = 50. (Player) The player whose maximum stealth is being queried.
AddMaxStealth (float) The specified player's new maximum stealth. (Player) The player whose max stealth is being modified.
(float) The amount of stealth to add or subtract (if negative).
GetSetBonus (bool) Whether the specified player has the set bonus given. (Player) The player whose set bonuses are being queried.
(string) The set bonus to check for. Many aliases are accepted.
SetSetBonus (bool) Whether any set bonus was adjusted. (Player) The player whose set bonuses are being modified.
(string) The set bonus to modify. Many aliases are accepted.
(bool) Whether the set bonus should be enabled or disabled.
GetLightStrength (int) The specified player's light strength. (Player) The player whose light strength is being queried.
AddAbyssLightStrength (void) (Player) The player whose light strength is being modified.
(int) The light strength to add to the Abyss.
MakeColdImmune (bool) Whether the player is now cold immune. (Player) The player to make cold immune.
MakeHeatImmune (bool) Whether the player is now heat immune. (Player) The player to make heat immune.
SetDamageReduction (float) The NPC's old damage reduction. 0.1f = 10%, 0.5f = 50%. (int) The ID of the NPC whose dr is being modified
(float) The new dr for the NPC.
BossHealthBarVisible (bool) Whether Calamity's Boss Health Bar is visible. None.
SetBossHealthBarVisible (bool) Whether the visibility was changed. (bool) Whether the Boss Health Bar should be visible or invisible.
GetCalamityRarity (int) The rarity of the given item. (Item) The item whose rarity is being queried.
SetCalamityRarity (int) The new rarity of the given item. (Item) The item whose rarity is being modified.
(int) The new rarity of the item.
GetDoGCountdown (int) The countdown until a new sentinel is spawned, in frames. n/a
AcidRainActive (bool) Whether the Acid Rain is currently active or not. n/a
StartAcidRain (bool) True. n/a
StopAcidRain (bool) True. n/a
AbominationnClearEvents (bool) True if the Acid Rain has not been successfully cleared, else false. (bool) If the Abominationn can currently clear events.
ExcludeMinionsFromResurrection (null) (Projectile*) The minion/s to set not to respawn with the player.
CreateEnchantment (null) (string) The name for the enchantment.
(string) The description for the enchantment.
(int) The id for the enchantment.
(Predicate<Item>) A predicate used to determine if an item can be enchanted or not.
(string) The path to the texture for the enchantment. May also be null, if no texture should be drawn.
(Action<Item>) (optional) The hold effect for the enchantment.
(Action<Player>) (optional) The creation effect for the enchantment.
MakeItemExhumable (null) (int) The id of the item to be exhumed.
(int) The id of the resulting exhumed item.
DeclareMiniboss (null) (int) The id of the NPC to be set as a miniboss.
ExcludeBossFromHealthbar (null) (int) The id of the NPC to be excluded from having a Calamity boss health bar.
DeclareOneToManyRelationshipForHealthBar (null) (int) The id of the NPC to act as a key for the relationship.
(int*) The ids of the all the NPCs in the relationship, including the key NPC.
DeclareSpecialHPCalculationDecisionForHealthBar (null) (Func<NPC, bool>) The function to decide whether each NPC applies for this special health calculation. Returns whether the specified NPC should get special health calculations or not.
(Func<NPC, bool, long>) The function that does the special HP calculations. The boolean parameter specifies if the function accumulates max health (true) or just health (false). Returns the calculated health for the given NPC.
CreateNameExtensionHandlerForHealthBar (null) (string) The name of the extension to create.
(int) The id of the main NPC for the extension.
(int*) The ids of the NPCs in the extension, which may or may not include the main NPC.
GetBossRushEntries (List<(int, int, Action<int>, int, bool, float, int[], int[])>) A list of tuples representing the boss rush entries. The values inside the tuples have the following meanings: NPC id, time change (1: day, -1: night, 0: no change), boss spawning function, overriding countdown, whether the boss needs a special sound effect on spawn, the dimness factor to use once the boss is spawned, ids of NPCs to not be deleted once the boss spawns, list of any other NPC ids that need to be killed for the event to progress. n/a
SetBossRushEntries (null) (List<(int, int, Action<int>, int, bool, float, int[], int[])>) A list of tuples representing the boss rush entries to add. Explanations of the values can be found in the above entry.
CreateCustomDeathEffectForBossRush (null) (int) The id of the NPC to have the custom effect.
(Action<NPC>) The custom death effect to be set for the given NPC.
LoadParticleInstances (null) (Mod) The id of the mod to load particles from.
RegisterModCooldowns (null) (Mod) The id of the mod to register cooldowns from

Aliases

Some of the functions above mention accepting different aliases for the string parameters. One alias for each flag will be listed below in tables for each function, however alternatives that use different cases or spacing will still be accepted.

GetBossDowned

Queriable Strings
acidrain
acidraineoc
desertscourge
giantclam
crabulon
hivemind
perforator
slimegod
hmclam
cryogen
acidrainscourge
aquaticscourge
brimstoneelemental
calamitas
greatsandshark
anahitaleviathan
astrumaureus
plaguebringergoliath
ravager
astrumdeus
guardians
dragonfolly
providence
polterghast
oldduke
ceaselessvoid
stormweaver
signus
anysentinel
allsentinel
devourerofgods
yharon
exomechs
supremecalamitas
adulteidolonwyrm

GetInZone

Queriable Strings
crags
astral
sunkensea
sulphursea
abyss
layer1
layer2
layer3
layer4

DifficultyActive

Queriable Strings
revengeance
death
bossrush

SetBonus

Some strings given here can be appended with _classname to get a specific class's version of that set bonus where appropriate (for example, statigel_summon or bloodflare_melee). reaver_speed, reaver_explore, and reaver_defense are used to refer to the Reaver Visage, Headgear, and Helms's set bonuses respectively.

Queriable Strings
desertprowler
snowruffian
sulphur
victide
aerospec
mollusk
titanheart
forbidden_circlet
daedalus
reaver
fathomswarmer
brimflame
umbraphile
hydrothermic
plaguereaper
plaguebringer
astral
empyrean
tarragon
prismatic
bloodflare
omegablue
godslayer
fearmonger
silva
auric
demonshade

Notes

  • Providing incorrect or too few/many arguments to any of these functions will result in an ArgumentException being thrown.