Page 1 of 1

Optional power grid requirement for ammo-turret entities

Posted: Sat Aug 04, 2018 3:40 pm
by wodzu93
TL;DR
Make ammo-turret entities use and require electric power grid if LuaEntityPrototype.energy_source is not nil.
What ?
Currently ammo-turret type entities completely ignore electric grid information. I tried to make turrets that take ammo AND require electric energy as well,
but ammo-turret entities ignore energy_source entry and electric-turret entities cannot be fed with ammo even if ammo_category is not set to electric.

Since code for this is already in the game (Laser Turrets), this should be very easy to implement.
For example:

Code: Select all

   type = "ammo-turret",
	name = "w93-rocket-turret2",

        ...

   energy_usage = "300kW",
	energy_source =
	{
		type = "electric",
		drain = "50kW",
		usage_priority = "secondary-input"
	},

        ...

	attack_parameters =
	{
		type = "projectile",
		ammo_category = "rocket",

      ...
This turret would fire rockets, while requiring power grid, with 50kW of passive drain and 300kW of active drain (constant drain while turret is not passive, ex. fires or rotates).

Re: Optional power grid requirement for ammo-turret entities

Posted: Sun Aug 05, 2018 3:42 am
by ownlyme
you could periodically check if the rotation is not north/east/west/south or shooting target is not nil, and when there is not enough energy you set the turret to active = false, though this would probably be a total ups nightmare..

Re: Optional power grid requirement for ammo-turret entities

Posted: Tue Oct 02, 2018 10:06 pm
by Rseding91
This isn't going to happen. Electric turrets are what you need to use if you want to consume power and use a turret.