[SOLVED] electric-energy-interface animations not working?

Place to get help with not working mods / modding interface.
Post Reply
i.am.qix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Nov 14, 2016 6:27 am
Contact:

[SOLVED] electric-energy-interface animations not working?

Post by i.am.qix » Sat Mar 24, 2018 2:22 am

I have an electric-energy-interface entity that I'm writing that has a three layer animation, but the animation is stuck at the first frame.

Here is the spec:

Code: Select all

data:extend{{
	type = 'electric-energy-interface',
	name = 'hand-crank',
	icon = '__base__/graphics/icons/accumulator.png',
	icon_size = 32,
	flags = {'placeable-neutral', 'player-creation'},
	minable = {hardness = 0.1, mining_time = 0.2, result = 'hand-crank'},
	max_health = 40,
	corpse = 'small-remnants',
	collision_box = {{-0.78, -0.62}, {0.77, 0.48}},
	selection_box = {{-0.78, -0.62}, {0.77, 0.48}},
	enable_gui = true,
	allow_copy_paste = false,
	energy_source =
	{
		type = 'electric',
		usage_priority = 'primary-output',
		render_no_power_icon = false,
		render_no_network_icon = true,
		buffer_capacity = '10kW',
		input_flow_limit = '0kW',
		output_flow_limit = '10kW'
	},
	energy_production = '0kW',
	energy_usage = "0kW",
	animation =
	{
		layers =
		{
			{
				filename = '__HandCrank__/graphics/entity/hand-crank.png',
				priority = 'extra-high',
				width = 96,
				height = 48,
				shift = {0.6, 0},
				line_length = 0,
				frame_count = 8,
				animation_speed = 0.2,
				run_mode = 'forward'
			},
			{
				filename = '__HandCrank__/graphics/entity/hand-crank_dark.png',
				priority = 'extra-high',
				width = 96,
				height = 48,
				shift = {0.6, 0},
				frame_count = 8,
				line_length = 0,
				animation_speed = 0.2,
				draw_as_shadow = true,
				run_mode = 'forward'
			},
			{
				filename = '__HandCrank__/graphics/entity/hand-crank_shadow.png',
				priority = 'extra-high',
				width = 96,
				height = 48,
				shift = {0.6, 0},
				line_length = 0,
				frame_count = 8,
				animation_speed = 0.2,
				run_mode = 'forward'
			}
		}
	},
	vehicle_impact_sound = {
		filename = '__base__/sound/car-metal-impact.ogg',
		volume = 0.4
	}
}}
Am I missing something? The sprite itself is PNG with the 8 frames appended horizontally, and as far as the loading goes the game is perfectly happy with how it's spec'd out. But the animation just doesn't want to run.

Any help?

EDIT: This happens even without layers (specifying the first layer as the top-level table keys).
Last edited by i.am.qix on Sat Mar 24, 2018 2:42 am, edited 1 time in total.

i.am.qix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Nov 14, 2016 6:27 am
Contact:

Re: electric-energy-interface animations not working?

Post by i.am.qix » Sat Mar 24, 2018 2:42 am

Aha, never mind. Turns out the animation runs based on the current value of power_production. I needed to turn my animation speed wayyyy down to around 0.004 (!!!) in order to get it to work and look nice.

It was doing the animation fine, but it was going so ridiculously fast that it looked stationary.

For anyone that finds this in the future, you can debug your animations by enabling the entity's GUI, clicking on it and playing with the sliders. That's how I figured out my mistake :)

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 3174
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [SOLVED] electric-energy-interface animations not working?

Post by eradicator » Sat Mar 24, 2018 2:20 pm

Just out of eer...let's call it "curiosity", what does your mod do that mine doesn't?

HandCrankGenerator

i.am.qix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Nov 14, 2016 6:27 am
Contact:

Re: [SOLVED] electric-energy-interface animations not working?

Post by i.am.qix » Sat Mar 24, 2018 2:23 pm

Nothing. :) I wasn't aware there was already a hand crank mod until shortly before I released.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 3174
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [SOLVED] electric-energy-interface animations not working?

Post by eradicator » Sat Mar 24, 2018 2:31 pm

i.am.qix wrote:Nothing. :) I wasn't aware there was already a hand crank mod until shortly before I released.
I see.

i.am.qix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Mon Nov 14, 2016 6:27 am
Contact:

Re: [SOLVED] electric-energy-interface animations not working?

Post by i.am.qix » Sat Mar 24, 2018 2:44 pm

Is there a problem? O.o

Post Reply

Return to “Modding help”

Who is online

Users browsing this forum: No registered users