Differences From
Artifact [110ec2eec9]:
- File
leylines.lua
— part of check-in
[3f6a913e4e]
at
2020-09-29 12:40:28
on branch trunk
— * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior
* initial documentation commit
* initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes
(user:
lexi,
size: 25805)
[annotate]
[blame]
[check-ins using]
376 376 local function find(positions)
377 377 local searchnext = {}
378 378 for _,pos in pairs(positions) do
379 379 for _,p in pairs(sorcery.ley.txofs) do
380 380 local sum = vector.add(pos,p)
381 381 if not foundp(sum) then
382 382 checked[#checked + 1] = sum
383 - local nodename = minetest.get_node(sum).name
384 - if nodename == 'ignore' then
385 - minetest.load_area(sum)
386 - nodename = minetest.get_node(sum).name
387 - end
383 + local nodename = sorcery.lib.node.force(sum).name
388 384 if minetest.get_item_group(nodename,'sorcery_ley_device') ~= 0
389 385 or sorcery.data.compat.ley[nodename] then
390 386 local d = sorcery.ley.sample(pos,1,nodename,{query={mode=true}})
391 387 assert(d.mode == 'signal'
392 388 or d.mode == 'consume'
393 389 or d.mode == 'produce')
394 390 devices[d.mode][#(devices[d.mode]) + 1] = {
................................................................................
483 479 maxpower = obj.maxpower / 10000.0;
484 480 power = (obj.minpower == obj.maxpower) and obj.minpower or nil;
485 481 affinity = affs;
486 482 }
487 483 end
488 484 end
489 485 sorcery.ley.setnode = function(pos,l)
490 - local meta = minetest.get_node(pos)
486 + local meta = minetest.get_meta(pos)
491 487 meta:set_string('sorcery:ley',sorcery.ley.encode(l))
492 488 end
493 489
494 490 sorcery.ley.sample = function(pos,timespan,name,flags)
495 491 -- returns how much ley-force can be transmitted by a
496 492 -- device over timespan
497 493 local ret = {}
................................................................................
730 726 end;
731 727 after_dig_node = sorcery.lib.node.purge_container;
732 728 on_metadata_inventory_put = update_generator;
733 729 on_metadata_inventory_take = update_generator;
734 730 on_timer = function(pos,delta)
735 731 local meta = minetest.get_meta(pos)
736 732 local inv = meta:get_inventory()
737 - local self = minetest.get_node(pos)
733 + local self = sorcery.lib.node.force(pos)
738 734 local timeleft = meta:get_float('burnleft') - delta
739 735 local again = false
740 736 local power = meta:get_float('power')
741 737 local burning = active
742 738 if timeleft < 0 then timeleft = 0 end
743 739 if not active or timeleft == 0 then
744 740 if inv:is_empty('fuel') then