[Mod] Mobs Redo [1.50] [mobs]

oddguy117
Member
 
Posts: 23
Joined: Thu Nov 07, 2019 19:08

Re: [Mod] Mobs Redo [1.50] [mobs]

by oddguy117 » Sat Dec 14, 2019 13:10

Thanks for your help.
By the way, I've got some performance problems, @TenPlus1 can you please help me (I just need help by SB who has some experience with it.)?
Forum post is here: https://forum.minetest.net/viewtopic.php?f=47&t=23781

Also, can you tell me where in the API documentation it's written how to make mobs spawn under specific conditions in a place, that got generated by a mod.
See here: https://forum.minetest.net/viewtopic.php?f=47&t=23709

Thanks in advance
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Sun Dec 15, 2019 08:01

@oddguy117 - mob spawning is usually abm intensive but by using the mobs:spawn function and spawning with a neighbor you can lower this:

https://notabug.org/TenPlus1/mobs_redo/ ... i.txt#L356

e.g. I tend to spawn cows on dirt_with_grass that has a neighbor of group:grass, so less nodes to check and spawn on, you can also increase timer and chance or use on_spawn function within the mob definition or mobs:spawn itself to be very specific.
 

User avatar
Nathan.S
Member
 
Posts: 954
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Thu Jan 02, 2020 22:03

Maybe I'm remembering something that never existed, but didn't weapons used to take damage when attacking mobs? Looking through the API I see there is a check for the toolranks mod and it looks like it weapons are meant to take damage. I tested with both Minetest 5.1.0 and the latest dev, both with and without the toolranks mod and I never got any damage on the tools.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

User avatar
FreeGamers
Member
 
Posts: 416
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Thu Jan 02, 2020 22:10

It might have a check on if its in creative mode Nathan?
 

User avatar
Nathan.S
Member
 
Posts: 954
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Thu Jan 02, 2020 22:28

I believe there is such a check, and I checked to make sure that I have creative mode turned off, and that I also didn't have the creative priv. I actually tried both ways, but got no difference. Interestingly if the tool has no wear it sometimes will show the wear bar for a fraction of a second before going back to being in perfect condition. If the tool has wear, say from digging grass or leaves it stays at the same damage level.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

User avatar
FreeGamers
Member
 
Posts: 416
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Tue Jan 07, 2020 09:55

I was able to recreate the issue Nathan is reporting. I never really noticed until I saw his report.
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Wed Jan 08, 2020 07:45

On Xanadu weapons still take damage since it's using Minetest 5.0.1, for some reason 5.1+ stops the weapons from being damaged even though it's using the same and correct code ?!?

https://notabug.org/TenPlus1/mobs_redo/issues/27
 

User avatar
FreeGamers
Member
 
Posts: 416
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Wed Jan 08, 2020 19:33

Hey TenPlus1,

What are the major difference between the spawning api functions?

mobs:spawn_specific seems to be the most versatile but I understand it costs more processing? I've been using this for my mobs mod and its has a lot of mobs, I've been trying to optimize things more. I've been using spawn_specific for almost everything.

mobs_spawn is less cpu intensive but more limited in its specificity?

How much of a difference does this make this in processing usage?
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Thu Jan 09, 2020 07:35

The mobs:spawn() is the best one to use as it is easier to read and has all features and functionality of spawn_specific and many defaults set already to save you adding lines.

e.g.

Code: Select all
mobs:spawn({
   name = mob name, (required, e.g. "mymod:mymob")
   nodes = list of nodes to spawn on (defaults to {"group:soil", "group:stone"})
   neighbors = list of neighbor nodes to spawn beside (defaults to {"group:air"}
   interval = default abm interval (defaults to 30)
   chance =  default abm chance (defaults to 5000)
   min_light = minimum light level (defaults to 0)
   max_light = maximum light level (defaults to 15)
   active_object_count = amount of same mobs in active block (defaults to 1)
   min_height = minimum height level (defaults to -31000)
   max_height = maximum light level (defaults to 31000)
   day_toggle = true to spawn in day, false for night, nil for both (default)
   on_spawn = custom function to run after mob spawned (self, pos)
end)
 

User avatar
FreeGamers
Member
 
Posts: 416
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Thu Jan 09, 2020 09:06

OK. No performance difference between them?

I have to further optimize my spawning functions again so I'll be going through them all eventually and I'll likely convert them to mobs:spawn
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Update:

by TenPlus1 » Thu Jan 09, 2020 09:39

- glow setting added so that mobs can glow in the dark.
- api.txt has been updated with new spawning information and glow setting.
- bug fixed when using on_replace function, oldname and newname return actual string names, even when groups used.
Last edited by TenPlus1 on Sun Jan 12, 2020 09:46, edited 1 time in total.
 

User avatar
Nathan.S
Member
 
Posts: 954
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Sat Jan 11, 2020 22:36

I'm probably just missing something obvious, but when using on_replace what is oldnode? or rather how to I get the nodename from it. I want to check if a mob is eating a specific node, and if they are have a certain action take place. As far as I can tell oldnode is a table? of what I'm not sure, nor can I figure out how to compare that table to a nodename. I tried doing oldnode.name but that didn't work. I can't seem to find any examples of the code in any of the mods I have locally on my machine.

Thanks.

edit:
Looking at the code it looks like there may be an error in the api. If I change replace_what from a table to a single string I can call oldnode.name and get the node name, but as soon as I do a table it breaks.

edit2:
Okay so I was just going about it the wrong way. doing this works.
Code: Select all
replace_what = {
      {'group:flora', 'air', 0},
      {'group:grain', 'air', 0},
      {'group:veggie', 'air', 0}
   },
   on_replace = function(self, pos, oldnode, newnode)
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Sun Jan 12, 2020 09:45

Hi Nathan, I've updated the mob api so that on_replace will now give proper node names for oldnode and newnode, even when groups are use :)
Last edited by TenPlus1 on Mon Jan 13, 2020 08:06, edited 1 time in total.
 

User avatar
Nathan.S
Member
 
Posts: 954
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Sun Jan 12, 2020 17:24

Ah nice. I'll be using that feature in several mobs, that I'm working on.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

User avatar
FreeGamers
Member
 
Posts: 416
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Mon Jan 13, 2020 09:20

I noticed particle spawners, like the one I have on this flying skeleton head, no longer work in version 5.2.0-dev.

Code: Select all
   do_custom = function(self)
      local apos = self.object:getpos()
                part = minetest.add_particlespawner({
                        8, --amount
                        0.3, --time
                        {x=apos.x-0.3, y=apos.y+0.6, z=apos.z-0.3}, --minpos
                        {x=apos.x+0.3, y=apos.y+0.6, z=apos.z+0.3}, --maxpos
                        {x=-0, y=-0, z=-0}, --minvel
                        {x=0, y=0, z=0}, --maxvel
                        {x=0,y=1.5,z=0}, --minacc
                        {x=0.5,y=1.5,z=0.5}, --maxacc
                        1, --minexptime
                        1, --maxexptime
                       2, --minsize
                        3, --maxsize
                        false, --collisiondetection
                        "mobs_creatures_arrow_fireball_trail.png" --texture
                })
   end,
 

User avatar
TenPlus1
Member
 
Posts: 2645
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Tue Jan 14, 2020 10:42

check the code for sandmonster. lua in the mobs_monster mod, it uses particles and works ok.
 

Previous

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 13 guests