Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

squeek

The Big List Of Mod-Related Code Suggestions

Recommended Posts

squeek    237

Since there is no outlet for suggesting improvements to the modding API or putting forth ideas to improve the codebase to be more mod-friendly, I thought I'd start a thread to put everything that I come across. Feel free to add your own. Hopefully they will not be ignored (one can dream).

Port the mod tools to Mac/Linux

Done by simplex, just needs the pull request accepted

Make pinecones use the "growable" component instead of their own (buggy) growth code

Detailed here with implementation sample. So far it has been ignored.

Make the "pickable" component more consistent (it handles getting the regen time differently in different functions)

Detailed here with implementation sample. Ipsquiggle said he'd look into it but nothing ever came of it.

Add mod-specific save data (outside the mod folder and separate from the world's save data)

Detailed here and here. Ipsquiggle was going to implement it but it never ended up happening.

Add mod dependency resolution

Detailed here

Add support for adding/modifying character animations

Don't have a link detailing this, but as of right now this is impossible as far as I'm aware

Fix the screen flickering when MiniMap:RebuildLayer is called while MiniMap:IsVisible returns true

Detailed here with documented test mod

Add support for cropping/masking UI textures

Detailed here

Expose the TextWidget C++ functions that set/get the EditCursor position

Detailed here

Expose the TextWidget/TextEditWidget C++ functions that set/get the selected text

No further details needed.

Fix hitboxes of custom assets

Detailed here

Add support for saving inifinity

Example implementation here. Example modded implementation here.

Fix backspace not working in TextEditWidgets if they don't have a valid character filter set

Detailed here

Fix memory spiking due to all mod assets being loaded upfront rather than as needed

Modded implementation here by simplex

Suggestions that were fixed/addressed/implemented

Add a proper PlayerPostInit function

Implemented in Rev. 102535 (2014-05-23) as AddPlayerPostInit

Detailed here with implementation sample. SethR has said he will add this.

Fix the health component not rescheduling its regen task when it already has an active regen task

Fixed in Rev. 102535 (2014-05-23)

Detailed here

Add support for arbitrarily sized stewer containers

Implemented in Rev. 102535 (2014-05-23)

Detailed here with implementation

Add mod character portrait support to the morgue screen

Implemented in Rev. 102535 (2014-05-23)

Detailed here with example fix

Add mod configuration files (outside the mod folder)

Implemented in Rev. 102535 (2014-05-23): see this thread

Detailed here. Ipsquiggle was going to implement it but it never ended up happening.

Add an ongrowth event to the "growable" component

Implemented in Rev. 102535 (2014-05-23): ongrowthfn callback added to the growable component

Kind of detailed here with a mod-specific implementation example. This allows for avoiding modifying each and every stage callback fn for each and every prefab in order to hook into growth stage changes.

Add better support for adding new food to the crockpot

Implemented in Rev. 102535 (2014-05-23)

Detailed here with modded implementation

Fix chest loot assuming that components exist in their initfns

Fixed in Rev. 102535 (2014-05-23)

Detailed here with example fix

Fix repairable item describe strings (multiple bugs exist; one can cause crashes)

Fixed in Rev. 102535 (2014-05-23)

Detailed here. Example fix here (the function is in stringutil.lua). Bug report here.

Add access to the OS clipboard

Partially implemented in Rev. 102535 (2014-05-23) via TextEdit:SetAllowClipboardPaste(true); no copy to clipboard support added

Would allow for copy/pasting lines into the console, for example.

Share this post


Link to post
Share on other sites
TheDanaAddams    578

With regards to "adding/modifying player animations," we ideally need the ability to expand the animation for ANY entity.
Though expanding the player set is priority one.
Being able to add completely new animations is important, but being able to add things to existing ones would be really desirable, too.
For example, if I wanted to add wings to the pigmen. But I fear that will happen when pigs fly.
[laughs at own stupid joke]
 
As for the new crockpot foods, I think there were issues with new things growing in farms, and drying on the drying rack, too.
Full support for adding new foods through all methods would be nice.
 
 
With regards to the mod tools, I would be interested to know if the engine could support Spriter's new "skins" system. It allows for distorting of the texture via bone animation, letting you have "true" bending, rather than segmenting the image where it needs to bend.
I have my doubts that this will be possible, but confirmation would be nice.
(Think how great it could be to have nice bendy tails!)
 
Also regarding the mod tools, I believe kraken121 will be able to better explain the situation, but as issue was discovered in the tools that breaks symbol-swapping animation from Spriter. Though there is a workaround. His partner had a manual fix, but I'm not sure if she went on to tweak the tools.

 

And did we ever get rid of that issue where files deleted from your Spriter animation folder, despite not being in use, would crash the tools?

 

 

Finally... please fix the f@%#ing annoying problem where the Steam Workshop will re-download EVERYTHING EVERY TIME YOU GO INTO THE MOD MENU.

Simplex's Manual Workshop Update mod makes things bearable, but you still have to wait 25 minutes for EVERYTHING to download again, if just ONE of your mods has been updated.

Share this post


Link to post
Share on other sites
Mr. Tiddles    1153

Finally... please fix the f@%#ing annoying problem where the Steam Workshop will re-download EVERYTHING EVERY TIME YOU GO INTO THE MOD MENU.

Simplex's Manual Workshop Update mod makes things bearable, but you still have to wait 25 minutes for EVERYTHING to download again, if just ONE of your mods has been updated.

Ooooh, yup. I used to think my game was crashing back when I played with 40+ mods (Not the cheaty ones that make everything craftable, just ones that added completely new stuff). Another thing I would like with mods on the workshop is the limit being MUCH bigger than the petty 15mb it is at the moment.

Share this post


Link to post
Share on other sites
squeek    237

Added a few more:

Add mod character portrait support to the morgue screen

Detailed here with example fix

Fix hitboxes of custom assets

Detailed here

Fix chest loot assuming that components exist in their initfns

Detailed here with example fix

Share this post


Link to post
Share on other sites
squeek    237

http://forums.kleientertainment.com/topic/31294-bugged-behavior-in-healthlua-startregen/#entry410910

 

Is that worthy for the list? Happens to be a bug I found that I hadnt seen discussed by anyone.

That's basically a game bug but I'll add it. It's insane that stuff like that slips through the cracks. I'll never understand it; the more detailed a bug report, the more likely it is to be ignored.

Thanks for posting it.

Share this post


Link to post
Share on other sites
kraken121    401

With regards to "adding/modifying player animations," we ideally need the ability to expand the animation for ANY entity.

Though expanding the player set is priority one.

Being able to add completely new animations is important, but being able to add things to existing ones would be really desirable, too.

For example, if I wanted to add wings to the pigmen. But I fear that will happen when pigs fly.

[laughs at own stupid joke]

 

As for the new crockpot foods, I think there were issues with new things growing in farms, and drying on the drying rack, too.

Full support for adding new foods through all methods would be nice.

 

 

With regards to the mod tools, I would be interested to know if the engine could support Spriter's new "skins" system. It allows for distorting of the texture via bone animation, letting you have "true" bending, rather than segmenting the image where it needs to bend.

I have my doubts that this will be possible, but confirmation would be nice.

(Think how great it could be to have nice bendy tails!)

 

Also regarding the mod tools, I believe kraken121 will be able to better explain the situation, but as issue was discovered in the tools that breaks symbol-swapping animation from Spriter. Though there is a workaround. His partner had a manual fix, but I'm not sure if she went on to tweak the tools.

 

And did we ever get rid of that issue where files deleted from your Spriter animation folder, despite not being in use, would crash the tools?

 

 

Finally... please fix the f@%#ing annoying problem where the Steam Workshop will re-download EVERYTHING EVERY TIME YOU GO INTO THE MOD MENU.

Simplex's Manual Workshop Update mod makes things bearable, but you still have to wait 25 minutes for EVERYTHING to download again, if just ONE of your mods has been updated.

 

ugg... Where to start on ModTools: Klei's newest survival game :highly_amused: (Dana's heard enough "complaining" from me this week in chat haha)

 

1. update github/or fix mod tools if they really arent fixed to support spriter image swaps properly without me having to manually hax through the animation.xml to get it to work

 

2. fix big textures support in python exporter (its cutting off on 2nd+ tex file generation, losing data at random (i have a temp fix, but im not sure if its working for all cases to bother suggesting)

 

(id add flash to game engine support but dana says they wont do it, so  i guess its pointless)

 

3. write a freaking list of all engine exposed functions, argument lists and what they actually do

instead of me guessing what all that stuff in AnimState/Transform etc does and what it relies on to do what it does lol

 

4. python exporter reverse/decompiler that would turn binaries into intermediary xmls, showing us the structure of any game anim without reading through hex or hoping someone else comes with a working spriter example

 

And did we ever get rid of that issue where files deleted from your Spriter animation folder, despite not being in use, would crash the tools?

It's a spriter error that crashes both spriter and tools, at least on spriter version that's shipped with modtools, not a modtools bug per se

 

you can fix it manually in spriter scml as a workaround, but really not something devs here could fix

 

 

@Dana,pigs can't fly...

 

 

Guess thats it for now.

Share this post


Link to post
Share on other sites
alainmcd    901

All custom recipes turn to rot in one second due to the new stewer.lua. Lines 28-30 could be substituted by this:

		stewercmp.spoiltime = (cooking.recipes[inst.prefab][stewercmp.product].perishtime or TUNING.PERISH_ONE_DAY) * (stewercmp.product_spoilage or 1)

and dropping that unnecessary preppedfoods. However, I don't have great hopes that it'll be corrected, since it was already reported and they instead changed it to...that.

Changing Stewer:CanCook() to

function Stewer:CanCook() return self.inst.components.container.IsFull() end

would allow for custom stewers to cook an arbitrary (though still fixed) amount of ingredients, not just 4.

Share this post


Link to post
Share on other sites
squeek    237

All custom recipes turn to rot in one second due to the new stewer.lua. Lines 28-30 could be substituted by this:

		stewercmp.spoiltime = (cooking.recipes[inst.prefab][stewercmp.product].perishtime or TUNING.PERISH_ONE_DAY) * (stewercmp.product_spoilage or 1)
and dropping that unnecessary preppedfoods. However, I don't have great hopes that it'll be corrected, since it was already reported and they instead changed it to...that.

Changing Stewer:CanCook() to

function Stewer:CanCook() return self.inst.components.container.IsFull() end
would allow for custom stewers to cook an arbitrary (though still fixed) amount of ingredients, not just 4.

Added. Both are very good suggestions. You might consider reporting the first in the RoG bug forum just in case.

Share this post


Link to post
Share on other sites
_Q_    644

From the api examples:

-- TODO: Allow custom food items to be visible within the cookpot.

Not sure if it fits here or someone alredy found a way to do this.

Share this post


Link to post
Share on other sites
squeek    237

From the api examples:

-- TODO: Allow custom food items to be visible within the cookpot.

Not sure if it fits here or someone alredy found a way to do this.

EDIT: See this thread

Share this post


Link to post
Share on other sites
squeek    237

Where should I put Fix for repairable item describe strings?

It is overwrating some file form game or just post init in the mod?

http://privatepaste.com/f2997b0e18

You'd have to copy the local function getcharacterstring from stringutil.lua and then you could just overwrite the global function GetDescription.

For example, you could put this in a file like <modfolder>/scripts/repairabledescriptionfix.lua:

local function getcharacterstring(tab, item, modifier)    if modifier then		modifier = string.upper(modifier)	end    if tab then        local topic_tab = tab[item]        if topic_tab then            if type(topic_tab) == "string" then		        return topic_tab            elseif type(topic_tab) == "table" then                if modifier and topic_tab[modifier] then                    return topic_tab[modifier]                end                if topic_tab['GENERIC'] then                    return topic_tab['GENERIC']                end				if #topic_tab > 0 then					return topic_tab[math.random(#topic_tab)]				end            end        end    endendfunction GetDescription(character, item, modifier)    character = character and string.upper(character)    local itemname = item.components.inspectable.nameoverride or item.prefab    itemname = itemname and string.upper(itemname)    modifier = modifier and string.upper(modifier)    local ret = GetSpecialCharacterString(character)    if not ret then        ret = getcharacterstring(STRINGS.CHARACTERS[character].DESCRIBE, itemname, modifier)    end        if not ret then        ret = getcharacterstring(STRINGS.CHARACTERS.GENERIC.DESCRIBE, itemname, modifier)    end    if not ret then        ret = STRINGS.CHARACTERS.GENERIC.DESCRIBE_GENERIC    end    if ret and item and item.components.repairable and item.components.repairable:NeedsRepairs() then        local repairstring = nil        if STRINGS.CHARACTERS[character].DESCRIBE then            repairstring = getcharacterstring(STRINGS.CHARACTERS[character], "ANNOUNCE_CANFIX", modifier)        end        if not repairstring then            repairstring = getcharacterstring(STRINGS.CHARACTERS.GENERIC, "ANNOUNCE_CANFIX", modifier)        end                if repairstring then            ret = ret..repairstring        end    end    return retend

and then in modmain do:

GLOBAL.require "repairabledescriptionfix"

Share this post


Link to post
Share on other sites
_Q_    644

You'd have to copy the local function getcharacterstring from stringutil.lua and then you could just overwrite the global function GetDescription.

For example, you could put this in a file like <modfolder>/scripts/repairabledescriptionfix.lua:

local function getcharacterstring(tab, item, modifier)    if modifier then		modifier = string.upper(modifier)	end    if tab then        local topic_tab = tab[item]        if topic_tab then            if type(topic_tab) == "string" then		        return topic_tab            elseif type(topic_tab) == "table" then                if modifier and topic_tab[modifier] then                    return topic_tab[modifier]                end                if topic_tab['GENERIC'] then                    return topic_tab['GENERIC']                end				if #topic_tab > 0 then					return topic_tab[math.random(#topic_tab)]				end            end        end    endendfunction GetDescription(character, item, modifier)    character = character and string.upper(character)    local itemname = item.components.inspectable.nameoverride or item.prefab    itemname = itemname and string.upper(itemname)    modifier = modifier and string.upper(modifier)    local ret = GetSpecialCharacterString(character)    if not ret then        ret = getcharacterstring(STRINGS.CHARACTERS[character].DESCRIBE, itemname, modifier)    end        if not ret then        ret = getcharacterstring(STRINGS.CHARACTERS.GENERIC.DESCRIBE, itemname, modifier)    end    if not ret then        ret = STRINGS.CHARACTERS.GENERIC.DESCRIBE_GENERIC    end    if ret and item and item.components.repairable and item.components.repairable:NeedsRepairs() then        local repairstring = nil        if STRINGS.CHARACTERS[character].DESCRIBE then            repairstring = getcharacterstring(STRINGS.CHARACTERS[character], "ANNOUNCE_CANFIX", modifier)        end        if not repairstring then            repairstring = getcharacterstring(STRINGS.CHARACTERS.GENERIC, "ANNOUNCE_CANFIX", modifier)        end                if repairstring then            ret = ret..repairstring        end    end    return retend

and then in modmain do:

GLOBAL.require "repairabledescriptionfix"

Tested and its crashing with Wilson. Trying to track the error now.

Reset() returning...mods/Wall Gates/scripts/repairabledescriptionfix.lua:37: attempt to index field '?' (a nil value)LUA ERROR stack traceback:        D:/Gry/Steam/steamapps/common/dont_starve/data/../mods/Wall Gates/scripts/repairabledescriptionfix.lua(37,1) in function 'GetDescription'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/inspectable.lua(59,1) in function 'GetDescription'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/actions.lua(225,1) in function 'fn'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/bufferedaction.lua(19,1) in function 'Do'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(848,1) in function 'PushBufferedAction'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/locomotor.lua(213,1) in function 'PushAction'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/playercontroller.lua(1016,1) in function 'DoAction'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/playercontroller.lua(1056,1) in function 'OnLeftClick'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/playercontroller.lua(68,1) in function 'OnControl'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/components/playercontroller.lua(14,1) in function 'fn'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/events.lua(46,1) in function 'HandleEvent'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/input.lua(140,1) in function 'OnControl'        D:/Gry/Steam/steamapps/common/dont_starve/data/scripts/input.lua(312,1)scripts/frontend.lua(712,1) SCRIPT ERROR! Showing error screen	

Custom fix is no longer needed tested in default game without any fixes and now it didn't crash.

So they fixed that but forgot to mention it in the patch notes or in other post on forums.

Share this post


Link to post
Share on other sites
squeek    237

Tested and its crashing with Wilson. Trying to track the error now.

Custom fix is no longer needed tested in default game without any fixes and now it didn't crash.

So they fixed that but forgot to mention it in the patch notes or in other post on forums.

Looks like they 'fixed' (not really fixed) it (in the RoG DLC only) by adding a boolean to each repairable component that controls whether or not the character should announce they can fix it. It will still crash if you inspect a repairable component that has announcecanfix set to true and does not have a character-specific DESCRIBE string for that prefab. stringutil.lua hasn't changed in the vanilla game since Sept 2013.

Here's a fixed GetDescription function (I wasn't doing table nil checks :() with support for that DLC addition: http://privatepaste.com/bdf364db9c

Share this post


Link to post
Share on other sites
_Q_    644

Looks like they 'fixed' (not really fixed) it (in the RoG DLC only) by adding a boolean to each repairable component that controls whether or not the character should announce they can fix it. It will still crash if you inspect a repairable component that has announcecanfix set to true and does not have a character-specific DESCRIBE string for that prefab. stringutil.lua hasn't changed in the vanilla game since Sept 2013.

Here's a fixed GetDescription function (I wasn't doing table nil checks :() with support for that DLC addition: http://privatepaste.com/bdf364db9c

Checked again with my gate walls and ranodm custom character and no crash in the map without RoG, seems to be working, will keep your solution in backup if anyone will report some crashes.

Thank You for help.

Share this post


Link to post
Share on other sites
squeek    237

Checked again with my gate walls and ranodm custom character and no crash in the map without RoG, seems to be working, will keep your solution in backup if anyone will report some crashes.

Thank You for help.

I'd double check that. Nothing has changed in the game code that would fix the crash.

Just tested to make sure using Willow (can't use Wilson to test because he only uses the generic strings). I spawned a random prefab, used the console to add a repairable component to it, and then inspected it. Crashed from attempting to concatenate nil.

EDIT: Also tested my fix and it works.

Share this post


Link to post
Share on other sites
_Q_    644

I'd double check that. Nothing has changed in the game code that would fix the crash.

Just tested to make sure using Willow (can't use Wilson to test because he only uses the generic strings). I spawned a random prefab, used the console to add a repairable component to it, and then inspected it. Crashed from attempting to concatenate nil.

EDIT: Also tested my fix and it works.

Cool. I tested again so the deflaut game code is working for custom characters - they use generic string, but is not working for any other character than Wilson, that means you still have to provide strings for all default game characters, but custom characters are using generic string, so this still need a fix.

Share this post


Link to post
Share on other sites
squeek    237

Cool. I tested again so the deflaut game code is working for custom characters - they use generic string, but is not working for any other character than Wilson, that means you still have to provide strings for all default game characters, but custom characters are using generic string, so this still need a fix.

The crash happens if STRINGS.CHARACTERS[charactername] exists but STRINGS.CHARACTERS[charactername].DESCRIBE[prefabname] doesn't. So, any custom character that adds a STRINGS.CHARACTERS[charactername] table will also cause the crash. You should definitely include my fix in your mod.

Share this post


Link to post
Share on other sites
simplex    2620

One more suggestion: porting the mod tools to Linux/Mac. Or at least accepting my 2 month old pull request porting them...

 

Is there still any dev overseeing this forum, or at least looking out for modding? I haven't been around lately, but it sure looks like there isn't...

Share this post


Link to post
Share on other sites
squeek    237

One more suggestion: porting the mod tools to Linux/Mac. Or at least accepting my 2 month old pull request porting them...

 

Is there still any dev overseeing this forum, or at least looking out for modding? I haven't been around lately, but it sure looks like there isn't...

Welcome back! No, there's no dev here anymore. Check out my Stagnation of the Modding Community thread for my thoughts on that.

EDIT: Oh, and added "port the mod tools" to the OP.

Share this post


Link to post
Share on other sites
Silentdarkness1    1161

One more suggestion: porting the mod tools to Linux/Mac. Or at least accepting my 2 month old pull request porting them...

 

Is there still any dev overseeing this forum, or at least looking out for modding? I haven't been around lately, but it sure looks like there isn't...

FFUUU

Share this post


Link to post
Share on other sites