Repository navigation
Mod Detection
CMF tracks which mods are active in the current game so you can detect whether another mod is loaded. This is useful for cross-mod compatibility and optional integration.
cmf_is_mod_active returns true when a mod with the given id is active in the current game.
if = {
limit = {
cmf_is_mod_active = { mod_id = some_other_mod }
}
# This will run only when some_other_mod is loaded
}
The mod_id is the same id the mod registers with.
cmf_was_mod_active_at_game_start returns true when a mod was active at the moment this game was first started as a new game.
if = {
limit = {
cmf_was_mod_active_at_game_start = { mod_id = some_other_mod }
}
# Runs only when the game was started with some_other_mod
}
cmf_game_start_mods_recorded is false for saves created before this feature was added to CMF, where the game-start mod list isn't set.
Any mod that registers CMM settings is registered automatically. If your mod does not register any CMM settings, call cmf_register_mod so other mods can detect it. Call it from your cmf_on_mod_registration hook:
# in_game/common/on_action/your_on_actions.txt
cmf_on_mod_registration = {
on_actions = {
your_mod_on_register
}
}
your_mod_on_register = {
effect = {
cmf_register_mod = { mod_id = your_mod_id } # The mod id can be anything you choose, but using something too simple can result in conflicts
}
}