mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2024-12-22 23:40:18 +01:00
Make most variables local
This commit is contained in:
parent
ebf8395791
commit
24e6c49b83
18
mummy.lua
18
mummy.lua
@ -46,8 +46,8 @@ local ANIM_WALK = 4
|
|||||||
local ANIM_WALK_MINE = 5
|
local ANIM_WALK_MINE = 5
|
||||||
local ANIM_MINE = 6
|
local ANIM_MINE = 6
|
||||||
|
|
||||||
function hit(self)
|
local function hit(self)
|
||||||
prop = {
|
local prop = {
|
||||||
mesh = mummy_mesh,
|
mesh = mummy_mesh,
|
||||||
textures = {"tsm_pyramids_mummy.png^tsm_pyramids_hit.png"},
|
textures = {"tsm_pyramids_mummy.png^tsm_pyramids_hit.png"},
|
||||||
}
|
}
|
||||||
@ -58,12 +58,12 @@ function hit(self)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mummy_update_visuals_def(self)
|
local function mummy_update_visuals_def(self)
|
||||||
--local name = get_player_name()
|
--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_anim = 0 -- Animation will be set further below immediately
|
||||||
--npc_sneak[name] = false
|
--npc_sneak[name] = false
|
||||||
prop = {
|
local prop = {
|
||||||
mesh = mummy_mesh,
|
mesh = mummy_mesh,
|
||||||
textures = mummy_texture,
|
textures = mummy_texture,
|
||||||
--visual_size = {x=1, y=1, z=1},
|
--visual_size = {x=1, y=1, z=1},
|
||||||
@ -71,7 +71,7 @@ function mummy_update_visuals_def(self)
|
|||||||
self.object:set_properties(prop)
|
self.object:set_properties(prop)
|
||||||
end
|
end
|
||||||
|
|
||||||
MUMMY_DEF = {
|
local MUMMY_DEF = {
|
||||||
physical = true,
|
physical = true,
|
||||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
@ -94,7 +94,7 @@ MUMMY_DEF = {
|
|||||||
mob_name = "mummy"
|
mob_name = "mummy"
|
||||||
}
|
}
|
||||||
|
|
||||||
spawner_DEF = {
|
local spawner_DEF = {
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
physical = true,
|
physical = true,
|
||||||
collisionbox = {0,0,0,0,0,0},
|
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
|
for _,object in ipairs(minetest.env:get_objects_inside_radius(self.object:getpos(), 4)) do
|
||||||
if object:is_player() then
|
if object:is_player() then
|
||||||
self.yawwer = false
|
self.yawwer = false
|
||||||
NPC = self.object:getpos()
|
local NPC = self.object:getpos()
|
||||||
PLAYER = object:getpos()
|
local PLAYER = object:getpos()
|
||||||
self.vec = {x=PLAYER.x-NPC.x, y=PLAYER.y-NPC.y, z=PLAYER.z-NPC.z}
|
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
|
self.yaw = math.atan(self.vec.z/self.vec.x)+math.pi^2
|
||||||
if PLAYER.x > NPC.x then
|
if PLAYER.x > NPC.x then
|
||||||
|
@ -10,7 +10,7 @@ for i=1,3 do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
trap_on_timer = function (pos, elapsed)
|
local trap_on_timer = function (pos, elapsed)
|
||||||
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
||||||
for i, obj in pairs(objs) do
|
for i, obj in pairs(objs) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
|
Loading…
Reference in New Issue
Block a user