Page 1 of 1
Tutorial problem
Posted: Wed Jun 17, 2015 7:58 pm
by matjojo
So I was just trying to get into modding, when whilst doing the tutorial(link on bottom) I ran into this error:
Code: Select all
Error while loading entity prototype "bomber" (car): no such node (energy_per_hit_point) modifications: BomberTutorial
At first I went through the base game files seeking for the car entity to seek for what the node energy_per_hit_point would be. when This didn't work out (I couldn't find the car) I tried seeking on the forum. i came across one post kinda helping. But what he said would not work on the tutorial, beacuse he talked about adding it above the "light node", but that one I also don't have.
So here I am, with the question: Where should the node in question be added?(on what line.) And, what does this node do?
https://forums.factorio.com/wiki/inde ... g_Tutorial
Re: Tutorial problem
Posted: Wed Jun 17, 2015 8:20 pm
by daniel34
You can find the prototype for the vanilla car in data\base\prototypes\entity\entities.lua starting from line 797.
Code: Select all
{
type = "car",
name = "car",
icon = "__base__/graphics/icons/car.png",
flags = {"pushable", "placeable-neutral", "player-creation", "placeable-off-grid"},
minable = {mining_time = 1, result = "car"},
max_health = 200,
corpse = "medium-remnants",
dying_explosion = "huge-explosion",
energy_per_hit_point = 1,
resistances =
[...]
I'm guessing that energy_per_hit_point was later added (0.11.18?) according to
https://github.com/Dysoch/DyTech/issues/292
and is required for the car entity to load.
So just add that line somewhere in the car definition of your mod (the entity.lua file in step 4 of the tutorial).
The order of the nodes doesn't really matter, in this case adding it after the corpse node (line 805) should be fine.
I can't tell for sure (haven't tried it) but I think this node changes the amount of damage done when the car/tank/... crashes into other buildings.
Re: Tutorial problem
Posted: Wed Jun 17, 2015 10:27 pm
by semvoz
As of my understanding, entities, items, and other data definition are simple LUA table, and in that case associative array: we use string names as keys (e.g. {name = 'bomber'}).
Which means that as long as you use the right name at the right level (e.g. not in a sub array if it's an entity's prime attribute) it should be just fine.
Whichever the position you would still access the name property by its name like so:
Someone correct me if I'm wrong (still learning lua but doesn't sound so different from other languages at this level.
Re: Tutorial problem
Posted: Thu Jun 18, 2015 10:04 am
by matjojo
daniel34 wrote:-snip-
The order of the nodes doesn't really matter, in this case adding it after the corpse node (line 805) should be fine.
I can't tell for sure (haven't tried it) but I think this node changes the amount of damage done when the car/tank/... crashes into other buildings.
thanks, I wasn't really sure as to where to add it, but as you said, the order does not matter. thanks!