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!