Page 1 of 1
Is it possible to access fluid prototypes?
Posted: Mon Jan 12, 2015 3:53 pm
by starholme
I'd like to retrieve some fluid information: kj/degree, max temp, default temp.
I can kinda work around the max temp and default temp using a 'fake' fluid box. (Create pipe, set the fluidbox type to be the fluid I want, set it on the pipe, read it back from the pipe. Set temp to something nuts like 99999, set it on the pipe, read it back.)
So far, I've no workaround to get kj/degree though.
Re: Is it possible to access fluid prototypes?
Posted: Mon Jan 12, 2015 3:59 pm
by Liquius
starholme wrote:I'd like to retrieve some fluid information: kj/degree, max temp, default temp.
I can kinda work around the max temp and default temp using a 'fake' fluid box. (Create pipe, set the fluidbox type to be the fluid I want, set it on the pipe, read it back from the pipe. Set temp to something nuts like 99999, set it on the pipe, read it back.)
So far, I've no workaround to get kj/degree though.
Something like this works, but it's less than ideal.
Code: Select all
if entity.fluidbox[1].type == "water" then
maxTemp = 100
minTemp = 15
heatCapacity1 = 1
end
Re: Is it possible to access fluid prototypes?
Posted: Mon Jan 12, 2015 4:26 pm
by starholme
Sorry, but I'm trying to get the values for heat capacity, without have to hardcode them(to keep other mods compatible easily)
Re: Is it possible to access fluid prototypes?
Posted: Mon Jan 12, 2015 9:32 pm
by L0771
can test with very high values, like
["pipe"].fluidbox[1] = {type = "water", amount = 100, temperature = 20000}
if ["pipe"].fluidbox[1].temperature < 20000 then
myvarofpipe.maxtemperature = ["pipe"].fluidbox[1].temperature
end
["pipe"].fluidbox[1] = {type = "water", amount = 100, temperature = -20000}
if ["pipe"].fluidbox[1].temperature > -20000 then
myvarofpipe.mintemperature = ["pipe"].fluidbox[1].temperature
end
... i'm lazy.
Re: Is it possible to access fluid prototypes?
Posted: Tue Jan 13, 2015 1:04 pm
by KexĂk
You can create metaitems with values you want like i did
here and then convert them to your mod field viz
this. Converting them is important part because using game.itemprototypes table is very slow and will cause significant fps drop if you use it in OnTick
Re: Is it possible to access fluid prototypes?
Posted: Tue Jan 13, 2015 2:45 pm
by starholme
Thanks Kexik, I think that will do what I need. I'll reply back and let you guys know once I have a chance to try it.