Guest User

Untitled

a guest
Dec 24th, 2012
18
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use_mesecons = false
  2.  
  3. function npc_spawner(pos)
  4. 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")
  5. --[[    local count = minetest.env:get_objects_inside_radius(pos, 20)
  6.     local MAX_NPC = 3
  7.  
  8.     if count>MAX_NPC then
  9.         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")
  10.         end
  11.     end]]--
  12.  
  13.     if use_mesecons == true then
  14.         minetest.register_node("peaceful_npc:npc_spawner", {
  15.             description = "NPC Portal",
  16.             drawtype = "glasslike",
  17.             groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
  18.             sounds = default.node_sound_glass_defaults(),
  19.             tiles = {"peaceful_npc_spawner.png"},
  20.             sunlight_propagates = true,
  21.             paramtype = "light",
  22.             mesecons = {effector = {
  23.                 action_on = npc_spawner
  24.             }}
  25.         })
  26.     end
  27.  
  28. if use_mesecons == false then
  29.     minetest.register_node("peaceful_npc:npc_spawner", {
  30.         description = "NPC Portal",
  31.         drawtype = "glasslike",
  32.         groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
  33.         sounds = default.node_sound_glass_defaults(),
  34.         tiles = {"peaceful_npc_spawner.png"},
  35.         sunlight_propagates = true,
  36.         paramtype = "light",
  37.     })
  38.     minetest.register_abm({
  39.         nodenames = {"peaceful_npc:npc_spawner"},
  40.         interval = 5.0,
  41.         chance = 1,
  42.         action = function(pos)
  43.             npc_spawner(pos)
  44.         end,
  45.     })
  46. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×