forked from minetest-mods/mesecons
Small cleanups in internal.lua
, move forceloading reversal to legacy
This commit is contained in:
parent
e561be7fa3
commit
6dacdaee1f
@ -37,10 +37,6 @@
|
||||
-- HIGH-LEVEL Internals
|
||||
-- mesecon.is_power_on(pos) --> Returns true if pos emits power in any way
|
||||
-- mesecon.is_power_off(pos) --> Returns true if pos does not emit power in any way
|
||||
-- mesecon.turnon(pos, link) --> link is the input rule that caused calling turnon, turns on every connected node, iterative
|
||||
-- mesecon.turnoff(pos, link) --> link is the input rule that caused calling turnoff, turns off every connected node, iterative
|
||||
-- mesecon.connected_to_receptor(pos, link) --> Returns true if pos is connected to a receptor directly or via conductors, iterative
|
||||
-- mesecon.rules_link(output, input, dug_outputrules) --> Returns true if outputposition + outputrules = inputposition and inputposition + inputrules = outputposition (if the two positions connect)
|
||||
-- mesecon.is_powered(pos) --> Returns true if pos is powered by a receptor or a conductor
|
||||
|
||||
-- RULES ROTATION helpers
|
||||
@ -475,6 +471,8 @@ function mesecon.turnoff(pos, link)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Get all linking inputrules of inputnode (effector or conductor) that is connected to
|
||||
-- outputnode (receptor or conductor) at position `output` and has an output in direction `rule`
|
||||
function mesecon.rules_link_rule_all(output, rule)
|
||||
local input = vector.add(output, rule)
|
||||
local inputnode = mesecon.get_node_force(input)
|
||||
@ -494,8 +492,9 @@ function mesecon.rules_link_rule_all(output, rule)
|
||||
return rules
|
||||
end
|
||||
|
||||
-- Get all linking outputnodes of outputnode (receptor or conductor) that is connected to
|
||||
-- inputnode (effector or conductor) at position `input` and has an input in direction `rule`
|
||||
function mesecon.rules_link_rule_all_inverted(input, rule)
|
||||
--local irule = mesecon.invertRule(rule)
|
||||
local output = vector.add(input, rule)
|
||||
local outputnode = mesecon.get_node_force(output)
|
||||
local outputrules = mesecon.get_any_outputrules(outputnode)
|
||||
|
@ -28,3 +28,10 @@ function mesecon.receptor_off(self, pos, rules)
|
||||
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
|
||||
end
|
||||
|
||||
-- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
|
||||
-- used forceloading instead of VoxelManipulators.
|
||||
local old_forceloaded_blocks = mesecon.file2table("mesecon_forceloaded")
|
||||
for hash, _ in pairs(old_forceloaded_blocks) do
|
||||
minetest.forceload_free_block(unhash_blockpos(hash))
|
||||
end
|
||||
os.remove(minetest.get_worldpath()..DIR_DELIM.."mesecon_forceloaded")
|
||||
|
@ -219,7 +219,7 @@ function mesecon.table2file(filename, table)
|
||||
f:close()
|
||||
end
|
||||
|
||||
-- Forceloading: Force server to load area if node is nil
|
||||
-- Block position "hashing" (convert to integer) functions for voxelmanip cache
|
||||
local BLOCKSIZE = 16
|
||||
|
||||
-- convert node position --> block hash
|
||||
@ -363,14 +363,6 @@ function mesecon.swap_node_force(pos, name)
|
||||
end
|
||||
end
|
||||
|
||||
-- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
|
||||
-- used forceloading instead of VoxelManipulators.
|
||||
local old_forceloaded_blocks = mesecon.file2table("mesecon_forceloaded")
|
||||
for hash, _ in pairs(old_forceloaded_blocks) do
|
||||
minetest.forceload_free_block(unhash_blockpos(hash))
|
||||
end
|
||||
os.remove(wpath..DIR_DELIM.."mesecon_forceloaded")
|
||||
|
||||
-- Autoconnect Hooks
|
||||
-- Nodes like conductors may change their appearance and their connection rules
|
||||
-- right after being placed or after being dug, e.g. the default wires use this
|
||||
|
Loading…
Reference in New Issue
Block a user