added spawner + birch trees

This commit is contained in:
cale 2016-12-20 09:24:48 +01:00
parent ec688f288e
commit c461203b30
7 changed files with 47 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -214,7 +214,7 @@ minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:grass"},
sidelen = 16,
fill_ratio = 0.02,
fill_ratio = 0.01,
biomes = {"forest"},
y_min = 1,
y_max = 31000,
@ -226,7 +226,7 @@ minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:grass"},
sidelen = 16,
fill_ratio = 0.005,
fill_ratio = 0.004,
biomes = {"forest"},
y_min = 1,
y_max = 31000,
@ -246,6 +246,19 @@ minetest.register_decoration({
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:grass"},
sidelen = 16,
fill_ratio = 0.005,
biomes = {"forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/birchtree1.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_snow"},

View File

@ -7,4 +7,5 @@ local modpath = minetest.get_modpath("mobs")
dofile(modpath.."/api.lua")
dofile(modpath.."/components.lua")
dofile(modpath.."/mobs.lua")
dofile(modpath.."/spawner.lua")

31
mods/mobs/spawner.lua Normal file
View File

@ -0,0 +1,31 @@
minetest.register_node("mobs:spawner", {
description = "Spawner",
tiles = {"mobs_spawner.png", "mobs_spawner.png", "mobs_spawner_side.png"},
groups = {cracky = 3},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-8/16, -8/16, -8/16, 8/16, -6/16, 8/16},
},
},
})
minetest.register_abm({
nodenames = {"mobs:spawner"},
neighbors = {},
interval = 5,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
for i, player in ipairs(minetest.get_connected_players()) do
local p = player:getpos()
local d = vector.distance(pos, p)
if d < 6 then
local n = mobs.get_mob(xp.player_levels[player:get_player_name()])
minetest.add_entity(vector.new(pos.x, pos.y + 1, pos.z), n)
end
end
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B