[Tutorial] Adding mining resources

#13

Nice analogy, and a thumbs up from a Mathematician :smiley:

3 Likes
#14

I must renew this

How can i add the selectable stone in the vein to see the tooltip of my_vein
i did all the json work but i cant select a stone in my_vein so where is the reference to the manifest entries like this "terrain:ui:coal_block" : "file(entities/terrain/ui/coal_block)", im searching for hours now but i can`t figure out my problem

my_vein appears, is minable everything is ok but no tooltip

#15

The list of items that can be highlighted in that way is hardcoded into a lua file. Specifically, it’s in stonehearth/services/client/terrain_highlight/terrain_highlight_service.luac. Overriding lua files is possible, but generally not a good idea.

I live in hope that one of the guys from Radiant ( @Albert? @sdee?) will extract the relevant array into a json file so that we can mixinto that instead of living dangerously with overrides.

1 Like
#16

thank you tuhalu.
i don`t like overrides and work around them even if that kills some fine tuning of my mod)
so my_vein must do without it

1 Like
#17

Indeed. Added a feature request for this. Thanks!

4 Likes
#18

@Tuhalu - Just made the change for the next patch. Thanks for bringing this to my attention!

7 Likes
#19

Sweet. I imagine there will be a few mods that are waiting for this to be available :smile:

2 Likes
#20

Thanks albert this will bring my mod to more detail life

1 Like
#21

OK. So the list of blocks you can name is now in the stonehearth mod at /data/terrain/terrain_blocks.json.

When you mixin to that file, you just need to add:

   "selectable_kinds" : {
      "MY_RESOURCE_ore" : "MY_ALIAS"
   }

You then have to create that alias in your manifest. It will point to a file that contains the information about that block type.

For an example, check inside the stonehearth mod at entitites/terrain/ui/coal_block.json. You’ll have to modify it a bit though so that it correctly points at the ore_block.json it mixins from. It will look like:

{
   "mixins" : "/stonehearth/entities/terrain/ui/ore_block",
   "components" : {
      "unit_info" : {
         "name": "MY_RESOURCE Vein", 
         "description": "Provides MY_RESOURCE when mined."
      }
   }
}

And that should be that. You’ll have a clickable tooltip for your ore vein. Obviously everything in ALL_CAPS_AND_UNDERSCORES is something you will need to name yourself.

3 Likes
#22

now means in alpha 11 ?
because i tried it out (10.5.10) and it`s not working out and no error emerges

#23

Yes. As in develop-2521 in alpha 11.

You won’t get any error messages because nothing is wrong with the json files. Json files are just data. Superfluous data is simply ignored without causing an error.

2 Likes
#24

Well, with the introduction of Biomes, adding in your own veins just got harder! The “color” tag in terrain_blocks.json is now deprecated and the color of your veins is now stated in each individual biome file.

Currently, the game only uses stonehearth/data/biome/temperate.json, but eventually we’ll have at least 3 biomes (arctic and desert) and probably many more. In each biome json file, you need to find the “palettes” tag and then the “spring” tag within that. You’ll see that every kind of terrain block is named and has its own color. Later, we can expect to see more seasons than spring, so be prepared for that too!

Anyway, you’ll need to add an additional entry to the list of spring colors that defines your “kind” of block. The name for the color must be the same as you defined in /data/terrain/terrain_blocks.json in “selectable kinds”. Do all this with a mixinto file type (not forgetting to add the manifest entry).

BTW, @phector2004, with all the changes since you made your tutorial, is it possible for you to update it? If not, would you mind if I made a tutorial topic on the subject myself?

2 Likes
#25

I’m really tight on time, so go for it, kid!

1 Like
#26

that would be great for me, then i would actually probably revive an “old” project of mine…

1 Like
#27

OK. New tutorial topic is here. Let me know what you think :slight_smile:

2 Likes
#28

Might have a look at it this weekend. Looks very organized :smile:

#29

Can someone make a class tutorial please that would be amazing

1 Like
#30

hey look at this

http://discourse.stonehearth.net/t/to-many-mods-what-you-think/17634?u=xmmcxrockx

#31

You might want to make a separate thread to ask for a class tutorial. I don’t know anything about adding new classes, but you can look at some other modders’ stuff to see how they managed it.

Best of luck!

2 Likes
#32

Yeah I’ve started that I thought there would be an easy way like the resource tut