Invisible, Inc.

Invisible, Inc.

245 ratings
Sim Constructor + Sequential Mod Loader
   
Award
Favorite
Favorited
Unfavorite
mod
File Size
Posted
Updated
85.970 KB
Dec 21, 2015 @ 10:20am
Jul 22 @ 3:46am
68 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
58 Comments
Hekateras May 3, 2023 @ 12:54pm 
西行樱雪 There was an incompatibility between Sim Constructor and language packs, as it turns out. Try updating now and it should work with the Chinese translation.
西行樱雪 Mar 31, 2023 @ 5:17am 
But it could have been used together a year ago
西行樱雪 Mar 31, 2023 @ 5:16am 
This module and the modules based on it, when appearing with the Chinese translation module, the game will become unopenable.
cyberboy2000  [author] Jan 28, 2023 @ 3:17pm 
I think wodzu must have accidentally set Function Library to be hidden, he's active on discord and there's no indication he would remove it. It's only the steam workshop page that is inaccessible, it's still possible to download the mod. I've sent him a message so hopefully it should be back up soon.

Note that Sim Constructor is a prerequisite for Function Library, not the other way around. Sim Constructor works fine without any other mods.
Alifer Jan 28, 2023 @ 2:37pm 
Function Library is gone so this mod is dead along with anything that uses it :steamsad:
cyberboy2000  [author] Jul 12, 2021 @ 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, 2021 @ 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, 2021 @ 9:13am 
That's not really enough information to go off, can you upload the entire log?
datamanc0r Jul 12, 2021 @ 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, 2021 @ 1:01am 
No, that should work fine.