195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
end
if not transmission then return false end
-- iterate through available receptacles and see if there's room
-- in any of them. otherwise, fail
for _,r in pairs(remote.receptacles) do
local i = minetest.get_meta(r):get_inventory()
transmission = i:add_item('cache',transmission)
if transmission:is_empty() then break end
end
if not transmission:is_empty() then inv:add_item('cache',transmission) end
return true
elseif n.maxpower >= n.self.maxpower then
-- other devices are currently drawing power and might stop,
-- making enough available for us; keep iterating just in case
return true
else
-- the system does not have the capability to generate
|
|
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
end
if not transmission then return false end
-- iterate through available receptacles and see if there's room
-- in any of them. otherwise, fail
for _,r in pairs(remote.receptacles) do
local i = minetest.get_meta(r):get_inventory()
transmission = i:add_item('cache',transmission)
minetest.sound_play('sorcery_zap', { gain = 0.5, pos = r })
if transmission:is_empty() then break end
end
if not transmission:is_empty() then inv:add_item('cache',transmission) else
minetest.sound_play('sorcery_zap', { gain = 0.5, pos = pos })
end
-- TODO add particle fx as well
return true
elseif n.maxpower >= n.self.maxpower then
-- other devices are currently drawing power and might stop,
-- making enough available for us; keep iterating just in case
return true
else
-- the system does not have the capability to generate
|