Cleanup
parent
4011882749
commit
8928d84efe
24
register.lua
24
register.lua
|
@ -37,7 +37,7 @@ local function translate_def(def)
|
||||||
mesh = def.model.mesh,
|
mesh = def.model.mesh,
|
||||||
textures = def.model.textures,
|
textures = def.model.textures,
|
||||||
collisionbox = def.model.collisionbox or {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
collisionbox = def.model.collisionbox or {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
visual_size = def.model.scale or {x = 1, y = 1},
|
visual_size = def.model.scale or {x=1, y=1},
|
||||||
backface_culling = def.model.backface_culling or false,
|
backface_culling = def.model.backface_culling or false,
|
||||||
collide_with_objects = def.model.collide_with_objects or true,
|
collide_with_objects = def.model.collide_with_objects or true,
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
@ -51,7 +51,7 @@ local function translate_def(def)
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Tanslate modes to better accessable format
|
-- Tanslate modes to better accessable format
|
||||||
for mn,def in pairs(def.modes) do
|
for mn, def in pairs(def.modes) do
|
||||||
local name = tostring(mn)
|
local name = tostring(mn)
|
||||||
if name ~= "update_time" then
|
if name ~= "update_time" then
|
||||||
new_def.modes[name] = def
|
new_def.modes[name] = def
|
||||||
|
@ -108,7 +108,7 @@ local function translate_def(def)
|
||||||
if def.get_staticdata then
|
if def.get_staticdata then
|
||||||
local data = def.get_staticdata(self)
|
local data = def.get_staticdata(self)
|
||||||
if data and type(data) == "table" then
|
if data and type(data) == "table" then
|
||||||
for s,w in pairs(data) do
|
for s, w in pairs(data) do
|
||||||
main_tab[s] = w
|
main_tab[s] = w
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -146,10 +146,10 @@ local function translate_def(def)
|
||||||
|
|
||||||
-- Timers
|
-- Timers
|
||||||
self.lifetimer = 0
|
self.lifetimer = 0
|
||||||
self.modetimer = math.random()--0
|
self.modetimer = math.random() -- 0
|
||||||
self.soundtimer = math.random()
|
self.soundtimer = math.random()
|
||||||
self.nodetimer = 2 -- ensure we get the first step
|
self.nodetimer = 2 -- ensure we get the first step
|
||||||
self.yawtimer = math.random() * 2--0
|
self.yawtimer = math.random() * 2 -- 0
|
||||||
self.followtimer = 0
|
self.followtimer = 0
|
||||||
if self.can_swim then
|
if self.can_swim then
|
||||||
self.swimtimer = 2 -- ensure we get the first step
|
self.swimtimer = 2 -- ensure we get the first step
|
||||||
|
@ -168,11 +168,10 @@ local function translate_def(def)
|
||||||
|
|
||||||
-- Other things
|
-- Other things
|
||||||
|
|
||||||
|
|
||||||
if staticdata then
|
if staticdata then
|
||||||
local tab = core.deserialize(staticdata)
|
local tab = core.deserialize(staticdata)
|
||||||
if tab and type(tab) == "table" then
|
if tab and type(tab) == "table" then
|
||||||
for s,w in pairs(tab) do
|
for s, w in pairs(tab) do
|
||||||
self[tostring(s)] = w
|
self[tostring(s)] = w
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -200,8 +199,8 @@ local function translate_def(def)
|
||||||
self.hostile = false
|
self.hostile = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- immortal is needed to disable clientside smokepuff shit
|
-- immortal is needed to disable clientside smokepuff
|
||||||
self.object:set_armor_groups({fleshy = 100, immortal = 1})
|
self.object:set_armor_groups({fleshy=100, immortal=1})
|
||||||
|
|
||||||
-- call custom on_activate if defined
|
-- call custom on_activate if defined
|
||||||
if def.on_activate then
|
if def.on_activate then
|
||||||
|
@ -350,11 +349,12 @@ end
|
||||||
-- @table ModelDef
|
-- @table ModelDef
|
||||||
-- @tfield string mesh Mesh name (see Minetest Documentation for supported filetypes).
|
-- @tfield string mesh Mesh name (see Minetest Documentation for supported filetypes).
|
||||||
-- @tfield table textures Table of textures (see Minetest Documentation).
|
-- @tfield table textures Table of textures (see Minetest Documentation).
|
||||||
-- @tfield NodeBox collisionbox Defines mesh collision box (see Minetest Documentation).
|
-- @tfield[opt] NodeBox collisionbox Defines mesh collision box (see Minetest Documentation).
|
||||||
-- @tfield[opt] table scale Sets visual scale (default: {x=1, y=1}).
|
-- @tfield[opt] table scale Sets visual scale (default: {x=1, y=1}).
|
||||||
-- @tfield[opt] float rotation Sets rotation offset when moving (default: 0.0).
|
-- @tfield[opt] float rotation Sets rotation offset when moving (default: 0.0).
|
||||||
-- @tfield[opt] bool backface_culling Set to `true` to enable backface culling.
|
-- @tfield[opt] bool backface_culling Set to `true` to enable backface culling.
|
||||||
-- @tfield[opt] table animations Table of `AnimationDef` used if defined.
|
-- @tfield[opt] table animations Table of `AnimationDef` used if defined.
|
||||||
|
-- @tfield[opt] bool collide_with_objects Collide with other objects (default: `true`).
|
||||||
|
|
||||||
--- Animations defiintion table.
|
--- Animations defiintion table.
|
||||||
--
|
--
|
||||||
|
@ -493,9 +493,7 @@ end
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param staticdata
|
-- @param staticdata
|
||||||
|
|
||||||
--- Called when mob is punched.
|
--- Must return a table to save mob data (serialization is done by MOB-Engine).
|
||||||
--
|
|
||||||
-- Must return a table to save mob data (serialization is done by MOB-Engine).
|
|
||||||
-- e.g:
|
-- e.g:
|
||||||
-- ```
|
-- ```
|
||||||
-- return {
|
-- return {
|
||||||
|
|
Loading…
Reference in New Issue