Is it possible to access fluid prototypes?

Place to get help with not working mods / modding interface.
Post Reply
starholme
Fast Inserter
Fast Inserter
Posts: 201
Joined: Tue Oct 21, 2014 7:25 pm
Contact:

Is it possible to access fluid prototypes?

Post 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.

Liquius
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Tue Nov 04, 2014 12:01 pm
Contact:

Re: Is it possible to access fluid prototypes?

Post 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

starholme
Fast Inserter
Fast Inserter
Posts: 201
Joined: Tue Oct 21, 2014 7:25 pm
Contact:

Re: Is it possible to access fluid prototypes?

Post 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)

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: Is it possible to access fluid prototypes?

Post 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.

Kexík
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Mon Dec 01, 2014 12:52 pm
Contact:

Re: Is it possible to access fluid prototypes?

Post 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

starholme
Fast Inserter
Fast Inserter
Posts: 201
Joined: Tue Oct 21, 2014 7:25 pm
Contact:

Re: Is it possible to access fluid prototypes?

Post 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.

Post Reply

Return to “Modding help”