44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
...
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
...
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
|
privs = { server = true };
func = function(caller,params)
local pos = minetest.get_player_by_name(caller):get_pos()
local ley = sorcery.ley.estimate(pos)
minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ','))
end;
})
-- leyline energy can be transmitted via a conduit from a leysink. however, it cannot be stored like aetheric energy can be; leyline energy must be drawn when needed unless it is bound up in an enchantment (which simply delays its expression). leysinks provide a constant source of ley-force.
-- there are two nodes for transmitting leyline energy, wires and conduits. wires transmit a limited amount of energy, but are cheap and small. conduits transmit much more, but are expensive and take up full blocks. both are composed of electrum, the carrier, and copper, which prevents the ley-force from leaking out as dangerous radiance.
minetest.register_node('sorcery:conduit', {
description = 'Conduit';
tiles = {
'sorcery_conduit_copper_top.png';
'sorcery_conduit_copper_top.png';
'sorcery_conduit_copper_side.png';
................................................................................
end
sorcery.ley.field_to_current = function(strength,time)
local ley_factor = 0.25
-- a ley harvester will produce this much current with
-- access to a full-strength leyline
return strength * ley_factor * time;
end
do -- register condenser
local gem = sorcery.lib.image('default_diamond_block.png')
local amethyst = gem:multiply(sorcery.lib.color(sorcery.data.gems.amethyst.tone))
local emerald = gem:multiply(sorcery.lib.color(sorcery.data.gems.emerald.tone))
local box = {
................................................................................
condset('minpower',min)
condset('maxpower',min)
else
condset('minpower',min)
condset('maxpower',max)
end
else -- power usage is simply a constant
condset('power',p)
condset('minpower',p)
condset('maxpower',p)
end
else
local feval = function(v)
if type(v) == 'function' then
return v(pos,timespan)
else return v * timespan end
end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
...
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
|
privs = { server = true };
func = function(caller,params)
local pos = minetest.get_player_by_name(caller):get_pos()
local ley = sorcery.ley.estimate(pos)
minetest.chat_send_player(caller, 'Leyline force ' .. tostring(ley.force) .. ' with affinities ' .. table.concat(ley.aff, ','))
end;
})
sorcery.ley.chargetype = function(stack)
if minetest.get_item_group(stack:get_name(),'sorcery_wand') ~= 0 then
return 'wear'
else
local e = sorcery.enchant.get(stack)
if e and #e.spells > 0 then
return 'enchant'
end
end
return false
end
sorcery.ley.getcharge = function(stack)
local chargetype = sorcery.ley.chargetype(stack)
if not chargetype then return false end
if chargetype == 'wear' then
return (65535 - stack:get_wear()) / 15, 65535 / 15
elseif chargetype == 'enchant' then
local e = sorcery.enchant.get(stack)
local mat = sorcery.itemclass.get(stack:get_name(), 'material')
return e.energy, mat.data.maxenergy
end
end
sorcery.ley.setcharge = function(stack, charge, overcharge)
local max = select(2, sorcery.ley.getcharge(stack))
if not max then return false end
if charge > max and not overcharge then charge = max end
local chargetype = sorcery.ley.chargetype(stack)
if chargetype == 'wear' then
stack:set_wear(65535 - charge * 15)
elseif chargetype == 'enchant' then
local e = sorcery.enchant.get(stack)
e.energy = charge
sorcery.enchant.set(stack,e)
end
return stack
end
-- leyline energy can be transmitted via a conduit from a leysink. however, it cannot be stored like aetheric energy can be; leyline energy must be drawn when needed unless it is bound up in an enchantment (which simply delays its expression). leysinks provide a constant source of ley-force.
-- there are two nodes for transmitting leyline energy, wires and conduits. wires transmit a limited amount of energy, but are cheap and small. conduits transmit much more, but are expensive and take up full blocks. both are composed of a carrier metal and copper, which prevents the ley-force from leaking out as dangerous radiance.
minetest.register_node('sorcery:conduit', {
description = 'Conduit';
tiles = {
'sorcery_conduit_copper_top.png';
'sorcery_conduit_copper_top.png';
'sorcery_conduit_copper_side.png';
................................................................................
end
sorcery.ley.field_to_current = function(strength,time)
local ley_factor = 0.25
-- a ley harvester will produce this much current with
-- access to a full-strength leyline
return (strength * ley_factor) * time;
end
do -- register condenser
local gem = sorcery.lib.image('default_diamond_block.png')
local amethyst = gem:multiply(sorcery.lib.color(sorcery.data.gems.amethyst.tone))
local emerald = gem:multiply(sorcery.lib.color(sorcery.data.gems.emerald.tone))
local box = {
................................................................................
condset('minpower',min)
condset('maxpower',min)
else
condset('minpower',min)
condset('maxpower',max)
end
else -- power usage is simply a constant
condset('power',p * timespan)
condset('minpower',p * timespan)
condset('maxpower',p * timespan)
end
else
local feval = function(v)
if type(v) == 'function' then
return v(pos,timespan)
else return v * timespan end
end
|