Mobkit - Entity API [mobkit][alpha]

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

runs wrote:I've check the lua manual and it has sense: http://www.lua.org/manual/5.2/manual.html#3.5

If yaw is global and has a nil value, doing "yaw = yaw + pi" produces nil + pi. So it should be better make "local yaw = ...get_yaw() + pi" than "local yaw = ...get_yaw(); yaw = yaw + pi"
No, the global one shouldn't have anything to with it, local yaw has been defined in that scope already so that is used, and the report says it was local anyway.

One reason i can think of is you're probably calling remove() somewhere before within the same engine step.
Engine behavior might have changed in that regard, i think it used to be so they get removed only after exiting lua.

Try cleaning the queues before you call remove()

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

Termos wrote:
runs wrote:I've check the lua manual and it has sense: http://www.lua.org/manual/5.2/manual.html#3.5

If yaw is global and has a nil value, doing "yaw = yaw + pi" produces nil + pi. So it should be better make "local yaw = ...get_yaw() + pi" than "local yaw = ...get_yaw(); yaw = yaw + pi"
No, the global one shouldn't have anything to with it, local yaw has been defined in that scope already so that is used, and the report says it was local anyway.

One reason i can think of is you're probably calling remove() somewhere before within the same engine step.
Engine behavior might have changed in that regard, i think it used to be so they get removed only after exiting lua.

Try cleaning the queues before you call remove()
This could be, cos bees die if the beehive "die" or go to their behive at night (remove). I will check...
Day 42 of the quarantine

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

That was the issue, previous a remove function it should be the behaviours cleaned.

I added a mokapi.remove_mob to do the trick.
Day 42 of the quarantine

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

.
Update 200406

mobkit
  • get_nodes_in_area(): fixed possible crash when in the world there are leftover undefined nodes.
wildlife
  • animals are now animated

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

Can you help me:

I get this code:
AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback node_on_dig(): Runtime error from mod 'petz' in callback node_on_destruct(): /home/codesound/.minetest/mods/mobkit/init.lua:640: attempt to index field 'memory' (a nil value)
stack traceback:
It occurs when (in an external function out of the brain) I spawn a mob, inmediately force to die (mobkit.hq_die) (second line), and I try to set a mobkit.remember (third line). 'Is_alive' function does not help because the mob is still "alive". I think the status between the mob dies and then dissapears (limbo?) is problematic.
Last edited by runs on Thu Apr 09, 2020 14:57, edited 1 time in total.
Day 42 of the quarantine

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

You probably shouldn't do stuff with entities in the same place where you spawn them, because technically they don't exist yet and their on_activate hasn't run yet.

I'd try doing it in on_activate instead, remember to call mobkit.actfunc first.

User avatar
Extex
Member
Posts: 190
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: Mobkit - Entity API [mobkit][alpha]

by Extex » Post

@Termos: I have made a discord server for mobkit!
https://discord.gg/NNN7BNk
Could you please join it?
I can give you all privs and stuff
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Extex
Member
Posts: 190
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: Mobkit - Entity API [mobkit][alpha]

by Extex » Post

--Deleted message--
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

I want to implement a herd behavoiur, but I have some doubts.

Code: Select all

function mobkit.get_nearby_entity(self,name)
	-- returns random nearby entity of name or nil
function mobkit.get_closest_entity(self,name)
	-- returns closest entity of name or nil
What's the difference? Random what means (refered this function, I mean the word)?
Day 42 of the quarantine

User avatar
Wuzzy
Member
Posts: 4082
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: Mobkit - Entity API [mobkit][alpha]

by Wuzzy » Post

Is there a list of mods that depend on this mod, and why is it not in the first post? :P
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Gundul
Member
Posts: 1064
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Post

Wuzzy wrote:Is there a list of mods that depend on this mod, and why is it not in the first post? :P
How should he know who is using his mobkit :D

A few I know of are:
  • wildlife
    petz
    water_life
    aerotest
    sailing_kit
maybe there are more
My servers: Jungle, Lilly in the valley

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

Extex wrote:@Termos: I have made a discord server for mobkit!
https://discord.gg/NNN7BNk
Could you please join it?
Thanks.
To be honest I don't know what a discord is. I'll try to find the time to learn.
runs wrote:I want to implement a herd behavoiur, but I have some doubts.
'nearby' gets you a random alive and active entity within range (48n iirc), 'closest' is what I'd probably use to implement herd behavior.
Wuzzy wrote:Is there a list of mods that depend on this mod, and why is it not in the first post? :P
That's beyond my control, but listing some of them I know of in the first post is probably a good idea, thanks.

Eran
Member
Posts: 123
Joined: Fri May 03, 2019 16:46

Re: Mobkit - Entity API [mobkit][alpha]

by Eran » Post

Wuzzy wrote:Is there a list of mods that depend on this mod, and why is it not in the first post? :P
I've got two:
One for talking parrots.
and a goat mod.

Noodlemire's Voxel Dungeon game also has mobs using mobkit.

User avatar
twoelk
Member
Posts: 1398
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: Mobkit - Entity API [mobkit][alpha]

by twoelk » Post

added a mobkit section to https://wiki.minetest.net/Mods:Mobs

Gundul
Member
Posts: 1064
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Post

twoelk wrote:
Thu Apr 30, 2020 18:35
added a mobkit section to https://wiki.minetest.net/Mods:Mobs
Yay! That's great. Thumbs up for my favorite mob api :)
My servers: Jungle, Lilly in the valley

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

twoelk wrote:
Thu Apr 30, 2020 18:35
added a mobkit section to https://wiki.minetest.net/Mods:Mobs
Cool stuff, thanks!

Just a little update, my PR got merged into 5.3 dev, if it doesn't get reverted and makes it into the next stable then we get back to work on this one.

User avatar
acidzebra
Member
Posts: 75
Joined: Sun Sep 10, 2017 09:11

Re: Mobkit - Entity API [mobkit][alpha]

by acidzebra » Post

Mobkit is pretty fun to play around with, the queue functions are interesting.

Is there any way to restrict spawns to certain slices like min_height and max_height? I poked around the API doc but couldn't find anything offhand.

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

acidzebra wrote:
Wed May 06, 2020 18:39
Mobkit is pretty fun to play around with, the queue functions are interesting.

Is there any way to restrict spawns to certain slices like min_height and max_height? I poked around the API doc but couldn't find anything offhand.
Yes, see my api_spawn.lua in Petz. Not in mobkit itself but out.
Day 42 of the quarantine

User avatar
acidzebra
Member
Posts: 75
Joined: Sun Sep 10, 2017 09:11

Re: Mobkit - Entity API [mobkit][alpha]

by acidzebra » Post

runs wrote:
Wed May 06, 2020 19:15
acidzebra wrote:
Wed May 06, 2020 18:39
Mobkit is pretty fun to play around with, the queue functions are interesting.

Is there any way to restrict spawns to certain slices like min_height and max_height? I poked around the API doc but couldn't find anything offhand.
Yes, see my api_spawn.lua in Petz. Not in mobkit itself but out.
Ah, I see it, thanks runs. This also explains why people saw a camel deep underground (I have some mods that mess with nodes and caves) and I think you only restricted fishies.

I guess every mod/modpack can define this stuff for themselves but I think this should be a core feature of a mob framework - be able to restrict highland/lowland/flying/water mobs with a single instruction rather than implementing checks for each.

User avatar
runs
Member
Posts: 1892
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Post

acidzebra wrote:
Wed May 06, 2020 22:17
runs wrote:
Wed May 06, 2020 19:15
acidzebra wrote:
Wed May 06, 2020 18:39
Mobkit is pretty fun to play around with, the queue functions are interesting.

Is there any way to restrict spawns to certain slices like min_height and max_height? I poked around the API doc but couldn't find anything offhand.
Yes, see my api_spawn.lua in Petz. Not in mobkit itself but out.
I guess every mod/modpack can define this stuff for themselves but I think this should be a core feature of a mob framework - be able to restrict highland/lowland/flying/water mobs with a single instruction rather than implementing checks for each.
Simply do a "spawn.y" check:

Code: Select all

if spawn.y < 0 then
  return --discard spawn
end
Ah, I see it, thanks runs. This also explains why people saw a camel deep underground (I have some mods that mess with nodes and caves) and I think you only restricted fishies.
My bats should spawn only into caves too.

mobkit already does search for caves (or my mod?) but the main problem is: what height has a cave or a sub-underground-world?

In fact, in Minetest you can create totally different worlds by levels. If you want to spawn in a Netherworld, Skyworld?

mobkit could integrate it but doing a few 'ifs' won't be a problem either.
Day 42 of the quarantine

Gundul
Member
Posts: 1064
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Post

Mobkit is not responsible for spawning.

Your spawning function is it. So you have to write it accordingly to your needs :)
My servers: Jungle, Lilly in the valley

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

acidzebra wrote:
Wed May 06, 2020 18:39
Is there any way to restrict spawns to certain slices like min_height and max_height? I poked around the API doc but couldn't find anything offhand.
There are multiple ways to do spawns, so specific implementation is best left to mods,
however there's an example spawn function included - mobkit.get_spawn_pos_abr().

It works on a different principle than what people seem to be used to here - at regular intervals it returns a position on the surface that's in approx active_block_range distance from the nearest player - then it's mod's responsibility to determine what to spawn there, based on whatever specific criteria apply, and they are countless - Y, X, Z, biome, heat, humidity, node, light, time of day, nearby objects plus an infinite number of other imaginable criteria.

User avatar
apercy
Member
Posts: 141
Joined: Wed Mar 25, 2020 16:31
GitHub: APercy
In-game: APercy
Location: Pinheiral - RJ - Brazil

Re: Mobkit - Entity API [mobkit][alpha]

by apercy » Post

Hello Termos

Based on your excellent Sailing kit I made the Motorboat mod. Testing it I found a problem that affects your sailing kit too, when it sinks at flowing water. After some research I found that the problem is on mobkit and can be bypassed with a edit at line 817, in the while loop of mobkit.physics method. So I put the following:

Code: Select all

while surfnode and (surfnode.drawtype == 'liquid' or surfnode.drawtype == 'flowingliquid') do
I believe you must test it on some mobs to ensure that it will not break any other mod.

Thank you for the great work.

Termos
Member
Posts: 335
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Post

apercy wrote:
Sun May 10, 2020 16:40
Testing it I found a problem that affects your sailing kit too, when it sinks at flowing water.
This is intended, allowing floating in flowing liquids causes other problems.

Luckily you can customize physics, just copy mobkit.physics into your mod, rename it e.g. yourmod.funname, and make the modifications.
Then in entity definition use physics = yourmod.funname and you're set.

User avatar
apercy
Member
Posts: 141
Joined: Wed Mar 25, 2020 16:31
GitHub: APercy
In-game: APercy
Location: Pinheiral - RJ - Brazil

Re: Mobkit - Entity API [mobkit][alpha]

by apercy » Post

Ok!!!!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests