From c80a417e730b8be70defc6c1a90d8143d00e6b10 Mon Sep 17 00:00:00 2001 From: Chris N Date: Fri, 7 Nov 2014 16:47:01 -1000 Subject: [PATCH] Initial Commit And thus begins the long road of upkeep... --- .gitattributes | 22 -------- .gitignore | 43 --------------- depends.txt | 2 + init.lua | 86 ++++++++++++++++++++++++++++++ license.txt | 19 +++++++ textures/mobspawn_cage_bottom.png | Bin 0 -> 301 bytes textures/mobspawn_cage_side.png | Bin 0 -> 233 bytes textures/mobspawn_cage_top.png | Bin 0 -> 251 bytes 8 files changed, 107 insertions(+), 65 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .gitignore create mode 100644 depends.txt create mode 100644 init.lua create mode 100644 license.txt create mode 100644 textures/mobspawn_cage_bottom.png create mode 100644 textures/mobspawn_cage_side.png create mode 100644 textures/mobspawn_cage_top.png diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 412eeda..0000000 --- a/.gitattributes +++ /dev/null @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 58bcbf8..0000000 --- a/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..7c506cf --- /dev/null +++ b/depends.txt @@ -0,0 +1,2 @@ +default +mobs? \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b0a9b56 --- /dev/null +++ b/init.lua @@ -0,0 +1,86 @@ +-- mobspawn v.0.8 by HeroOfTheWinds +-- WTFPL 2.0 +-- Mod to add mob spawners to Minetest for Simple Mobs and Mobs_Redo (by PilzAdam and TenPlus1 respectively) +-- There are plans to add support for more mods... + +local redo = false --Switch to determine if the mobs mod is TenPlus1's mobs_redo... DETERMINED AUTOMATICALLY +local SPAWN_INTERVAL = 30 --Rate at which mobs are spawned (in seconds) +local CHANCE = 1 --Chance of mob spawning at each interval. 1=always +local MAX_MOBS = 7 --Max number of mobs that can be in the vicinity of a spawner for a mob to spawn. If lag is a concern, keep to a low value. (A strong singleplayer PC can handle 10-20 though...) + +--If the mod is "mobs", whose version is it? +if (minetest.get_modpath("mobs")) then + if mobs.mod == "redo" then + redo = true + end +end + +mobspawn = {} --Container for whatever + +mobspawn.mobs = {} --List to hold all registered mobs that are to be affected by this mod +mobspawn.mod = "" --What is the base mod? + +if redo then + --List all the hostile mobs in Mobs Redo + mobspawn.mod = "mobs" + mobspawn.mobs = { + "dirt_monster", + "sand_monster", + "tree_monster", + "stone_monster", + "oerkki", + "dungeon_master", + "spider", + "lava_flan", + "mese_monster", + } +else + --List all the hostile mobs in Simple Mobs + mobspawn.mod = "mobs" + mobspawn.mobs = { + "dirt_monster", + "sand_monster", + "tree_monster", + "stone_monster", + "oerkki", + "dungeon_master", + } +end + +--Create a spawner for each mob +for _,mob in pairs(mobspawn.mobs) do + minetest.register_node("mobspawn:"..mob.."_spawner", { + description = mob.." Spawner", + drawtype = "allfaces", + tiles = {"mobspawn_cage_top.png", "mobspawn_cage_bottom.png", "mobspawn_cage_side.png"}, + is_ground_content = false, + groups = {cracky=1}, + light_source = 3, + paramtype = "light", + use_texture_alpha = true, + sunlight_propagates = true, + }) + + --The heart of the mod, the spawning function + minetest.register_abm({ + nodenames = {"mobspawn:"..mob.."_spawner"}, + interval = SPAWN_INTERVAL, + chance = CHANCE, + action = function(pos, node, active_object_count, active_object_count_wider) + --Randomize spawn location + local npos = {x=pos.x + math.random(-3,3), y=pos.y, z=pos.z + math.random(-3,3)} + --Make sure it's a sufficiently dark room + if (minetest.get_node_light(npos) < 9) then + local count = 0 + --check how many mobs are nearby + for _,ent in pairs(minetest.get_objects_inside_radius(pos, 6)) do + count = count + 1 + end + if count < MAX_MOBS then + --Prepare for trouble (sorry, it won't be double... yet) + minetest.add_entity(npos, mobspawn.mod..":"..mob) + end + end + end, + }) +end \ No newline at end of file diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..d960f46 --- /dev/null +++ b/license.txt @@ -0,0 +1,19 @@ +Sourcecode: WTFPL (see below) +Graphics: WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/textures/mobspawn_cage_bottom.png b/textures/mobspawn_cage_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..2c0767089ff34a2dc2a612cd11715b988ef08b97 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPqHwTlXxbJ1N4L~8;%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dC_d5C#WBR<^xcUEc@HZHupAGYH^o7}j4`|+dx18W2d~=R z04Dz>r;i6YJpAK$O8K|smhQ0SyH&e1jJuRpb=mbNpV+O_^4WN*0W=KSdbAE1aYF-JD%fR4Vl$uzQ znxasiS(2gP?&%wlqL<1J6!-OXaSX9IoqXl;<=^KWI2$A%ynEL-^_cqd<;%a%?`(8( z*vQyZRaN!Bx3^c)uI|r?1Lx28I~p4pJeXo#{Y~d-qQM6}3Em@{536YgCowRndM~cL SIf-2cWTU66pUXO@geCwXs!PxS literal 0 HcmV?d00001 diff --git a/textures/mobspawn_cage_top.png b/textures/mobspawn_cage_top.png new file mode 100644 index 0000000000000000000000000000000000000000..88b722a8d46912a69fb68b8d49d31a42f246f9d2 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPqHwTlj{LbfL96%x2%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dC?4=QeNPX?Y8BgQu&X%Q~loCIF2yQpx}T literal 0 HcmV?d00001