Hello there again!
I'm now a little sad as "generator" type NEEDS to have liquid to work. I'm sad that "solar-panel" works only within a day. And that "assembly-machine" can't produce energy.
I would like to see entity type (maybe there is and I just don't know it), which can produce power without fuel (let's say solar-panel 24/7 like geothermal power plant), or which can use any recipe (not only fuel) and produce power with it. If there is something capable of any of the above, please tell me. If not, how can I make it via control (if I may at all).
Custom power plants?
Custom power plants?
My mods:
- Power Mod (WiP)
- Power Mod (WiP)
Re: Custom power plants?
Unfortunate facts of Factorio... we're all a little bit saddened by these.Forien wrote:I'm now a little sad as "generator" type NEEDS to have liquid to work. I'm sad that "solar-panel" works only within a day. And that "assembly-machine" can't produce energy.
This will need to be done via control.lua, read this topic first where I've answered (practically) the same question, and then if you have further questions feel free to ask

Re: Custom power plants?
Well, I made it work, but two things are distressing about what I've done.
1) I need to add energy every tick (when it's dark)
2) HUD of plant shows 0W (at night) and doesn't work as expected (efficienty still works as Solar Panel's)
But hey, it works!
1) I need to add energy every tick (when it's dark)
2) HUD of plant shows 0W (at night) and doesn't work as expected (efficienty still works as Solar Panel's)
But hey, it works!

My mods:
- Power Mod (WiP)
- Power Mod (WiP)
Re: Custom power plants?
MoPower has wind-turbines, you can tear into the code for that if you want.
Re: Custom power plants?
I've tried the same thing. Here's my idea:
you can use an "accumulator" instead of a "solar panel".
It's important because you can save energy with an accumulator, but not with a solar panel.
I'd try this, and it works very well:
you can use an "accumulator" instead of a "solar panel".
It's important because you can save energy with an accumulator, but not with a solar panel.
I'd try this, and it works very well:
Code: Select all
energy_source =
{
type = "electric",
buffer_capacity = "50kJ",
usage_priority = "primary-output",
input_flow_limit = "0kW",
output_flow_limit = "30kW"
},
Code: Select all
require "util"
require "defines"
game.oninit(
function()
glob.staticEnergyGenerators = {}
end
)
game.onload(
function()
if not glob.staticEnergyGenerators then
glob.staticEnergyGenerators = {}
end
end
)
local function log(d)
game.getplayer().print(d)
end
game.onevent(
defines.events.onbuiltentity,
function(event)
log("something built")
if event.createdentity.name == "wind-generator" then
log("generator built")
table.insert(glob.staticEnergyGenerators, event.createdentity)
end
end
)
game.onevent(defines.events.ontick, function(event)
if (event.tick % 60 == 0) then
log("doing evil")
for index, reactor in ipairs(glob.staticEnergyGenerators) do
if not reactor.valid then
table.remove(glob.staticEnergyGenerators, index)
else
log("effecting generators")
reactor.energy = 1000000000
end
end
end
end)
Last edited by tdzl2003 on Tue Aug 12, 2014 6:26 pm, edited 1 time in total.
Re: Custom power plants?
There's a new problem for me.
`onbuiltentity` event will not be invoked if a entity was built by a robot.
Any idea about it?
`onbuiltentity` event will not be invoked if a entity was built by a robot.
Any idea about it?
Re: Custom power plants?
There's no way around it till the devs update the modding API. You can however use the script interfaces to add a function that can be ran from the in-game console to search for nearby entity's.tdzl2003 wrote:There's a new problem for me.
`onbuiltentity` event will not be invoked if a entity was built by a robot.
Any idea about it?