Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use_mesecons = false
- function npc_spawner(pos)
- minetest.env:add_entity({x=pos.x+math.random(-1,1),y=pos.y+math.random(2,3),z=pos.z+math.random(-1,1)}, "peaceful_npc:npc")
- --[[ local count = minetest.env:get_objects_inside_radius(pos, 20)
- local MAX_NPC = 3
- if count>MAX_NPC then
- action_off = minetest.env:add_entity({x=pos.x+math.random(-1,1),y=pos.y+math.random(2,3),z=pos.z+math.random(-1,1)}, "peaceful_npc:npc")
- end
- end]]--
- if use_mesecons == true then
- minetest.register_node("peaceful_npc:npc_spawner", {
- description = "NPC Portal",
- drawtype = "glasslike",
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
- sounds = default.node_sound_glass_defaults(),
- tiles = {"peaceful_npc_spawner.png"},
- sunlight_propagates = true,
- paramtype = "light",
- mesecons = {effector = {
- action_on = npc_spawner
- }}
- })
- end
- if use_mesecons == false then
- minetest.register_node("peaceful_npc:npc_spawner", {
- description = "NPC Portal",
- drawtype = "glasslike",
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
- sounds = default.node_sound_glass_defaults(),
- tiles = {"peaceful_npc_spawner.png"},
- sunlight_propagates = true,
- paramtype = "light",
- })
- minetest.register_abm({
- nodenames = {"peaceful_npc:npc_spawner"},
- interval = 5.0,
- chance = 1,
- action = function(pos)
- npc_spawner(pos)
- end,
- })
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement