Turrets need energy source

by Morgott

This mod makes machine gun and rocket turrets consume electricity to operate.

Tweaks
3 days ago
2.0
68
Power

g One for belt splitters too?

a month ago

Love it! Think you can make similar one for belt splitters needing electricity?

a month ago

Thanks for the feedback! I think it's possible. As soon as I can implement it for flamethrower turrets and artillery, I'll do similar things.

6 days ago

It looks like the solution is implemented in https://mods.factorio.com/mod/ElectricPoweredBelts

But it uses a custom script in control.lua

Maybe this will help you?

6 days ago
(updated 6 days ago)

Maybe this will help you?

Thank you for the tip! I will study this.

6 days ago

Unfortunately, everything is more complicated there. I managed to add energy consumption to the turrets through this mod, but they still shoot, even without electricity.

6 days ago

By the way, your mod doesn't work either... Turrets shoot without electricity.

5 days ago

By the way, your mod doesn't work either... Turrets shoot without electricity.

It works) even on the splash screen in the main menu. In your case, apparently the turrets accumulated an internal volume of electricity and spent it after you disconnected them from the pole.

5 days ago
(updated 5 days ago)

My apologies. It really works. I placed turrets directly in the editor and it turns out that in this case the energy buffer is already charged.

But there is one small bug. After placing ammunition in the turret, the electricity icon disappears. But when working with the code https://mods.factorio.com/mod/ElectricPoweredBelts the icons do not disappear, so it makes sense to poke around with this mod... I even suspect that through control.lua you can solve the problem with the fluid turret and artillery turret. But my own knowledge is not enough for this

I also have two mods that have an ammo turret

Can you add the code below to your mod:

if mods["My_add_pack_updated"] and true then
-- Турель дробовик
data.raw["ammo-turret"]["shotgun-turret"].energy_source = {
type = "electric", -- Тип потребления энергии
buffer_capacity = "800kJ", -- Объем
input_flow_limit = "100kW", -- Максимальное потребление
usage_priority = "primary-input", -- Приоритет потребления
drain = "10kW" -- Минимальное потребление
}
data.raw["ammo-turret"]["shotgun-turret"].energy_per_shot = "8kJ" -- Расход на выстрел
-- Снайперская турель
data.raw["ammo-turret"]["sniper-turret"].energy_source = {
type = "electric", -- Тип потребления энергии
buffer_capacity = "1000kJ", -- Объем
input_flow_limit = "150kW", -- Максимальное потребление
usage_priority = "primary-input", -- Приоритет потребления
drain = "10kW" -- Минимальное потребление
}
data.raw["ammo-turret"]["sniper-turret"].energy_per_shot = "10kJ" -- Расход на выстрел
-- пушечная турель
data.raw["ammo-turret"]["cannon-turret"].energy_source = {
type = "electric", -- Тип потребления энергии
buffer_capacity = "1000kJ", -- Объем
input_flow_limit = "200kW", -- Максимальное потребление
usage_priority = "primary-input", -- Приоритет потребления
drain = "10kW" -- Минимальное потребление
}
data.raw["ammo-turret"]["cannon-turret"].energy_per_shot = "18kJ" -- Расход на выстрел
end
if mods["ironclad-gunboat-and-mortar-turret-fork"] and true then
-- Миномет
data.raw["ammo-turret"]["mortar-turret"].energy_source = {
type = "electric", -- Тип потребления энергии
buffer_capacity = "1000kJ", -- Объем
input_flow_limit = "200kW", -- Максимальное потребление
usage_priority = "primary-input", -- Приоритет потребления
drain = "20kW"
}
data.raw["ammo-turret"]["mortar-turret"].energy_per_shot = "50kJ" -- Расход на выстрел
end

3 days ago

But there is one small bug. After placing ammunition in the turret, the electricity icon disappears.

This is a bug of the factorio itself. The same will happen with railgun turrets.

3 days ago

But when working with the code https://mods.factorio.com/mod/ElectricPoweredBelts the icons do not disappear, so it makes sense to poke around with this mod... I even suspect that through control.lua you can solve the problem with the fluid turret and artillery turret. But my own knowledge is not enough for this

The mod author has implemented a complex system. They create multiple new items in the same location and process each of them every tick. As a result, if there are many such objects, it could lead to significant drops in UPS, since checks are performed on all these items each tick. Additionally, this mod is a fork of another one, and some parts of the code may be incorrect or ineffective. I also lack the knowledge to recreate such a mod, so I'm trying to rely on the built-in game features, ensuring that any necessary data processing is handled by the Factorio engine itself. I'm keeping an eye on updates to the original mod and considering them. If the Factorio developers don't add the ability to include energy source parameters for other turrets or objects in the near future, I might compromise and adopt some functionality from this author.

Can you add the code below to your mod:...

Done

3 days ago

I see..... I haven't gotten to the railguns yet...).

Thank you very much for integrating my turrets in your mod....

3 days ago

Maybe this will help you?

Я создал тему в соответствующем разделе о запросе добавить energy source для огнемётных и артиллерийских турелей.
https://forums.factorio.com/viewtopic.php?f=65&t=124537 можешь посодействовать и поддержать запрос, тогда мой мод и подобные мне заработают сразу из data, без костылей из control

I created a topic in the appropriate section requesting to add an energy source for flamethrower and artillery turrets. https://forums.factorio.com/viewtopic.php?f=65&t=124537 Could you assist and support the request? This way, my mod and similar ones will work directly from data, without workarounds from control.

3 days ago

Я дополнил Вашу просьбу своей.

3 days ago

Эх, можно было бы отвязать зависимость от Space Age :3 // Oh, it would be possible to untie the dependence on Space Age :3

New response