Invisible, Inc.

Invisible, Inc.

170 ratings
Sim Constructor + Sequential Mod Loader
   
Award
Favorite
Favorited
Unfavorite
mod
File Size
Posted
Updated
0.054 MB
Dec 21, 2015 @ 10:20am
Jul 10 @ 4:39am
40 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
< >
53 Comments
cyberboy2000  [author] Jul 12 @ 12:58pm 
You don't have Function Library installed, Function Library is a prerequisite of Programs Extended. https://steamcommunity.com/workshop/filedetails/?id=1745350836
datamanc0r Jul 12 @ 10:39am 
Thank you for your fast reply! :)
I worked through the log and found a conflict with the "Programs Extended" workshop item (https://steamcommunity.com/sharedfiles/filedetails/?id=555765765) . After de-subscribing this one and refreshing everything, it works.

The full log is here: https://ctxt.io/2/AACgw1p2Fw
You can see that there is trouble loading the hud at item "workshop-555765765"
cyberboy2000  [author] Jul 12 @ 9:13am 
That's not really enough information to go off, can you upload the entire log?
datamanc0r Jul 12 @ 6:00am 
Hi, I need some help.
I subscribed, refreshed the mods in-game and restarted the game. Starting a new game and after generating the first level, when the gameplay actually starts, the game crashes.
Log says:
### ABORTING: FATAL SCRIPT ERROR ###
game/client/states/state-game.lua:880: attempt to index field 'hud' (a nil value)
There are no other mods tampering with the HUD and I am not sure what to do. Did I miss an additional installation step or such?
Thanks to you!
cyberboy2000  [author] Jul 1 @ 1:01am 
No, that should work fine.
karenelizd Jun 30 @ 5:19pm 
so i subscribed to it and the Agent Reserve mod. is there anything else i need to do to get it up and running with the Agent Reserve mod?
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.