Invisible, Inc.

Invisible, Inc.

137 ratings
Sim Constructor + Sequential Mod Loader
   
Award
Favorite
Favorited
Unfavorite
Mod
File Size
Posted
Updated
0.049 MB
Dec 21, 2015 @ 10:20am
Sep 18 @ 8:52am
38 Change Notes ( view )

Subscribe to download
Sim Constructor + Sequential Mod Loader

Description
The Sim Constructor is a tool that gives mod makers more freedom while maintaining compability.

These are the current modules:
1) Early, late, and unload options for mod loading.
2) Modding existing generation options and customizing new options(more than one value, default to false etc).
3) Defining required mods. These mods will always be loaded before your. (I did not make this module. Credit goes to Lemonhead).
4) Adding Agent banter.
5) Customizing hud elements.
6) Modifiers now use a fixed order of operations that can be customized. Also adds convenience functions for working with modifiers as well as new modifiers for clamping values and custom behaviour.
7) Provides public access to certain local variables, by adding them to simdefs.
8) New debug mode for debugging modifiers.

The mod also provides a few fixes to existing crashes and bugs, as well as a few quality of life improvements, like sorting mods alphabetically and allowing you to compact them, on the generation options screen.

If you are using a mod that is made using the Sim Constructor, you need to have the Sim Constructor to run it.

How to use it (for mod makers)
--Change an existing generation option --Defined by option name, not simdef name --Reference can be found in client\states\state-generation-options rawset(simdefs.CUSTOM_OPTIONS,anyname,{ name, tip, check, strings, values, apply, retrieve }) --Customized generation option --If enabled=false this ption will start unchecked(ignored if Values is defined) --Values is a table that holds different alternatives --Strings contains names that match values(optional) --Value is default value(optional) modApi:addGenerationOption(optionName, name , tip, {enabled,values,strings,value} ) --Modify a hud file --The files that can be modified are all files located in gui.kwad/gui (you need to use kwad extractor to see these files) --data is deepmerged, so you only need to include the info that you are changing --You can use a new filename to create new screens, when doing this, do NOT provide a filename extension (.lua) simdefs.SCREEN_CUSTOMS = util.extend(simdefs.SCREEN_CUSTOMS) { [filename] = { data } } --Set a game param directly --This feature has not been fully tested, use at your own risk --This code needs to be called in the load function instead of the init function modApi.mod_manager.genOptions[option] = options[option] --Loading mod content before or after other mods, or if the mod is disabled local function earlyLoad( modApi, options ) end local function earlyUnload( modApi, options ) end local function unload( modApi, options ) end local function lateLoad( modApi, options ) end local function lateUnload( modApi, options ) end --Add agent banter (use in load function after adding guard to agentdef, not in the init function) modApi:addBanter( { agents = {id,id},--The agents that are talking dialogue = { {id,string},--Id is the talking agent, string is what they say {id,string}, }, } ) --Set required mods modApi.requirements = { mods } --Adding modifiers: Required parameter --trait: name of the trait to change. --name: identifier for managing trait. Does not have to be unique unlike in the base game. --op: Operation to perform: ADD, MULT, CLA, SET, or FN --val: Parameter for operation (optional for CLA and FN) --Optional parameters: --min/max: Min and max value the operation will result in. Note that unless you're using the CLA operator, this will not --cause a value that is already out of range to become in range. --priority: Higher priority will go first. Standard value is 0. --opPriority: Define custom order of operations, standard values goes from 4 to 0. local modifier = unit:getModifiers():add( trait, name, op, val, min, max, priority, opPriority ) --Searchs for and returns first modifier matching name and, optionally, trait. local modifier = unit:getModifiers():has( trait, name ) --Find and change the first found modifier matching name and optional trait. local modifier unit:getModifiers():change( trait, name, op, val, min, max, priority, opPriority ) --Change the given modifier (needed when changing priority, as this automatically reorders modifiers) --Note trait is optional local modifier unit:getModifiers():change( trait, modifier, op, val, min, max, priority, opPriority ) --Manually reevaluate modifiers (when changing a modifier without using the change function) unit:getModifiers():reeval( trait ) --Insert modifier unit:getModifiers():insert( trait, modifier ) --Find and remove the first found modifier that matches the name and trait. --Returns 1 if successfully removed and 0 otherwise. Use a loop if you want to remove all matching modifiers. local removedCount = unit:getModifiers():remove( name, trait ) --Find and remove the first found modifier for each trait matching name and returns the total number removed. --Use a loop if you want to remove all matching modifiers. local removedCount= unit:getModifiers():remove( name ) --Find and remove the given modifier. Returns 1 if successfully removed and 0 otherwise. local removedCount = unit:getModifiers():remove( modifier )

Here's an example mod that uses the Sim Constructor: http://steamcommunity.com/sharedfiles/filedetails/?id=580664017

Feel free to discuss the mod on our Discord: https://discordapp.com/invite/aQrXEse
< >
47 Comments
cyberboy2000  [author] Jul 18, 2019 @ 12:30pm 
Added 'CLA' and 'FN' modifiers, for clamping values and performing custom functions respectively.
Added 'change' function to modifiers for convenience.
The 'has' function for modifiers now returns the index of the returned modifier, can be called without a trait parameter to search all traits, and you can pass the modifier itself instead of a name (just for getting the index).
The 'remove' function for modifiers can now be called with a trait parameter to narrow the search, and you can pass the modifier itself instead of a name.
cyberboy2000  [author] Jul 14, 2019 @ 2:13pm 
You can now minimize mods on the Generation Options Screen, which hides their options. If you have the Customizable Generation Presets mods then you can save which mods are minimized.
Mods are now listed in alphabetical order on the mod selection screen.
You can now add a modifier of the same name and trait multiple times, and the add function returns the new modifier.
Modifier order now depends on operation, but you can now also specify priority for a certain modifier.
For numerical modifiers, you can now specify min and max values it will modify to.
cyberboy2000  [author] Jul 1, 2019 @ 9:50am 
Fixed errors when there are generation options for mods that aren't installed (again, since last update broke it)
The game now automatically detects when a mod doesn't have any generation options
cyberboy2000  [author] Jun 24, 2019 @ 2:17pm 
Mods are now listed in alphabetical order on the generation option screen.
Removed the unnecessary generation option.
Fixed a rare infinite loop from the Contingency Plan dlc.
cyberboy2000  [author] Jan 26, 2019 @ 2:11pm 
Update:
You can now create new screens, not only modify existing ones.
Fixed an issue where you could click on firewalls with no program equipped if you had Neptune installed.
Fixed important story items being put on the ground, becoming unobtainable, if your inventory is full.
Fixed errors when there are generation options for mods that aren't installed (mainly applies if you use Customizable Generation Presets)

Creating screens note: The filename you choose should not have an extension.
Firewalls note: If you have Programs Extended installed, the fix won't apply until wodzu has updated the mod (should not take long after this post) and you've redownloaded Programs Extended.
piseesc64 May 24, 2018 @ 1:31pm 
Like BEGINNER and EXPERIENCED etc.
piseesc64 May 24, 2018 @ 1:28pm 
I'm not talking about campaign generation options, as cool as they may be. I'm talking about campaign generation presets.
cyberboy2000  [author] May 24, 2018 @ 10:41am 
To add a generation option you use the mod api. However sim constructor adds more functionality to the api, for exampe letting you add options with multiple values to choose from instead of a simple checkbox.
piseesc64 May 23, 2018 @ 5:03pm 
I don't think this mod does what I thought it does. Is there a mod that allows you to add a Campaign generation preset?
piseesc64 May 23, 2018 @ 4:55pm 
Oh, thanks.