Code viewer
Get PackageName of Mod
#Code
Gets the PackageName (mod folder, not script package) of the mod that contains the class this function resides in.
Accounts for mod folder name changing to the mod's WorkshopID when uploaded to the Steam Workshop.
Returns a string containing PackageName
. If no GameModInfo
with a ScriptPackageName
that matches Outer.Name
is found (e.g. Not cooked yet), returns Outer.Name
instead.
Useful for doing mod Time Piece checks for things like Deathwishes. Example:
static function bool IsActIncomplete()
{
if (`GameManager.HasTimePiece((class'Hat_TimeObject_Base'.static.GetModTimePieceIdentifier(class'Your_Class'.static.GetMyModPackageName(), "yourIdentifier"))))
return false;
return Super.IsActIncomplete();
}
/** * Gets the PackageName (mod folder) of the mod that contains the class this function resides in. * Accounts for mod folder name changing to the mod's WorkshopID when uploaded to the Steam Workshop. * * @return - String containing PackageName. If no GameModInfo with a ScriptPackageName that matches Outer.Name is found (e.g. Not cooked yet), returns Outer.Name instead. */ static final function string GetMyModPackageName() { local array<GameModInfo> modList; local GameModInfo modInfo; modList = class'GameMod'.static.GetModList(); foreach modList(modInfo) { if (modInfo.ScriptPackageName ~= string(default.Outer.Name)) return modInfo.PackageName; } return string(default.Outer.Name); }