274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
local dev = portal_composition(pos)
if not dev then return false end
local dsp = portal_disposition(dev)
local crc = portal_circuit(pos)
local cap = sorcery.ley.netcaps(pos,delta)
local tune = sorcery.attunement.verify(pos)
local partner -- raw position of partner node, if any
if tune and tune.partner then
minetest.load_area(tune.partner)
-- we are attuned to a partner, but is it in the circuit?
for _,v in pairs(crc) do
if vector.equals(v.pos,tune.partner) then
partner = tune.partner
break
................................................................................
if cap.self.minpower ~= cap.self.powerdraw then return true end
-- clean out user table
for name,user in pairs(portal_context.users) do
if user and vector.equals(user.portal, pos) then
local found = false
for _,u in pairs(dsp.users) do
if u.object:get_player_name() == name then
found = true
end
end
if not found then
if user.sound then minetest.sound_fade(user.sound,1,0) end
portal_context.users[name] = nil
end
end
end
-- one user per pad only!
for _,n in pairs(dev.nodes) do
for _,u in pairs(dsp.users) do
if u.slot == n then
local pname = u.object:get_player_name()
if not portal_context.users[pname] then
|
|
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
local dev = portal_composition(pos)
if not dev then return false end
local dsp = portal_disposition(dev)
local crc = portal_circuit(pos)
local cap = sorcery.ley.netcaps(pos,delta)
local tune = sorcery.attunement.verify(pos)
local partner -- raw position of partner node, if any
local probe = sorcery.spell.probe(pos)
if tune and tune.partner then
minetest.load_area(tune.partner)
-- we are attuned to a partner, but is it in the circuit?
for _,v in pairs(crc) do
if vector.equals(v.pos,tune.partner) then
partner = tune.partner
break
................................................................................
if cap.self.minpower ~= cap.self.powerdraw then return true end
-- clean out user table
for name,user in pairs(portal_context.users) do
if user and vector.equals(user.portal, pos) then
local found = false
if not probe.disjunction then
for _,u in pairs(dsp.users) do
if u.object:get_player_name() == name then
found = true
end
end
end
if not found then
if user.sound then minetest.sound_fade(user.sound,1,0) end
portal_context.users[name] = nil
end
end
end
if probe.disjunction then return true end
-- one user per pad only!
for _,n in pairs(dev.nodes) do
for _,u in pairs(dsp.users) do
if u.slot == n then
local pname = u.object:get_player_name()
if not portal_context.users[pname] then
|