Semi Mod Loader
|
Public Member Functions | |
string | GetFullResourcePath (string res_path) |
Expands a path relative to the mod resources directory into an absolute path. Additionally, it will convert forward slash directory separators into backward slashes on Windows. Resource paths can only use forward slashes - this method will throw if it detects a backward slash. More... | |
string | GetFullID (string id, bool require_local) |
Expands an ID, filling in context namespace if necessary. More... | |
SpriteDefinition | CreateSpriteDefinition (string id, string sprite_path) |
Creates a single sprite definition from an image resource. More... | |
SpriteDefinition | RegisterEncounterIcon (string id, string sprite_path) |
Registers an encounter icon (used for example in the Ammonomicon) from an image resource. More... | |
SpriteCollection | RegisterSpriteCollection (string id, params SpriteDefinition[] defs) |
Registers a new sprite collection. More... | |
Sprite | RegisterSpriteTemplate (string id, string coll_id, string start_def_id=null) |
Registers a new sprite template. More... | |
I18N.ModLocalization | RegisterLocalization (string id, string path, string lang_id, I18N.StringTable table, bool allow_overwrite=false) |
Registers a new localization. More... | |
T | RegisterItem< T > (string id, string enc_icon_id, string sprite_template_id, string name_key="", string short_desc_key="", string long_desc_key="") |
Registers a new PickupObject. More... | |
AdvancedSynergyEntry | RegisterSynergy (string id, string name_loc_id, int objects_required, string[] optional_gun_ids=null, string[] mandatory_gun_ids=null, string[] optional_item_ids=null, string[] mandatory_item_ids=null, List< StatModifier > stat_modifiers=null, bool active_when_gun_unequipped=false, bool ignore_lich_eye_bullets=false, bool require_at_least_one_gun_and_one_item=false, bool suppress_vfx=false, Gungeon.SynergyStateChangeAction on_activated=null, Gungeon.SynergyStateChangeAction on_deactivated=null) |
Registers a new synergy. More... | |
SpriteCollection | LoadSpriteCollection (string path) |
Loads a sprite collection in Semi Collection format. More... | |
SpriteAnimation | LoadSpriteAnimation (string path) |
Loads a sprite animation in Semi Animation format. More... | |
Sound | RegisterSound (string id, string path) |
Music | RegisterMusic (string id, string path) |
PickupObject | GetItem (string id) |
AIActor | GetEnemy (string id) |
AdvancedSynergyEntry | GetSynergy (string id) |
SpriteCollection? | GetSpriteCollection (string id) |
Sprite? | GetSpriteTemplate (string id) |
SpriteAnimation? | GetAnimationTemplate (string id) |
I18N.LocalizationSource | GetLocalization (string id) |
I18N.Language | GetLanguage (string id) |
Audio | GetAudioTrack (string id) |
Sprite | AttachSpriteInstance (GameObject target, string id) |
Attaches an instance of a sprite template to a GameObject. More... | |
Sprite | ReplaceSpriteInstance (Sprite target, string id) |
Removes an existing sprite instance and attaches a new one to the same GameObject. More... | |
void | OverrideAudio (string old_id, string new_id) |
Registers an audio override (any attempt to play More... | |
abstract void | RegisterContent () |
Called after all Loaded methods are ran. This is where you should register any content that your mod adds - items, guns etc. Do not iterate any ID lists (e.g. the item database) in this method, as there may be mods loaded after yours that add to them. If you need to register content that depends on ID lists, register only the most basic skeleton of your content in this method and initialize it in InitializeContent . More... | |
abstract void | InitializeContent () |
Called after all RegisterContent methods are ran. You can't register any new content in this method, but you can use pre-existing references and modify their fields. You can do things like iterating on items in this method because no new ID pool entries will be added. More... | |
abstract void | Loaded () |
Called when Semi loads the mod. You cannot register any content in this method. Use it to setup fields and such. More... | |
virtual string | Serialize () |
Called when the save file is updated. This method should return a string that you will later load in Deserialize(). Use this to implement persistence in your mod (save file interaction). More... | |
virtual void | Deserialize (string s) |
Called when the save file is loaded. This method is fed the last recorded result of Serialize(). Use this to implement persistence in your mod (save file interaction). More... | |
Static Public Member Functions | |
static string | NormalizePath (string path) |
Normalize a path, removing all '..' entries. This is used to avoid filesystem access outside of the resources directory in Semi methods. Note that this does not make mods secure, as there are still other ways that you could access the filesystem (for example, by directly using the System.IO APIs). More... | |
Static Public Attributes | |
const string | RESOURCES_DIR_NAME = "resources" |
Name of the mod resources directory. More... | |
Properties | |
string | ID [get] |
Gets the ID specified in the mod metadata. More... | |
ModConfig | Config [get] |
Gets the loaded mod metadata. More... | |
Logger | Logger [get, set] |
SemiLoader.ModInfo | Info [get, set] |
Private Attributes | |
SemiLoader.ModInfo | _Info |
Gets the stored representation of the loaded mod. More... | |
Static Private Attributes | |
static char[] | _SeparatorSplitArray = { '\\', '/' } |
|
inline |
Attaches an instance of a sprite template to a GameObject.
target
.target | Target object. |
id | Global ID of the sprite template. |
|
inline |
Creates a single sprite definition from an image resource.
id | ID (including the mod's namespace) for the new sprite definition. |
sprite_path | Relative resource path to the image. |
|
inlinevirtual |
Called when the save file is loaded. This method is fed the last recorded result of Serialize(). Use this to implement persistence in your mod (save file interaction).
|
inline |
|
inline |
|
inline |
|
inline |
Expands an ID, filling in context namespace if necessary.
id | The ID. |
require_local | Whether this ID must point to the mod's namespace. |
|
inline |
Expands a path relative to the mod resources directory into an absolute path. Additionally, it will convert forward slash directory separators into backward slashes on Windows. Resource paths can only use forward slashes - this method will throw if it detects a backward slash.
res_path | Relative resource path. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Called after all RegisterContent
methods are ran. You can't register any new content in this method, but you can use pre-existing references and modify their fields. You can do things like iterating on items in this method because no new ID pool entries will be added.
|
pure virtual |
Called when Semi loads the mod. You cannot register any content in this method. Use it to setup fields and such.
|
inline |
|
inline |
|
inlinestatic |
Normalize a path, removing all '..' entries. This is used to avoid filesystem access outside of the resources directory in Semi methods. Note that this does not make mods secure, as there are still other ways that you could access the filesystem (for example, by directly using the System.IO
APIs).
path | Path. |
|
inline |
|
pure virtual |
Called after all Loaded
methods are ran. This is where you should register any content that your mod adds - items, guns etc. Do not iterate any ID lists (e.g. the item database) in this method, as there may be mods loaded after yours that add to them. If you need to register content that depends on ID lists, register only the most basic skeleton of your content in this method and initialize it in InitializeContent
.
|
inline |
Registers an encounter icon (used for example in the Ammonomicon) from an image resource.
id | ID (including the mod's namespace) for the new encounter icon. |
sprite_path | Relative resource path to the image. |
|
inline |
Registers a new PickupObject.
id | ID (including the mod's namespace) for the new item. |
enc_icon_id | Global ID of the encounter icon to use for this item. |
sprite_template_id | Global ID of the sprite template to use for this item. |
name_key | Global ID of the localization string to use for the full name of this item. |
short_desc_key | Global ID of the localization string to use for the short description of this item. |
long_desc_key | Global ID of the localization string to use for the long description of this item. |
T | Component type to initialize as the PickupObject. |
T | : | PickupObject |
|
inline |
Registers a new localization.
id | ID (including the mod's namespace) for the new localization. |
path | Relative resource path to the localization text file. |
lang_id | Global ID of the language to apply this localization for. |
table | Target string table to apply this localization for. |
allow_overwrite | If set to true allows this localization to overwrite others (note - depends on loading order!). |
|
inline |
|
inline |
|
inline |
Registers a new sprite collection.
id | ID (including the mod's namespace) for the new collection. |
defs | Optional array of sprite definitions to initialize the sprite collection with. |
|
inline |
Registers a new sprite template.
id | ID (including the mod's namespace) for the new sprite template. |
coll_id | Global ID of the sprite collection to uses. |
start_def_id | Optional global ID of the sprite definition from the sprite collection to use, the first definition will be used if not specified. |
|
inline |
Registers a new synergy.
id | ID (including the mod's namespace) for the new item. |
name_loc_id | ID of the localization key for the name of this synergy (StringTable.Synergies). |
objects_required | How many of the listed items and guns are needed to trigger the synergy. |
optional_gun_ids | A list of gun IDs that will count for the synergy, but aren't required to trigger it. DOES NOT SUPPORT CONTEXT IDS. |
mandatory_gun_ids | A list of gun IDs that are required for the synergy to trigger. DOES NOT SUPPORT CONTEXT IDS. |
optional_item_ids | A list of item IDs that will count for the synergy, but aren't required to trigger it. DOES NOT SUPPORT CONTEXT IDS. |
mandatory_item_ids | A list of item IDs that are required for the synergy to trigger. DOES NOT SUPPORT CONTEXT IDS. |
stat_modifiers | A list of stat modifiers to go into effect when the synergy is active. |
active_when_gun_unequipped | Whether the synergy should be active if conditions are met, but none of the mentioned guns are being held. |
ignore_lich_eye_bullets | Whether Lich's Eye Bullets should not attempt to activate this synergy when one of the listed guns is picked up. |
require_at_least_one_gun_and_one_item | Whether the synergy should require both an item and a gun to be picked up to activate the synergy, regardless of whether objects_required
|
suppress_vfx | Whether the synergy should avoid triggering the arrow visual effect. |
on_activated | Delegate executed when the synergy becomes active. |
on_deactivated | Delegate executed when the synergy stops being active. |
Removes an existing sprite instance and attaches a new one to the same GameObject.
target | Sprite to replace. |
id | Global ID of the sprite template. |
|
inlinevirtual |
Called when the save file is updated. This method should return a string that you will later load in Deserialize(). Use this to implement persistence in your mod (save file interaction).
|
private |
Gets the stored representation of the loaded mod.
The stored mod object.
|
staticprivate |
|
static |
Name of the mod resources directory.
|
get |
Gets the loaded mod metadata.
The mod's metadata representation.
|
get |
Gets the ID specified in the mod metadata.
The mod's ID.
|
getset |
|
getset |