data raw ?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

data raw ?

Post by binbinhfr »

Hi,

just a "stupid" question, because I do not completly understand how it works...

for example, if I want to change the running_speed of the player, I can add in a data.lua :
data.raw.player.player.running_speed = 2

but why can't I put this into a control.lua ?

How can I change the running_speed of my player in the control.lua ?
Is the only solution to create alternate characters predefined in data.lua and to swap from a slow char to a rapid char ?

But admitting that I want to change smootly this value ? Would it be possible (without creating hundredth of alternate characters ?).

I still cannot really figure out why, during the game, I cannot access/change some of the values defined in the protypes of the data.lua...
Infact prototypes in data.lua do not match classes available in control.lua and objects related to these classes ?
For example, there is a Player prototype, and also a LUAPlayer class, but they do not seem to match...
My mods on the Factorio Mod Portal :geek:

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: data raw ?

Post by DaveMcW »

Between data.lua and control.lua, there is a bunch of C++ magic. The developers don't want to expose this to lua, partly because it is a lot of work, and partly because it would hurt performance. We just have to accept that there are 2 different places we can mod stuff, and they don't work together.

The only ways to change running speed in control.lua are:
1. swap from a slow char to a rapid char
2. add more exoskeletons

You can post in Modding interface requests if you think another way is needed.

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: data raw ?

Post by binbinhfr »

DaveMcW wrote:Between data.lua and control.lua, there is a bunch of C++ magic. The developers don't want to expose this to lua, partly because it is a lot of work, and partly because it would hurt performance. We just have to accept that there are 2 different places we can mod stuff, and they don't work together.
OK. So I accept it, but it's not always easy to find out if what you're looking for is in the lua classes or hidden in thr prototypes.
My mods on the Factorio Mod Portal :geek:

Post Reply

Return to “Modding help”