Moon Logic deprecated

by mk-fg

Adds Lua-programmable circuit network combinator. Based on Sandboxed LuaCombinator and LuaCombinator2 mods. Probably won't work in multiplayer games.

Content
2 years ago
1.0 - 1.1
4.97K
Circuit network

i [fixed] Support for on_entity_cloned

3 years ago

Some mods use surface cloning. eg. Space Exploration uses it to launch spaceships.
I'm using the following code to allow a moon logic combinator to function on spaceships.
Any chance something like that could be added to the mod?
Thanks.

local function on_entity_cloned(ev)
if ev.destination.name == 'mlc-core' then
ev.destination.destroy()
return
end
if not (ev.source.name == 'mlc' and ev.destination.name == 'mlc') then return end
local uid_src, uid_dst = ev.source.unit_number, ev.destination.unit_number
global.combinators[uid_dst] = tdc(global.combinators[uid_src])
local mlc_dst, mlc_src = global.combinators[uid_dst], global.combinators[uid_src]
mlc_dst.e, mlc_dst.core, mlc_dst.next_tick = ev.destination, bootstrap_core(ev.destination), 1
guis.history_insert(global.guis[uid_dst], mlc_src, mlc_src.code or '')
end
script.on_event(defines.events.on_entity_cloned, on_entity_cloned)

3 years ago

Should be fixed in 0.0.44/45, thanks!
Merged it with settings-pasted routine, as they are pretty much same, except for how mlc-core entity in handled, and there should be no way to manually copy-paste mlc-core settings anyway.

3 years ago

Thanks. That was fast and your code looks a lot better than my hack fix.

New response