mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Finally indent register_mob and make registered mobs global
This commit is contained in:
parent
a3415647d4
commit
bc496a8682
1 changed files with 198 additions and 196 deletions
|
@ -1,6 +1,7 @@
|
||||||
mcl_mobs = {}
|
mcl_mobs = {}
|
||||||
mcl_mobs.mob_class = {}
|
mcl_mobs.mob_class = {}
|
||||||
mcl_mobs.mob_class_meta = {__index = mcl_mobs.mob_class}
|
mcl_mobs.mob_class_meta = {__index = mcl_mobs.mob_class}
|
||||||
|
mcl_mobs.registered_mobs = {}
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local path = minetest.get_modpath(modname)
|
local path = minetest.get_modpath(modname)
|
||||||
local S = minetest.get_translator(modname)
|
local S = minetest.get_translator(modname)
|
||||||
|
@ -111,6 +112,7 @@ mcl_mobs.spawning_mobs = {}
|
||||||
function mcl_mobs.register_mob(name, def)
|
function mcl_mobs.register_mob(name, def)
|
||||||
|
|
||||||
mcl_mobs.spawning_mobs[name] = true
|
mcl_mobs.spawning_mobs[name] = true
|
||||||
|
mcl_mobs.registered_mobs[name] = def
|
||||||
|
|
||||||
local can_despawn
|
local can_despawn
|
||||||
if def.can_despawn ~= nil then
|
if def.can_despawn ~= nil then
|
||||||
|
@ -136,8 +138,7 @@ local collisionbox = def.collisionbox or {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}
|
||||||
if collisionbox[5] < 0.79 then
|
if collisionbox[5] < 0.79 then
|
||||||
collisionbox[5] = 0.79
|
collisionbox[5] = 0.79
|
||||||
end
|
end
|
||||||
|
local final_def = {
|
||||||
minetest.register_entity(name, setmetatable({
|
|
||||||
use_texture_alpha = def.use_texture_alpha,
|
use_texture_alpha = def.use_texture_alpha,
|
||||||
head_swivel = def.head_swivel or nil, -- bool to activate this function
|
head_swivel = def.head_swivel or nil, -- bool to activate this function
|
||||||
head_yaw_offset = def.head_yaw_offset or 0, -- for wonkey model bones
|
head_yaw_offset = def.head_yaw_offset or 0, -- for wonkey model bones
|
||||||
|
@ -310,7 +311,8 @@ minetest.register_entity(name, setmetatable({
|
||||||
end,
|
end,
|
||||||
harmed_by_heal = def.harmed_by_heal,
|
harmed_by_heal = def.harmed_by_heal,
|
||||||
on_lightning_strike = def.on_lightning_strike
|
on_lightning_strike = def.on_lightning_strike
|
||||||
},mcl_mobs.mob_class_meta))
|
}
|
||||||
|
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
||||||
|
|
||||||
if minetest.get_modpath("doc_identifier") ~= nil then
|
if minetest.get_modpath("doc_identifier") ~= nil then
|
||||||
doc.sub.identifier.register_object(name, "basics", "mobs")
|
doc.sub.identifier.register_object(name, "basics", "mobs")
|
||||||
|
|
Loading…
Reference in a new issue