Page 1 of 1

[16.36] Script doesnt update Train Fuel Bar

Posted: Fri Mar 30, 2018 4:04 pm
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

Re: [16.36] Script doesnt update Train Fuel Bar

Posted: Fri Mar 30, 2018 4:09 pm
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.

Re: [16.36] Script doesnt update Train Fuel Bar

Posted: Sat Mar 31, 2018 11:09 am
by eradicator