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 0000000..2c07670 Binary files /dev/null and b/textures/mobspawn_cage_bottom.png differ diff --git a/textures/mobspawn_cage_side.png b/textures/mobspawn_cage_side.png new file mode 100644 index 0000000..cceb71a Binary files /dev/null and b/textures/mobspawn_cage_side.png differ diff --git a/textures/mobspawn_cage_top.png b/textures/mobspawn_cage_top.png new file mode 100644 index 0000000..88b722a Binary files /dev/null and b/textures/mobspawn_cage_top.png differ