remove_fluid not working with modded fluid

Place to get help with not working mods / modding interface.
rooster407
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jul 27, 2025 7:42 pm
Contact:

remove_fluid not working with modded fluid

Post by rooster407 »

I have a pipe entity I'm using to add a fluid_box to entities without one, and then using remove_fluid for the consumption. The pipe for water works just fine, but the one for my modded fluid(oxygen) has nothing removed from it.

Code: Select all

	if storage.hab_index[i][3].get_fluid_count () >= 1 then 
		storage.hab_index[i][3].remove_fluid {name="water", amount = 1}
	else
		storage.hab_index[i][1].custom_status = {diode = defines.entity_status_diode.red, label ="no water"}
	end 
	if storage.hab_index[i][4].get_fluid_count ("oxygen") >= 1 then 
		storage.hab_index[i][4].remove_fluid {name="oxygen", amount = 1}
	else
		storage.hab_index[i][1].custom_status = {diode = defines.entity_status_diode.red, label ="no oxygen"}
	end 
fluid prototype

Code: Select all

local oxygenfluid = {
	type = "fluid",
	name = "oxygen",
	subgroup = "fluid",
	default_temperature=15,
	gas_temperature=0,
	base_color={0,0.95,1,0.8},
	flow_color={0,0.95,1,0.8},
	icon ="__colonization__/graphics/oxygen.png",
	icon_size = 64,
}
data:extend{oxygenfluid}
the pip prototypes

Code: Select all

local hab_pipe_ox= {
	type = "pipe",
	name = "hab_pipe_ox",
	flags = {"get-by-unit-number","not-blueprintable","not-flammable","not-upgradable"},
	fluid_box ={
		filter="oxygen",
		volume=2500,
		pipe_connections={
		{position={0,0},direction=defines.direction.east},
		{position={0,0},direction=defines.direction.west}
		},
	},
	selection_priority=51,
	horizontal_window_bounding_box={{-0.5, -0.5}, {0.5,0.5}},
	vertical_window_bounding_box={{-0.5, -0.5}, {0.5,0.5}},
	collision_box ={{-0.5, -0.5}, {0.5,0.5}},
	selection_box ={{-0.5, -0.5}, {0.5,0.5}},
}
data:extend{hab_pipe_ox}

local hab_pipe_aq= {
	type = "pipe",
	name = "hab_pipe_aq",
	flags = {"get-by-unit-number","not-blueprintable","not-flammable","not-upgradable"},
	fluid_box ={
		filter="water",
		volume=2500,
		pipe_connections={
		{position={0,0},direction=defines.direction.east},
		{position={0,0},direction=defines.direction.west}
		},
	},
	selection_priority=51,
	horizontal_window_bounding_box={{-0.5, -0.5}, {0.5,0.5}},
	vertical_window_bounding_box={{-0.5, -0.5}, {0.5,0.5}},
	collision_box ={{-0.5, -0.5}, {0.5,0.5}},
	selection_box ={{-0.5, -0.5}, {0.5,0.5}},
}
data:extend{hab_pipe_aq}
What am I missing?
rooster407
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jul 27, 2025 7:42 pm
Contact:

Re: remove_fluid not working with modded fluid

Post by rooster407 »

Found a solution. By deepcopying the water prototype I got what ever it was I was missing from the original prototype.

Code: Select all

local oxygenfluid = table.deepcopy(data.raw["fluid"]["water"])
oxygenfluid.name = "oxygen"
oxygenfluid.base_color={0,0.95,1,0.8}
oxygenfluid.flow_color={0,0.95,1,0.8}
oxygenfluid.icon ="__colonization__/graphics/oxygen.png"
oxygenfluid.icon_size = 64
data:extend{oxygenfluid}
Post Reply

Return to “Modding help”