Page 1 of 1

[0.15.1] LuaFluidbox[].temperature is readonly

Posted: Tue Apr 25, 2017 11:10 am
by __init__
The temperature of fluids inside a fluid box can be read but not overwritten.
For example, when hovering an offshore pump:

Code: Select all

game.players[1].selected.fluidbox[1].temperature = 100
Has no effect

Code: Select all

game.players[1].print(game.players[1].selected.fluidbox[1].temperature)
Still returns the same value as before setting the temperature

Re: [0.15.1] LuaFluidbox[].temperature is readonly

Posted: Tue Apr 25, 2017 11:25 am
by posila
Hi, thanks for the report.

This is not a bug, LuaFluidbox is a copy of fluid parameters, so you need to use it like following

Code: Select all

local fluid = game.players[1].selected.fluidbox[1]
fluid.temperature = 100
game.players[1].selected.fluidbox[1] = fluid

Re: [0.15.1] LuaFluidbox[].temperature is readonly

Posted: Tue Apr 25, 2017 12:37 pm
by __init__
Well, that is true but writing a new object doesn't work either:

Code: Select all

game.players[1].selected.fluidbox[1] = {type="water", amount=10, temperature=100}
On an empty pipe adds 10 water at 15°C (default temperature).
So the temperature is ignored.

Re: [0.15.1] LuaFluidbox[].temperature is readonly

Posted: Tue Apr 25, 2017 4:35 pm
by posila
I see.
Fixed for 0.15.2 (viewtopic.php?f=30&t=44842)