Fix assignment to unassigned global

This commit is contained in:
rubenwardy 2014-12-28 17:16:10 +00:00
parent c8e8bc8f41
commit 67c1a38987

View File

@ -60,7 +60,7 @@ minetest.register_abm({
meta:set_string("team",team) meta:set_string("team",team)
meta:set_string("infotext", "Owned by "..team) meta:set_string("infotext", "Owned by "..team)
end end
if not team then if not team then
return return
end end
@ -83,12 +83,12 @@ minetest.register_abm({
-- Create bullet entity -- Create bullet entity
local bullet=minetest.env:add_entity({x=pos.x,y=pos.y+0.5,z=pos.z}, "ctf_turret:arrow_entity") local bullet=minetest.env:add_entity({x=pos.x,y=pos.y+0.5,z=pos.z}, "ctf_turret:arrow_entity")
-- Set velocity -- Set velocity
bullet:setvelocity({x=calc.x * ARROW_VELOCITY,y=calc.y * ARROW_VELOCITY,z=calc.z * ARROW_VELOCITY}) bullet:setvelocity({x=calc.x * ARROW_VELOCITY,y=calc.y * ARROW_VELOCITY,z=calc.z * ARROW_VELOCITY})
-- Play sound -- Play sound
music_handle=minetest.sound_play("laser",{pos = pos, gain = 1.0, max_hear_distance = 50,}) minetest.sound_play("laser", {pos = pos, gain = 1.0, max_hear_distance = 50,})
end end
end end
end end
@ -108,7 +108,7 @@ THROWING_ARROW_ENTITY={
if self.timer > 2 then if self.timer > 2 then
self.object:remove() self.object:remove()
end end
if self.timer > 0.2 then if self.timer > 0.2 then
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1.5) local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1.5)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
@ -118,8 +118,8 @@ THROWING_ARROW_ENTITY={
end end
end end
end end
local node = minetest.env:get_node(pos) local node = minetest.env:get_node(pos)
if node.name ~= "air" and node.name ~= "ctf_turret:turret" then if node.name ~= "air" and node.name ~= "ctf_turret:turret" then
--minetest.env:add_item(self.lastpos, "throwing:arrow") --minetest.env:add_item(self.lastpos, "throwing:arrow")
self.object:remove() self.object:remove()
@ -136,4 +136,4 @@ minetest.register_craft({
{"default:gold_ingot", "default:mese_crystal", "default:gold_ingot"}, {"default:gold_ingot", "default:mese_crystal", "default:gold_ingot"},
{"default:mese_crystal", "default:gold_ingot", "default:mese_crystal"} {"default:mese_crystal", "default:gold_ingot", "default:mese_crystal"}
} }
}) })