Page 1 of 1

[Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Sat Nov 08, 2014 03:24
by HeroOfTheWinds
Mob Spawner v.0.9.5

So, after much procrastination and lack of time (college, mostly), I finally got around to making a mod for creating monster spawners!

This simple mod operates on some fairly basic parameters:
  • Mobs spawn only when the light around the spawner is below a certain threshold. (default is 9)
  • Mobs will not spawn if there are too many in the area. (Default cap is 7, although stronger pcs can easily stand 12 or more in singleplayer. Amount will vary for your server and/or system)

Currently, PilzAdam's Simple Mobs, TenPlus1's Mobs_Redo, Zeg9's zmobs, Calinou's Carbone Mobs, DevynCJohnson's Senderman, BlockMen's Creatures, krupnovpavel's KPGMobs, CProgrammerRU's SimpleMobs++, MinetestForFun's spidermob, RHR's Cute Cubic Mobs, davedevils' Minecraft Monsters, and sapier's Mobf & Animals Modpack are supported, although adding support for more mods is incredibly easy. If you have a mob mod you want supported, tell me! I'll probably add more myself according to my free time.

There are a number of configurable settings at the top of the init.lua, namely MAX_LIGHT, MAX_MOBS, CHANCE, and INTERVAL. The first one is the maximum light in which mobs will spawn. Likewise, MAX_MOBS is the cap on how many mobs will spawn. (Note that players are counted as objects when in range, so if it's set to 7, you'll only ever see 6.) CHANCE is the probability (1/x chance) of a mob spawning per interval. Which brings us to INTERVAL, which determines how many seconds there are between spawnings.

Near the start of the file is a list of tables with mob names in them. If you want to create additional spawners for unlisted mobs (like cows and chickens), create another list.insert() line with the appropriate information. If you are unsure what to add, ask here or look at the original mod's code.

As there currently are no craft recipes for spawners, the only way to get them is through the give privilege, using the form:
/giveme mobspawn:name_spawner
where name is the name of the mob, such as dirt_monster.

Enjoy!

Screenshots:
+ Spoiler


Now for bidness:

Depends:
default
mobs?
carbone_mobs?
mobf?
creatures?
zmobs?
senderman?
kpgmobs?
ccmobs?
spidermob?

License: WTFPL (code and textures)
GitHub: https://github.com/HeroOfTheWinds/mobspawn/
Download: https://github.com/HeroOfTheWinds/mobsp ... master.zip

TO-DO:
Fix spawner texture
Add entity inside spawner showing what it spawns
Add support for more mobs
Make recipes for spawners
...Perhaps you have suggestions? :)

Re: [mod] Mob Spawners [beta] [0.8] [mobspawn]

PostPosted: Sat Nov 08, 2014 04:30
by Inocudom

Re: [mod] Mob Spawners [beta] [0.8] [mobspawn]

PostPosted: Sun Nov 09, 2014 02:43
by HeroOfTheWinds
Ah, yes, I definitely have those at the top of my list for adding support. I also intend to support senderman...

A small note I forgot to mention in the OP: Currently, mob spawners are uncraftable. This is partially due to lack of good method for crafting (I want to have spawn eggs...), but also to prevent regular (non-admin) players from "griefing" the world with countless mob spawners to bring about the apocalypse. If and when I get good recipes implemented and more mobs supported, I will make a toggle in the lua file for allowing crafting...

On a side note, I'd love to see these implemented in a mod like catacomb or one of the mineshaft mods. Just a thought.

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Sun Nov 09, 2014 23:28
by HeroOfTheWinds
BIG update!

I have added support for a large number of mobs, including:
Zeg9's zmobs, Calinou's Carbone Mobs, DevynCJohnson's Senderman, BlockMen's Creatures, and sapier's Mobf & Animals Modpack.

Additionally, the internal way mobs are handled has changed a bit, to allow for running of multiple mobs mods alongside each other. However, overlaps have not been addressed yet, so in cases of conflicts between, say, oerkkis, only one oerkki spawner will be registered.

Let me know if you have any ideas or find any bugs! (It is still in alpha testing, isn't it? xD)

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Tue Nov 11, 2014 09:50
by twoelk
Have added this mod to the wiki page about mobs hope that one day you will support at least all the mobs listed there. ;-D

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Tue Nov 11, 2014 18:27
by HeroOfTheWinds
twoelk wrote:Have added this mod to the wiki page about mobs hope that one day you will support at least all the mobs listed there. ;-D


:O I forgot how many mobs mods there were, let alone how many other mods incorporated them...! I'll do my best.

Also, when I get around to updating that, I'll be making another small change: I'll list ALL mobs in a given mod in the code, just commenting out the peaceful ones. That should make things easier for the user.

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Tue Nov 11, 2014 18:43
by twoelk
HeroOfTheWinds wrote:... I'll list ALL mobs in a given mod in the code, just commenting out the peaceful ones. That should make things easier for the user.


hehe - I guess a lot of people are dreaming of that killer app that might be called The-Universal-United-Mobs-Mods-Manager containing controls for every configuration possible.

btw, I am pretty sure there are more mob-mods out there that I havn't found yet. I guess I will have to add a new section of games containing mobs anyway to cover stuff like all the mobs from Lord-Of-The-Test, Carbone or AdventureTest.

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Tue Nov 11, 2014 18:53
by HeroOfTheWinds
Haha, yeah, that's a dream I'd love to achieve someday with this...

Indeed, subgames throw a big monkey-wrench in there. I think what I will have to do is either find a way of determining what subgame is being played, or else check for mods installed ONLY in that subgame.
I will posit that, as far as I know, minetest.override_item() does not work on entity registrations. So even if I started getting really technical with the configuration options, you still couldn't edit a mob's stats...

Re: [mod] Mob Spawners [alpha] [0.9.4] [mobspawn]

PostPosted: Wed Nov 12, 2014 23:59
by HeroOfTheWinds
Alright, new update!

KPGMobs, SimpleMobs++, spidermob, and CCMobs have joined the ranks of supported mobs. Consequently, that means I almost have all the Simple Mobs based mods implemented! Just a couple more to go (including my nearly abandoned MobsPlus & areas)...

However, I now realize I need to do a new piece of refactoring: I need to split up the mobs into day spawning and night spawning, since I started supporting peaceful mobs. So expect that soon...

Re: [mod] Mob Spawners [alpha] [0.9.4] [mobspawn]

PostPosted: Thu Nov 13, 2014 00:06
by Sokomine
HeroOfTheWinds wrote:KPGMobs, SimpleMobs++, spidermob, and CCMobs have joined the ranks of supported mobs. Consequently, that means I almost have all the Simple Mobs based mods implemented! Just a couple more to go (including my nearly abandoned MobsPlus & areas)...

That's good! By now, there are so many diffrent mob mods out there that it's difficult to keep an overview. Would it be possible for you to add/edit a mobs mod category in the Wiki? With a short(!) paragrap (1-2 sentences) describing them each? It seems that you got at least some basic overview over them.

HeroOfTheWinds wrote:However, I now realize I need to do a new piece of refactoring: I need to split up the mobs into day spawning and night spawning, since I started supporting peaceful mobs. So expect that soon...

There's a reason for why mobf is so large :-)

Re: [mod] Mob Spawners [alpha] [0.9] [mobspawn]

PostPosted: Thu Nov 13, 2014 00:24
by HeroOfTheWinds
@Sokomine:
twoelk wrote:Have added this mod to the wiki page about mobs hope that one day you will support at least all the mobs listed there. ;-D


So, while there already is a wiki page describing each mob mod, it still doesn't detail subgames. So Lord Of The Test, AdventureTest, BFG, etc. also need to be taken into account. However, I'm working on the wiki stuff first. Still, I don't think I'll add the NPC mods... It just wouldn't feel right having a block spawning people, would it? :P

I'm still debating how I should handle the lighting issue... should I have it on a per-mob basis, or split it into cold hard groups of "day", "night", and "always"...?

Re: [mod] Mob Spawners [alpha] [0.9.4] [mobspawn]

PostPosted: Mon Nov 24, 2014 13:41
by benedict56
Can you support the minecraft mobs mod from davedevil?
It would be great

Re: [mod] Mob Spawners [alpha] [0.9.4] [mobspawn]

PostPosted: Mon Dec 08, 2014 05:42
by HeroOfTheWinds
Sure thing! I'll try getting to it soon, I'm almost on break from college, so I should have time to resurface for 2~3 weeks again.

Re: [Mod] Mob Spawners [0.9.4] [mobspawn]

PostPosted: Mon Dec 22, 2014 21:34
by HeroOfTheWinds
Alright, as promised, I added support for the "Minecraft Monsters" mod! I didn't test to make sure the code is error free, but expansion of this mod is so simple. I just wish people would stop using the the modname "mobs".... the naming conflicts are so ridiculous...

Re: [Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Sun Jul 26, 2015 02:52
by SAMIAMNOT
I have a few questions & suggestions.
1) Is this a block that you place
2) Are there seperate spawners for each mob?
3) Can you please let the spawners spawn user-specified itemstrings?

Re: [Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Mon Aug 03, 2015 00:59
by HeroOfTheWinds
SAMIAMNOT wrote:I have a few questions & suggestions.
1) Is this a block that you place
2) Are there seperate spawners for each mob?
3) Can you please let the spawners spawn user-specified itemstrings?


1) Yes.

2) Yup.

3) I've been a bit too busy as of late to do much Minetest coding, but that would be an interesting mod to make. However, it would not fit in this particular mod, and would be better as a stand-alone idea. It probably wouldn't be too hard to implement though... Just figure out the syntax/code for creating dropped-item entities (it's out there, perhaps look at code such as that in the drop-on-die mod). Some of the logic would change as well, since my code creates separate nodes for each mob, while your idea requires only a node with a formspec. (Gonna level with you here, I hate formspecs.) Hope this helps!

Re: [Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Mon Aug 03, 2015 01:49
by SAMIAMNOT
Thanks. Will do. Although I tried editing the moremesecon Dispenser mod to drop nodes or spawn entities and it did nothing but crash. Hopefully II'll e successful this time.

Re: [Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Thu Oct 27, 2016 13:32
by JoshMars
I kept getting this error :
2016-10-27 09:08:08: ERROR[Main]: ServerError: Lua: Runtime error from mod 'mobspawn' in callback LuaABM::trigger(): /home/minetest/.minetest/mods/mobspawn/init.lua:277: attempt to compare nil with number
2016-10-27 09:08:08: ERROR[Main]: stack traceback:
2016-10-27 09:08:08: ERROR[Main]: /home/minetest/.minetest/mods/mobspawn/init.lua:277: in function </home/minetest/.minetest/mods/mobspawn/init.lua:271>

Re: [Mod] Mob Spawners [0.9.5] [mobspawn]

PostPosted: Thu Oct 27, 2016 13:35
by JoshMars
I tried adding
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if not npos then return false end
to the register_abm function, but that didn't work so I added
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if not MAX_LIGHT then return false end
and that didn't work so I added
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.chat_send_all(minetest.get_node_light(npos))
in order to debug and my server stopped crashing.