Okay so instead of adding or replacing content I had my reasons to get rid of some!
I never did any modding in Stonehearth but I decided to dive into the files anyways, suprisingly it only took me a minute to accomplish what I wanted. Basically I just had to delete a few lines of codeâŚ
But then I thought, what if I turn this into a âmodâ so I could easily turn it on or off, or share it with everyone? And so I set up this folder structure inside the /mods folder:
My tweaked version of the âfarming_handlerâ is simply missing a few lines of code and Iâm trying to replace the original file with this one.
The problem?
It works when I delete the code in the original file, but not as a mod trying to replace it.
Possible solutions I tried:
Rebooting the game, several times
Removing and adding the âmodâ entirely
Adding the ârequiredâ statement to the manifest, so that it is forced on
because I noticed json being used differently sometimes, I also tried:
Swapping the pathâs colons for slashes
Using âfile()â instead of the folder name
Interesting is that without the required statement, I noticed the mod turning itself off every time I quit to main menu, or reboot the game. Which is odd behaviour as far as Iâm aware.
Try switching this line "override": into "overrides": (add an S at the end).
Also, it seems you are using aliases within your âoverridesâ-call?
Iâve never seen it used that way before - but if it works, make sure both aliases exist (in the Stonehearth manifest and your manifest respectively).
In overrides (and mixintos etc.) I always point to files by folder-structure
As far as I know (checking other modsâ manifests) the path on the right refers to the âmoddedâ content? So therefore the folders and files could be named anything right?
temp:handlers:farming_handler is not equal to temp/handlers/farming_handler.lua
A path has slashes /.
Those with : are aliases to a path.
You donât need an alias. You are right, but using : means it is an alias. Replace them with / so they are an actual path. Oh, and you will need the file extension too, so add the .lua
The first one needs a .lua. So farming_call_handler.lua. A path is always complete, slashes and file extensions included.
The second is incorrect because there is no aliases named âstonehearth:call_handlers:farming_call_handlerâ.
Just search at the stonehearth manifest to see if an alias exists or not. If not, use the full file path.
The âfile()â method is a path relative to your current file using it.
This is also the only time where you can have a path without a file extension, but only if your file is a json and it has the same name of its folder. So you can stop the path at the folder and it will guess that it has a json file there.
Like âfile(path/entity)â will point to path/entity/entity.json
Alright I get it now, even with coding experience this json and lua made no sense to me at first. And before @Hamnisu wrote that example I didnât understand it either.
But thank you all for you time as this is very basic information I suppose. Though still way more difficult than the original change I made to the code itself!
Before starting my own mod, I had never worked with JSON nor Lua either - I understand your struggles getting started.
Iâm still not very experieced with them.
Itâs not âbasic informationâ until you understand more advanced stuff; so donât beat yourself up over this!
Glad the issue is solved!