summaryrefslogtreecommitdiff
path: root/peaceful_npc/items.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-08-12 20:37:50 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-08-12 20:37:50 -0400
commit4aab7d0dbd782cf6741bdbba94440faf0c5c2e61 (patch)
treef5a13374fb176c21e381a2ae6ab53ac2ff282057 /peaceful_npc/items.lua
parent047a770ad04fc264039fa5b6109c803bd3d2d258 (diff)
downloaddreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.gz
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.bz2
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.xz
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.zip
updated several mods
biome_lib, boost cart, homedecor modpack, plantlife modpack, cottages, currency, farming redo, gloopblocks, ilights, moreores, moretrees, pipeworks, plasticbox, replacer, signs_lib, streets, travelnet, unified dyes, and vines, and maybe one or two others that I didn't see in the list. :-) I fixed the misc_overrides component (it broke when I switched over to farming redo a while back), and also I've added the classic peaceful_npc mod back into the modpack, since it seems to work now. Be sure when you run a world for the first time after this update, that you "Configure" the world, *disable* all of Dreambuilder Modpack, then re-enable the whole thing. If you don't, a few mods will fail to load due to recent changes in their dependencies.
Diffstat (limited to 'peaceful_npc/items.lua')
-rw-r--r--peaceful_npc/items.lua184
1 files changed, 184 insertions, 0 deletions
diff --git a/peaceful_npc/items.lua b/peaceful_npc/items.lua
new file mode 100644
index 0000000..f3a6828
--- /dev/null
+++ b/peaceful_npc/items.lua
@@ -0,0 +1,184 @@
+--Spawn code
+function npc_spawner(pos, SPAWN_TYPE)
+ local MAX_NPC = 5
+ local count = table.getn(minetest.get_objects_inside_radius(pos, 50))
+ if count == nil then
+ count = 0
+ end
+
+ if count <= MAX_NPC then
+ minetest.add_entity({x=pos.x+math.random(-1,1),y=pos.y+math.random(2,3),z=pos.z+math.random(-1,1)}, SPAWN_TYPE)
+ end
+end
+
+--Item Code for default npcs
+minetest.register_node("peaceful_npc:summoner_npc_def", {
+ description = "Default NPC Summoner",
+ image = "peaceful_npc_npc_summoner_def.png",
+ inventory_image = "peaceful_npc_npc_summoner_def.png",
+ wield_image = "peaceful_npc_npc_summoner_def.png",
+ paramtype = "light",
+ tiles = {"peaceful_npc_spawnegg.png"},
+ is_ground_content = true,
+ drawtype = "glasslike",
+ groups = {crumbly=3},
+ selection_box = {
+ type = "fixed",
+ fixed = {0,0,0,0,0,0}
+ },
+ sounds = default.node_sound_dirt_defaults(),
+ on_place = function(itemstack, placer, pointed)
+ local name = placer:get_player_name()
+ if (minetest.check_player_privs(name, {peacefulnpc=true})) then
+ pos = pointed.above
+ pos.y = pos.y + 1
+ minetest.add_entity(pointed.above,"peaceful_npc:npc_def")
+ itemstack:take_item(1)
+ else
+ minetest.chat_send_player(name, "Nope! You need to have the peacefulnpc priv!")
+ end
+ return itemstack
+end
+})
+
+minetest.register_node("peaceful_npc:spawner_npc_def", {
+ description = "Default 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_def.png"},
+ sunlight_propagates = true,
+ paramtype = "light",
+ mesecons = {effector = {
+ action_on = function(pos) npc_spawner(pos, "peaceful_npc:npc_def") end,
+ }}
+})
+minetest.register_abm({
+ nodenames = {"peaceful_npc:spawner_npc_def"},
+ interval = 20,
+ chance = 10,
+ action = function(pos)
+ npc_spawner(pos, "peaceful_npc:npc_def")
+ end,
+})
+
+--Item Code for fast npcs
+minetest.register_node("peaceful_npc:summoner_npc_fast", {
+ description = "Fast NPC Summoner",
+ image = "peaceful_npc_npc_summoner_fast.png",
+ inventory_image = "peaceful_npc_npc_summoner_fast.png",
+ wield_image = "peaceful_npc_npc_summoner_fast.png",
+ paramtype = "light",
+ tiles = {"peaceful_npc_spawnegg.png"},
+ is_ground_content = true,
+ drawtype = "glasslike",
+ groups = {crumbly=3},
+ selection_box = {
+ type = "fixed",
+ fixed = {0,0,0,0,0,0}
+ },
+ sounds = default.node_sound_dirt_defaults(),
+ on_place = function(itemstack, placer, pointed)
+ local name = placer:get_player_name()
+ if (minetest.check_player_privs(name, {peacefulnpc=true})) then
+ pos = pointed.above
+ pos.y = pos.y + 1
+ minetest.add_entity(pointed.above,"peaceful_npc:npc_fast")
+ itemstack:take_item(1)
+ else
+ minetest.chat_send_player(name, "Nope! You need to have the peacefulnpc priv!")
+ end
+ return itemstack
+end
+})
+
+minetest.register_node("peaceful_npc:spawner_npc_fast", {
+ description = "Fast 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_fast.png"},
+ sunlight_propagates = true,
+ paramtype = "light",
+ mesecons = {effector = {
+ action_on = function(pos) npc_spawner(pos, "peaceful_npc:npc_fast") end,
+ }}
+})
+minetest.register_abm({
+ nodenames = {"peaceful_npc:spawner_npc_fast"},
+ interval = 30,
+ chance = 10,
+ action = function(pos)
+ npc_spawner(pos, "peaceful_npc:npc_fast")
+ end,
+})
+
+--Item Code for dwarf npcs
+minetest.register_node("peaceful_npc:summoner_npc_dwarf", {
+ description = "Dwarf NPC Summoner",
+ image = "peaceful_npc_npc_summoner_dwarf.png",
+ inventory_image = "peaceful_npc_npc_summoner_dwarf.png",
+ wield_image = "peaceful_npc_npc_summoner_dwarf.png",
+ paramtype = "light",
+ tiles = {"peaceful_npc_spawnegg.png"},
+ is_ground_content = true,
+ drawtype = "glasslike",
+ groups = {crumbly=3},
+ selection_box = {
+ type = "fixed",
+ fixed = {0,0,0,0,0,0}
+ },
+ sounds = default.node_sound_dirt_defaults(),
+ on_place = function(itemstack, placer, pointed)
+ local name = placer:get_player_name()
+ if (minetest.check_player_privs(name, {peacefulnpc=true})) then
+ pos = pointed.above
+ pos.y = pos.y + 1
+ minetest.add_entity(pointed.above,"peaceful_npc:npc_dwarf")
+ itemstack:take_item(1)
+ else
+ minetest.chat_send_player(name, "Nope! You need to have the peacefulnpc priv!")
+ end
+ return itemstack
+end
+})
+
+minetest.register_node("peaceful_npc:spawner_npc_dwarf", {
+ description = "Dwarf 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_dwarf.png"},
+ sunlight_propagates = true,
+ paramtype = "light",
+ mesecons = {effector = {
+ action_on = function(pos) npc_spawner(pos, "peaceful_npc:npc_dwarf") end,
+ }}
+})
+minetest.register_abm({
+ nodenames = {"peaceful_npc:spawner_npc_dwarf"},
+ interval = 60,
+ chance = 10,
+ action = function(pos)
+ npc_spawner(pos, "peaceful_npc:npc_dwarf")
+ end,
+})
+
+if instakill_sword == true then
+ --Adds instakill sword
+ minetest.register_tool("peaceful_npc:sword_instakill", {
+ description = "Instakill Sword",
+ inventory_image = "default_tool_steelsword.png",
+ tool_capabilities = {
+ full_punch_interval = 0.1,
+ max_drop_level = 1,
+ groupcaps={
+ fleshy={times={[1]=0.005, [2]=0.005, [3]=0.005}, uses=0, maxlevel=3},
+ snappy={times={[2]=0.005, [3]=0.005}, uses=0, maxlevel=2},
+ choppy={times={[3]=0.005}, uses=0, maxlevel=1}
+ },
+ }
+ })
+end
+
+print("Peaceful NPC items.lua loaded! By jojoa1997!")