Fix some global variable issues

This commit is contained in:
Wuzzy 2017-08-02 01:59:24 +02:00
parent 04dd0d6e02
commit 46b0f638fe
6 changed files with 21 additions and 21 deletions

View File

@ -103,7 +103,7 @@ end
minetest.register_entity("mobs_mc:arrow_entity", THROWING_ARROW_ENTITY) minetest.register_entity("mobs_mc:arrow_entity", THROWING_ARROW_ENTITY)
arrows = { local arrows = {
{"mobs_mc:arrow", "mobs_mc:arrow_entity" }, {"mobs_mc:arrow", "mobs_mc:arrow_entity" },
} }
@ -188,7 +188,7 @@ if c("egg") then
visual = "sprite", visual = "sprite",
visual_size = {x=.5, y=.5}, visual_size = {x=.5, y=.5},
textures = {"mobs_chicken_egg.png"}, textures = {"mobs_chicken_egg.png"},
velocity = egg_velocity, velocity = egg_VELOCITY,
hit_player = function(self, player) hit_player = function(self, player)
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, { player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {

View File

@ -56,8 +56,8 @@ mobs:register_mob("mobs_mc:creeper", {
local wdef = item:get_definition() local wdef = item:get_definition()
item:add_wear(1000) item:add_wear(1000)
-- Tool break sound -- Tool break sound
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) minetest.sound_play(wdef.sound.breaks, {pos = clicker:getpos(), gain = 0.5})
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end

View File

@ -133,9 +133,9 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
minetest.set_node(pos, {name="air"}) minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then if math.random(1,2)==1 then
dx = math.random(-1,1) local dx = math.random(-1,1)
dy = math.random(-1,1) local dy = math.random(-1,1)
dz = math.random(-1,1) local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"}) minetest.set_node(p, {name="air"})
end end
@ -152,7 +152,7 @@ mobs:register_arrow(":mobs_mc:fireball2", {
-- direct hit, no fire... just plenty of pain -- direct hit, no fire... just plenty of pain
hit_player = function(self, player) hit_player = function(self, player)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) minetest.sound_play("tnt_explode", {pos = player:getpos(), gain = 1.5, max_hear_distance = 2*64})
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 6}, damage_groups = {fleshy = 6},
@ -160,9 +160,9 @@ mobs:register_arrow(":mobs_mc:fireball2", {
end, end,
hit_mob = function(self, player) hit_mob = function(self, mob)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) minetest.sound_play("tnt_explode", {pos = mob:getpos(), gain = 1.5, max_hear_distance = 2*64})
player:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 12}, damage_groups = {fleshy = 12},
}, nil) }, nil)

View File

@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:enderman", {
-- TODO: Update enderman model (enderman holding block) -- TODO: Update enderman model (enderman holding block)
local def = minetest.registered_nodes[self._taken_node] local def = minetest.registered_nodes[self._taken_node]
if def.sounds and def.sounds.dug then if def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {pos = place_pos, max_hear_distance = 16}) minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16})
end end
end end
end end

View File

@ -112,9 +112,9 @@ local spawn = {
local spawn_desert = table.copy(spawn) local spawn_desert = table.copy(spawn)
spawn_desert.nodes = mobs_mc.spawn.desert spawn_desert.nodes = mobs_mc.spawn.desert
on_spawn = function(self, pos) local on_spawn = function(self, pos)
local ent = self:get_luaentity() local ent = self:get_luaentity()
texture = "mobs_mc_rabbit_gold.png" local texture = "mobs_mc_rabbit_gold.png"
ent.base_texture = { "mobs_mc_rabbit_gold.png" } ent.base_texture = { "mobs_mc_rabbit_gold.png" }
self:set_properties({textures = ent.base_texture}) self:set_properties({textures = ent.base_texture})
end end

View File

@ -108,9 +108,9 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
minetest.set_node(pos, {name="air"}) minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then if math.random(1,2)==1 then
dx = math.random(-1,1) local dx = math.random(-1,1)
dy = math.random(-1,1) local dy = math.random(-1,1)
dz = math.random(-1,1) local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"}) minetest.set_node(p, {name="air"})
end end
@ -127,7 +127,7 @@ mobs:register_arrow(":mobs_mc:fireball", {
-- direct hit, no fire... just plenty of pain -- direct hit, no fire... just plenty of pain
hit_player = function(self, player) hit_player = function(self, player)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 16}) minetest.sound_play("tnt_explode", {pos = player:getpos(), gain = 1.5, max_hear_distance = 16})
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 8}, damage_groups = {fleshy = 8},
@ -135,9 +135,9 @@ mobs:register_arrow(":mobs_mc:fireball", {
end, end,
hit_mob = function(self, player) hit_mob = function(self, mob)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5,max_hear_distance = 16}) minetest.sound_play("tnt_explode", {pos = mob:getpos(), gain = 1.5,max_hear_distance = 16})
player:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 8}, damage_groups = {fleshy = 8},
}, nil) }, nil)