summaryrefslogtreecommitdiff
path: root/peaceful_npc/commands.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/commands.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/commands.lua')
-rw-r--r--peaceful_npc/commands.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/peaceful_npc/commands.lua b/peaceful_npc/commands.lua
new file mode 100644
index 0000000..ca3b7d3
--- /dev/null
+++ b/peaceful_npc/commands.lua
@@ -0,0 +1,39 @@
+--Spawn Command Function
+function npc_command( command_name, npc_command_type, command_desc)
+ local function spawn_for_command(name, param)
+ local npcs_to_spawn = tonumber(param) or 1
+ local player = minetest.get_player_by_name(name)
+ local pos = player:getpos()
+ local max_spawn = 20
+ local max_surround_npc = 30
+ local active_npc_count = table.getn(minetest.get_objects_inside_radius(pos, 50))
+ if active_npc_count == nil then
+ active_npc_count = 0
+ end
+ if npcs_to_spawn + active_npc_count > max_surround_npc then
+ minetest.chat_send_player(name, "There are too many NPCs around you.")
+ elseif npcs_to_spawn >= max_spawn + 1 then
+ minetest.chat_send_player(name, "The spawn limit is"..max_spawn)
+ else
+ for n = 1, npcs_to_spawn do
+ offsetx = math.random(-5,5)
+ offsety = math.random(2,4)
+ offsetz = math.random(-5,5)
+ minetest.add_entity({ x=pos.x+offsetx, y=pos.y+offsety, z=pos.z+offsetz }, ("peaceful_npc:npc_"..npc_command_type))
+ end
+ end
+ end
+
+ --Spawn command
+ minetest.register_chatcommand(command_name, {
+ description = command_desc,
+ privs = {peacefulnpc=true},
+ func = spawn_for_command
+ })
+end
+
+npc_command( "summonnpc_fast", "fast", "Summons Fast NPCs")
+npc_command( "summonnpc_def", "def", "Summon Default NPCs")
+npc_command( "summonnpc_dwarf", "dwarf", "Summon Dwarf NPCs")
+
+print("Peaceful NPC commands.lua loaded! By jojoa1997!") \ No newline at end of file