Page 1 of 1

Question for invisible resources.

Posted: Sat Mar 21, 2015 8:07 pm
by KaraUL!
Have a strange question, i begin to think, its impossible, SO how to change resource\entity parameters while catching certain event? Example i have zero selection boxes for coal at the game start. I need to change parameters of coal (type=resource) when event onbuiltentity (for example) is catched. I tried to call

Code: Select all

data.raw.resource["coal"].selection_box = ...
in "control.lua" but game said glob "data" is nil. Can u help me, any ideas how to solve this

Re: Question for invisible resources.

Posted: Sun Mar 22, 2015 1:01 am
by Degraine
This should be in the Modding Help subforum. As to the question...I'm not sure what you're trying to do. You can't alter the selection box of an entity ingame as far as I know, all that data is loaded and locked in at startup.

Re: Question for invisible resources.

Posted: Sun Mar 22, 2015 5:57 am
by KaraUL!
Degraine wrote:This should be in the Modding Help subforum. As to the question...I'm not sure what you're trying to do. You can't alter the selection box of an entity ingame as far as I know, all that data is loaded and locked in at startup.
Maybe we can change autoplace settings?

Code: Select all

game.entityprototypes.autoplace

Re: Question for invisible resources.

Posted: Sun Mar 22, 2015 7:46 pm
by Rseding91
KaraUL! wrote:Have a strange question, i begin to think, its impossible, SO how to change resource\entity parameters while catching certain event? Example i have zero selection boxes for coal at the game start. I need to change parameters of coal (type=resource) when event onbuiltentity (for example) is catched. I tried to call

Code: Select all

data.raw.resource["coal"].selection_box = ...
in "control.lua" but game said glob "data" is nil. Can u help me, any ideas how to solve this
You can't change the selection box runtime. You would need to make 2 different coal entities and swap them out when a drill is placed.

Re: Question for invisible resources.

Posted: Sun Mar 22, 2015 8:21 pm
by KaraUL!
Rseding91 wrote:
KaraUL! wrote:Have a strange question, i begin to think, its impossible, SO how to change resource\entity parameters while catching certain event? Example i have zero selection boxes for coal at the game start. I need to change parameters of coal (type=resource) when event onbuiltentity (for example) is catched. I tried to call

Code: Select all

data.raw.resource["coal"].selection_box = ...
in "control.lua" but game said glob "data" is nil. Can u help me, any ideas how to solve this
You can't change the selection box runtime. You would need to make 2 different coal entities and swap them out when a drill is placed.

nice idea, it helps, thanks