Modding Stonehearth's Graphics Test Program

First off I had a hunch that I confirmed, you can have the files with a .lua extension and it will still run stonehearth fine.

@Alesfatalis, There actually is a Y coordinate for them you just don’t use it for the place_item function. Here’s the relevant function.

MicroWorld.place_item = function(l_6_0, l_6_1, l_6_2, l_6_3, l_6_4)
  local entity = radiant.entities.create_entity(l_6_1)
  if l_6_4 then
    entity:add_component("unit_info"):set_faction(l_6_4)
  end
  radiant.terrain.place_entity(entity, Point3(l_6_2, 1, l_6_3))
  return entity
end

As you can see it as far as I can tell just sets all their Y value’s to 1 which seems to imply it’s a vertical displacement from the ground then aligned with the sames coordinates used for the terrain.

Also the batch code I used for decompiling folders of luac. It assumes that you have luadec on your desktop and than it will use it to change all .luac files in the folder it is in and all subfolders and so on into decompiled .lua files while deleting the .luac files. Essentially just put it in the stonehearth folder and run it to convert .luac to .lua, note however that on the files it completely fails on a error box will pop up, just hit cancel and it will keep going.

FOR /R %%f IN (*.luac) DO (
	C:\Users\Xavion\Desktop\luadec %%f > %%f_lua
	del "%%f"
	rename "%%f_lua" *.lua
)

EDIT TO AVOID DOUBLE POST; Arrgh opinions over this.

From another thread.

Done. I also played around with it a bit and discovered it’s not a template system like I first suspected, or it is just in the reverse of the normal order. So my current view is that it loads the json file for the entity or whatever and then it loads the file it extends from on top of that overwriting anything different with it’s version. That means that base_human would take precedent over human which seems kind of dodgy and also makes the use of “extends” for the syntax kind of weird as it’s kind of the other way around.

2 Likes