Pump fluid_animation is mysterious

Place to get help with not working mods / modding interface.
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Pump fluid_animation is mysterious

Post by moon69 »

Could someone please help me understand how Pump.fluid_animation works?
Also in general, when an animation speed varies with the entities activity, what properties are used to determine the level of activity?

The Pump.fluid_animation prototype indicates it's an Animation4Way, but when I replace the animation, it just gives a static image...

Code: Select all

ass.fluid_animation = 
{
	filename = "__base__/graphics/entity/chemical-plant/hr-chemical-plant-smoke-outer.png",
	frame_count = 47,
	line_length = 16,
	width = 90,
	height = 188,
	animation_speed = 2,
	shift = util.by_pixel(0, -10),
	scale = 0.5
}
This is related to this earlier question, but I don't understand what apply_runtime_tint is for if it can't be changed? Is this pump specific?
Bilka wrote:
Sun Jul 21, 2019 11:16 am
moon69 wrote:
Sat Jul 20, 2019 9:04 am
I'm trying to repurpose a Pump for a mod, but can't seem to disable apply_runtime_tint .

I've got the main "animations" working fine, but I am struggling with the "fluid_animation"...

Code: Select all

fluid_animation =
    {
      north =
      {
        filename = "__base__/graphics/entity/pump/pump-north-liquid.png",
        apply_runtime_tint = true,
        width = 20,
        height = 13,
        line_length =8,
        frame_count =32,
        shift = util.by_pixel(-0.500, -14.500),
...
It is tinting my white animation with the fluid colour even when apply_runtime_tint = false.

Thanks.
You can't turn of the tinting in the prototype like that. There are only two ways to turn it off - don't have a fluid_animation or don't have fluid in the fluidbox.
Any enlightenment welcome thanks.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Pump fluid_animation is mysterious

Post by Deadlock989 »

moon69 wrote:
Sat Oct 05, 2019 10:47 am
This is related to this earlier question, but I don't understand what apply_runtime_tint is for if it can't be changed? Is this pump specific?
apply_runtime_tint is one of the most misunderstood properties of sprite layers. Most of the time it is used for tinting masks so that they have the player/force colour - e.g. turrets, vehicles. As far as I know it is never, ever used for things like crafting recipe tints or fluid window tints, despite what you might read on these forums.

Fluid movement windows (pipes, tanks, pumps) are indeed mysterious, a lot of their behaviour is hard-coded.

Re: your static image - you've replaced an Animation4Way with a single sprite, so that's why it's "static". As it says on the wiki:
north
Type: Types/Animation
Optional. If omitted, the game will not look for any other directions and instead try to load the whole definition as one Types/Animation and apply it to all directions.
Directional Animation4Way definitions look like this:

Code: Select all

animation = {
	north = { ... },
	east = { ... },
	south = { ... },
	west = { ... },
}

User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: Pump fluid_animation is mysterious

Post by moon69 »

Deadlock989 wrote:
Sat Oct 05, 2019 11:24 am
Re: your static image - you've replaced an Animation4Way with a single sprite, so that's why it's "static". As it says on the wiki:
north
Type: Types/Animation
Optional. If omitted, the game will not look for any other directions and instead try to load the whole definition as one Types/Animation and apply it to all directions.
Directional Animation4Way definitions look like this:

Code: Select all

animation = {
	north = { ... },
	east = { ... },
	south = { ... },
	west = { ... },
}
Thanks Deadlock, but that is not what the wiki means... it instead means that it uses the same animation for each direction instead of separate animations...
I just tested this to be sure... the following simple pump copy has the smoke animating as expected in all directions even though no north, east etc.

Code: Select all

local thing = "pmptest"

local ass = util.table.deepcopy(data.raw["item"]["pump"])
ass.name = thing
ass.place_result = ass.name

data.raw["item"][thing] = ass

ass = util.table.deepcopy(data.raw["recipe"]["pump"])
ass.name = thing
ass.ingredients = { {"iron-plate", 1} }
ass.result = ass.name
ass.enabled = true

data.raw["recipe"][thing] = ass


ass = util.table.deepcopy(data.raw["pump"]["pump"])
ass.name = thing
ass.minable.result = ass.name

ass.fluid_animation =  {
		filename = "__base__/graphics/entity/chemical-plant/hr-chemical-plant-smoke-outer.png",
		frame_count = 47,
		line_length = 16,
		width = 90,
		height = 188,
		animation_speed = 0.5,
		shift = util.by_pixel(-2, -40),
		scale = 0.5
	  }
	  	  
data.raw["pump"][ass.name] = ass
Good experiment though... I didn't realise the issue didn't occur on an otherwise vanilla pump.
I think my static image issue must be related to what the pump considers activity - the mod I am working on messes with the pump's fluid_box in events and this might be confusing it. I will test further.

Edit: It seems that the "activity" of a pump is when the fluid is output from the pump... automagically removing fluids from the fluid_box in control.lua events doesn't cut it.

Post Reply

Return to “Modding help”