aboutsummaryrefslogtreecommitdiff
path: root/src/map_settings_manager.h
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2018-07-21 03:07:43 -0700
committerLars Hofhansl <larsh@apache.org>2018-07-21 03:09:39 -0700
commit25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac (patch)
tree87a63bc5bbee4e5908a5bf81ab2d28086957122b /src/map_settings_manager.h
parentc022ddce4bb0da68a842c6479ecd7d9660d7c2fe (diff)
downloadminetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.tar.gz
minetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.tar.bz2
minetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.zip
Optimize ABM checks.
See #7555 Cache (up to 64) node types for each active block. Check this cache first to see whether any ABM needs to be triggered for a block.
Diffstat (limited to 'src/map_settings_manager.h')
0 files changed, 0 insertions, 0 deletions
n109'>109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200


local ac = {nodes={}}

function ac.load(data)
	if data then
		ac.nodes=data.nodes
	end
end
function ac.save()
	return {nodes = ac.nodes}
end

function ac.after_place_node(pos, player)
	local meta=minetest.get_meta(pos)
	meta:set_string("formspec", ac.getform(pos, meta))
	meta:set_string("infotext", "LuaAutomation component, unconfigured.")
	local ph=minetest.pos_to_string(pos)
	--just get first available key!
	for en,_ in pairs(atlatc.envs) do
		ac.nodes[ph]={env=en}
		return
	end
end
function ac.getform(pos, meta_p)
	local meta = meta_p or minetest.get_meta(pos)
	local envs_asvalues={}
	
	local ph=minetest.pos_to_string(pos)
	local nodetbl = ac.nodes[ph]
	local env, code, err = nil, "", ""
	if nodetbl then
		code=nodetbl.code or ""
		err=nodetbl.err or ""
		env=nodetbl.env or ""
	end
	local sel = 1
	for n,_ in pairs(atlatc.envs) do