[16.36] Script doesnt update Train Fuel Bar

Place to get help with not working mods / modding interface.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 393
Joined: Tue Jul 08, 2014 10:06 am
Contact:

[16.36] Script doesnt update Train Fuel Bar

Post by LuziferSenpai »

Hey,

After tinkering around with entity.energy and entity.burner I figured out that BOTH doesnt update the Fuel Bar in the Train.

So, my Code:

Code: Select all

local PowerNeed = 0
local PowerStorage = 0
local PowerPer = 0
if global.SenpaisTrainsList ~= nil and global.SenpaisAccuList ~= nil then
    for _, p in pairs( global.SenpaisTrainsList ) do
        PowerNeed = PowerNeed + ( p.entity.burner.heat_capacity - p.entity.burner.heat )
    end
    for _, a in pairs( global.SenpaisAccuList ) do
        PowerStorage = PowerStorage + a.energy
    end
    if PowerStorage >= PowerNeed then
        for _, u in pairs( global.SenpaisTrainsList ) do
            u.entity.burner.heat = u.entity.burner.heat_capacity
        end
        PowerPer = PowerNeed / #global.SenpaisAccuList
        for _, o in pairs( global.SenpaisAccuList ) do
            o.energy = o.energy - PowerPer
        end
    else
        for _, w in pairs( global.SenpaisAccuList ) do
            w.energy = 0
        end
        PowerPer = PowerStorage / #global.SenpaisTrainsList
        for _, n in pairs( global.SenpaisTrainsList ) do
            n.entity.burner.heat = PowerPer
        end
    end
end
I dont think it is what the Developer's wanted.

I hope you fix this and it was hepful.

Greetz,

Luzifer
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
Rseding91
Factorio Staff
Factorio Staff
Posts: 16014
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [16.36] Script doesnt update Train Fuel Bar

Post by Rseding91 »

Thanks for the report however entity.energy and burner.heat are the same thing neither of which are the fuel bar in the entity.

I'm going to move this to modding help.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding help”