Put mob & spawnegg names in 'sneeker' attributes
This commit is contained in:
parent
af4f5219f1
commit
05670a46c7
13
init.lua
13
init.lua
@ -7,6 +7,9 @@ sneeker.modpath = minetest.get_modpath(sneeker.modname)
|
|||||||
|
|
||||||
local log_mods = minetest.setting_getbool("log_mods")
|
local log_mods = minetest.setting_getbool("log_mods")
|
||||||
|
|
||||||
|
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
|
||||||
|
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
|
||||||
|
|
||||||
if log_mods then
|
if log_mods then
|
||||||
minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...")
|
minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...")
|
||||||
end
|
end
|
||||||
@ -359,10 +362,10 @@ def.get_staticdata = function(self)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity("sneeker:sneeker",def)
|
minetest.register_entity(sneeker.mob_name, def)
|
||||||
|
|
||||||
if minetest.global_exists("spawneggs") then
|
if minetest.global_exists("spawneggs") then
|
||||||
minetest.register_craftitem("sneeker:spawnegg",{
|
minetest.register_craftitem(sneeker.spawnegg_name, {
|
||||||
description = "Sneeker Spawn Egg",
|
description = "Sneeker Spawn Egg",
|
||||||
inventory_image = "sneeker_spawnegg.png",
|
inventory_image = "sneeker_spawnegg.png",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
@ -370,7 +373,7 @@ if minetest.global_exists("spawneggs") then
|
|||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
minetest.add_entity(pos,"sneeker:sneeker")
|
minetest.add_entity(pos, sneeker.mob_name)
|
||||||
if not minetest.settings:get_bool("creative_mode", false) then
|
if not minetest.settings:get_bool("creative_mode", false) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
@ -380,10 +383,10 @@ if minetest.global_exists("spawneggs") then
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "sneeker:spawnegg",
|
output = sneeker.spawnegg_name,
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {"spawneggs:egg", "tnt:tnt",},
|
recipe = {"spawneggs:egg", "tnt:tnt",},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("spawneggs:sneeker", "sneeker:spawnegg")
|
minetest.register_alias("spawneggs:sneeker", sneeker.spawnegg_name)
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ if minetest.settings:get_bool("log_mods", false) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_grass","default:stone"},
|
nodenames = {"default:dirt_with_grass", "default:stone"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = spawn_interval,
|
interval = spawn_interval,
|
||||||
chance = spawn_chance,
|
chance = spawn_chance,
|
||||||
@ -42,6 +42,6 @@ minetest.register_abm({
|
|||||||
if minetest.get_node(pos).name ~= "air" then
|
if minetest.get_node(pos).name ~= "air" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.add_entity(pos,"sneeker:sneeker")
|
minetest.add_entity(pos, sneeker.mob_name)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user