settings file, map generation

This commit is contained in:
juraj 2016-03-05 18:54:38 +01:00
parent ca43f0d8d6
commit 8bdede04bb
6 changed files with 78 additions and 11 deletions

View File

@ -14,6 +14,8 @@
-- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'.
-- [env : boolean] - This spawner will become environmental spawner. Environmental spawners have different properties/behaviour (used for map gen) and cannot be crafted.
-- [*] -> MANDATORY - has to be filled in!
-- mods what should be enabled and loded, remove/add the one you want to load
@ -93,6 +95,17 @@ MOBS_PROPS = {
night_only=false,
sound_custom=""
},
{
name="spider",
egg_name_custom="",
dummy_size={x=2,y=2},
dummy_offset=-0.2,
dummy_mesh="mobs_spider.x",
dummy_texture={"mobs_spider.png"},
night_only="disable",
sound_custom="",
env = true
},
{
name="stone_monster",
egg_name_custom="",

View File

@ -1,4 +1,7 @@
-- user settings
-- Main settings
dofile(minetest.get_modpath("spawners").."/settings.txt")
-- Spawners configurations
dofile(minetest.get_modpath("spawners").."/config.lua")
-- API
@ -10,7 +13,23 @@ dofile(minetest.get_modpath("spawners").."/spawners_mobs.lua")
-- Spawners for ores
dofile(minetest.get_modpath("spawners").."/spawners_ores.lua")
-- include mummy mobs redo addon (mob)
if minetest.get_modpath("mobs") then
dofile(minetest.get_modpath("spawners").."/mob_mummy.lua")
end
-- Spawners Pyramids
dofile(minetest.get_modpath("spawners").."/pyramids.lua")
if SPAWN_PYRAMIDS then
dofile(minetest.get_modpath("spawners").."/pyramids.lua")
print("[Mod][spawners] Pyramids enabled")
end
-- Spawners Pyramids
if SPAWNERS_GENERATE then
dofile(minetest.get_modpath("spawners").."/spawners_gen.lua")
print("[Mod][spawners] Environmental enabled")
end
print ("[Mod] Spawners 0.6 Loaded.")

View File

@ -5,11 +5,6 @@ pyramids = {}
dofile(minetest.get_modpath("spawners").."/pyramids_nodes.lua")
dofile(minetest.get_modpath("spawners").."/pyramids_room.lua")
-- include mummy mobs redo addon
if minetest.get_modpath("mobs") then
dofile(minetest.get_modpath("spawners").."/mob_mummy.lua")
end
local chest_stuff = {
{name="default:apple", max = 3},
{name="default:torch", max = 10},

2
settings.txt Normal file
View File

@ -0,0 +1,2 @@
SPAWN_PYRAMIDS = true
SPAWNERS_GENERATE = true

40
spawners_gen.lua Normal file
View File

@ -0,0 +1,40 @@
-- Place spawners in dungeons
local function place_spawner(param)
local tab = param[1]
local gen_obj = param[2]
local pos = tab[math.random(1, (#tab or 3))]
pos.y = pos.y - 1
local n = minetest.get_node_or_nil(pos)
if n and n.name ~= "air" then
pos.y = pos.y + 1
if gen_obj == "dungeon" then
minetest.log("action", "[Mod][Spawners] dungeon spawner placed at: "..minetest.pos_to_string(pos))
minetest.set_node(pos, {name = "spawners:spawners_mummy_spawner_env"})
else
minetest.log("action", "[Mod][Spawners] temple spawner placed at: "..minetest.pos_to_string(pos))
minetest.set_node(pos, {name = "spawners:mobs_spider_spawner_env"})
end
end
end
minetest.set_gen_notify("dungeon")
minetest.set_gen_notify("temple")
minetest.register_on_generated(function(minp, maxp, blockseed)
local ntf = minetest.get_mapgen_object("gennotify")
if ntf and ntf.dungeon then
minetest.after(3, place_spawner, {table.copy(ntf.dungeon), "dungeon"})
end
if ntf and ntf.temple then
minetest.after(3, place_spawner, {table.copy(ntf.temple), "temple"})
end
end)

View File

@ -325,8 +325,8 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting_env"
},
neighbors = {"air"},
interval = 15.0,
chance = 10,
interval = 10.0,
chance = 6,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -360,10 +360,8 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
return
end
print(node.name)
-- make sure the right node status is shown
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"..ext then
print("active: "..node.name)
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"..ext})
end