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
|
};
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end;
on_timer = function(pos,delta)
local orientation = math.floor(minetest.get_node(pos).param2 / 4)
local costs = calc_cost(pos,delta)
local l = sorcery.ley.netcaps(pos,delta)
if l.self.powerdraw >= costs.mincost then
local dist = l.self.powerdraw / (constants.cost_per_barrier * delta)
for i=1,math.floor(dist) do
local t = costs.targets[i]
local str = math.min(0xFF,t[2] + 50*delta);
minetest.swap_node(t[1], {
name = 'sorcery:air_barrier_' .. math.max(1, math.floor(10*(str/0xFF)));
param2 = str;
})
minetest.get_node_timer(t[1]):start(1)
end
local pn = vector.add(pos, vector.divide(costs.aim,2));
local pp = vector.add(pn, pofstbl[orientation])
pn = vector.subtract(pn, pofstbl[orientation])
minetest.add_particlespawner {
|
|
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
|
};
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end;
on_timer = function(pos,delta)
local orientation = math.floor(minetest.get_node(pos).param2 / 4)
local costs = calc_cost(pos,delta)
local probe = sorcery.spell.probe(pos)
if probe.disjunction then return true end
local l = sorcery.ley.netcaps(pos,delta)
if l.self.powerdraw >= costs.mincost then
local dist = l.self.powerdraw / (constants.cost_per_barrier * delta)
for i=1,math.floor(dist) do
local t = costs.targets[i]
local str = math.min(0xFF,t[2] + 50*delta);
local fprobe = sorcery.spell.probe(t[1])
if not fprobe.disjunction then
minetest.swap_node(t[1], {
name = 'sorcery:air_barrier_' .. math.max(1, math.floor(10*(str/0xFF)));
param2 = str;
})
minetest.get_node_timer(t[1]):start(1)
end
end
local pn = vector.add(pos, vector.divide(costs.aim,2));
local pp = vector.add(pn, pofstbl[orientation])
pn = vector.subtract(pn, pofstbl[orientation])
minetest.add_particlespawner {
|