Make most variables local

This commit is contained in:
Wuzzy 2016-08-11 17:37:36 +02:00
parent ebf8395791
commit 24e6c49b83
2 changed files with 10 additions and 10 deletions

View File

@ -46,8 +46,8 @@ local ANIM_WALK = 4
local ANIM_WALK_MINE = 5
local ANIM_MINE = 6
function hit(self)
prop = {
local function hit(self)
local prop = {
mesh = mummy_mesh,
textures = {"tsm_pyramids_mummy.png^tsm_pyramids_hit.png"},
}
@ -58,12 +58,12 @@ function hit(self)
end)
end
function mummy_update_visuals_def(self)
local function mummy_update_visuals_def(self)
--local name = get_player_name()
visual = default_model_def
local visual = default_model_def
npc_anim = 0 -- Animation will be set further below immediately
--npc_sneak[name] = false
prop = {
local prop = {
mesh = mummy_mesh,
textures = mummy_texture,
--visual_size = {x=1, y=1, z=1},
@ -71,7 +71,7 @@ function mummy_update_visuals_def(self)
self.object:set_properties(prop)
end
MUMMY_DEF = {
local MUMMY_DEF = {
physical = true,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
@ -94,7 +94,7 @@ MUMMY_DEF = {
mob_name = "mummy"
}
spawner_DEF = {
local spawner_DEF = {
hp_max = 1,
physical = true,
collisionbox = {0,0,0,0,0,0},
@ -257,8 +257,8 @@ MUMMY_DEF.on_step = function(self, dtime)
for _,object in ipairs(minetest.env:get_objects_inside_radius(self.object:getpos(), 4)) do
if object:is_player() then
self.yawwer = false
NPC = self.object:getpos()
PLAYER = object:getpos()
local NPC = self.object:getpos()
local PLAYER = object:getpos()
self.vec = {x=PLAYER.x-NPC.x, y=PLAYER.y-NPC.y, z=PLAYER.z-NPC.z}
self.yaw = math.atan(self.vec.z/self.vec.x)+math.pi^2
if PLAYER.x > NPC.x then

View File

@ -10,7 +10,7 @@ for i=1,3 do
})
end
trap_on_timer = function (pos, elapsed)
local trap_on_timer = function (pos, elapsed)
local objs = minetest.env:get_objects_inside_radius(pos, 2)
for i, obj in pairs(objs) do
if obj:is_player() then