Help me out here (and yourself maybe)

Okay so instead of adding or replacing content I had my reasons to get rid of some! :slight_smile:

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:

  • /temp/
    • /manifest.json
    • /handlers/
      • farming_handler.lua

The manifest:

   "info": {
      "name": "temp",
      "version": 3
      "override": {
      "stonehearth:call_handlers:farming_call_handler": "temp:handlers:farming_handler"

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 :slight_smile:

I works with aliases too, but @Nex doesn’t have that alias declared in his manifest.

1 Like

Should’ve noticed this, I changed it, didn’t solve the issue though.

This (as pointed by Relys) does not exist. You need to create that alias to use that way, or replace it with the file path.

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.

The right side is what will replace or add to the left side.
The alias is just a shortcut to a path, like this


The alias creation goes into the alias section, above the overrides, like this:



I get what you say but I don’t understand yet what I’m doing wrong here.

“temp:handlers:farming_handler” does exist, because it refers to the folders/files with identical names right?

And also, why would I want to use an alias when this manifest has only 1 reference basically.

Now, this makes sense, I thought those were the same. I did mention in op that I tried both ways though

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

So this is correct?
“stonehearth/call_handlers/farming_call_handler”: “file(handlers/farming_handler.lua)”

Or should the first part be colons still?
“stonehearth:call_handlers:farming_call_handler”: “file(handlers/farming_handler.lua)”

Still not working with either of those.

As pointed out by @Relyss and @BrunoSupremo, you either want to add the alias or point to the files by their respective folder-structure.

An example with folder-structure:

   "info": {
      "name": "temp",
      "version": 3
      "overrides": {
      "stonehearth/call_handlers/farming_call_handler.lua": "temp/handlers/farming_handler.lua"

If you want to add an alias to your mod, it would look something like this

"info": {},

"aliases" : {
    "handlers:farming_handler": "file(temp/handlers/farming_handler.lua)"

 "overrides": {}

But, as pointed out by @BrunoSupremo, the alias you tried to call in the Stonehearth-mod does not exist in its manifest.

1 Like

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

1 Like

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!

1 Like

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! :wink:
Glad the issue is solved!