Mobkit - Entity API [mobkit][alpha]

u18398

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

by u18398 » Post

Termos wrote:Quick update 191005

I get crashes now:

Code: Select all

2019-10-05 19:04:28: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'sharks' in callback luaentity_Step(): /home/.minetest/mods/mobkit/init.lua:180: attempt to index field 'node_box' (a nil value)
2019-10-05 19:04:28: ERROR[Main]: stack traceback:
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:180: in function 'get_node_height'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:211: in function </home/.minetest/mods/mobkit/init.lua:207>
2019-10-05 19:04:28: ERROR[Main]:       (tail call): ?
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1387: in function 'okpos'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1401: in function 'aqua_radar_dumb'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1451: in function 'func'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:682: in function 'execute_queues'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:901: in function </home/mars/.minetest/mods/mobkit/init.lua:790>

Last edited by u18398 on Sun Oct 06, 2019 12:16, edited 1 time in total.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post


u18398

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

by u18398 » Post

again ? I thought that was fixed already.

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

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

by Termos » Post

No, sorry, not yet, runs' modification is a workaround, while get_node_height needs a rework to be more 5.0 compatible.

By the way, do you guys know which mod registers that nodeboxless nodebox, what name it is, maybe why it's done that way?

u18398

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

by u18398 » Post

Termos wrote:No, sorry, not yet, runs' modification is a workaround, while get_node_height needs a rework to be more 5.0 compatible.

By the way, do you guys know which mod registers that nodeboxless nodebox, what name it is, maybe why it's done that way?
Not yet, but I had the same issue on Zombietest, after last mobkit update. There aren't too many mods on it.
Nevertheless I think checking for nil is not wrong, you never know what someone runs on his server :D

u18398

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

by u18398 » Post

---
deleted
---

sry wrong info

u18398

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

by u18398 » Post

I found it. It is the melon from farming_redo:

2019-10-07 22:39:00: ACTION[Server]: [mobkit] farming:melon_8 uses nodebox without node_box defined

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

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

by Termos » Post

Another quick fix then: mobkit version 191008
Gundul wrote:I found it. It is the melon from farming_redo:
2019-10-07 22:39:00: ACTION[Server]: [mobkit] farming:melon_8 uses nodebox without node_box defined
Thanks a ton!
The Melon of Doom shouldn't cause any problems anymore.

I looked at their code, there doesn't seem to be any purpose to that drawtype choice, probably just slipped through because the engine doesn't enforce the node_box field.
Boxless nodebox seems to be interpreted as a full node by the engine.

u18398

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

by u18398 » Post

I was wondering if it is better to define only one spawnstep function for all animals in my mod or if it would be better
to have a spawnstep for each animal separated ? Or doesn't it matter at all ?

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

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

by Termos » Post

Definitely just one for all.

get_spawn_pos_abr retuns just a position, then your function could determine what's there (nodes, biomes etc), then iterate over minerest.registered_entities and put eligible names in another table, then pick one randomly and spawn it.

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

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

by Termos » Post

.
Weeee!

Image
Attachments
weeee2.gif
weeee2.gif (810.08 KiB) Viewed 641 times

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

I want that ship!!!

u18398

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

by u18398 » Post

I get seasick X)

at least no sharks around, when I sink :)

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

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

by Termos » Post

Quick update 191015

changes:
  • * breaking: mobkit.go_forward_horizontal(self,speed) - removed redundant yaw parameter

    * mobkit.turn2yaw() now returns resulting yaw in addition to boolean

    * added mobkit.drive_to_pos(self,tpos,speed,turn_rate,dist)
    moves in yaw direction while gradually turning towards tpos, returns true in dist distance from tpos. Preserves y velocity.

    * added mobkit.dot(v1,v2) - returns dot product of two 3d vectors (should be in vector btw)

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

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

by ElCeejo » Post

I'm inclined to believe this has to do with the lack of support for large collision boxes, but I'm asking anyway. I'm working on some rather large mobs with boxes set to the max you recommended (-1, -1, -1, 1, 1, 1). The problem is; when said large mob attacks another large mob with the same size box, it can't land a hit at all, but it can hit other, smaller mobs.

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

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

by Termos » Post

ElCeejo wrote:I'm inclined to believe this has to do with the lack of support for large collision boxes
Just a bit of clarification, mobkit does support large collision boxes, see what Gundul done with whales.
It's some builtin behaviors which assume horizontal box dimensions are < 1, but large boxes are entirely possible using custom behaviors.

Also the restriction only applies to horizontal dimensions, you should be able to use 2 node high boxes no problem.
ElCeejo wrote:The problem is; when said large mob attacks another large mob with the same size box, it can't land a hit at all, but it can hit other, smaller mobs.
What's their attack range? make sure it's greater than collisionbox[1]*1.42, otherwise they won't be able to hit diagonally.

If it still fails, as a temp solution try copying the following into your mod, it will override api version:

Code: Select all

function mobkit.lq_jumpattack(self,height,target)
	local phase=1		
	local tgtbox = target:get_properties().collisionbox
	local func=function(self)
		if not mobkit.is_alive(target) then return true end
		if self.isonground then
			if phase==1 then	-- collision bug workaround
				local vel = self.object:get_velocity()
				vel.y = -mobkit.gravity*sqrt(height*2/-mobkit.gravity)
				self.object:set_velocity(vel)
				mobkit.make_sound(self,'charge')
				phase=2
			else
				return true
			end
		elseif phase==2 then
			local dir = minetest.yaw_to_dir(self.object:get_yaw())
			local vy = self.object:get_velocity().y
			dir=vector.multiply(dir,6)
			dir.y=vy
			self.object:set_velocity(dir)
			phase=3
		elseif phase==3 then	-- in air
			local tgtpos = target:get_pos()
			local pos = self.object:get_pos()
			-- calculate attack spot
			local yaw = self.object:get_yaw()
			local dir = minetest.yaw_to_dir(yaw)
			local apos = mobkit.pos_translate2d(pos,yaw,self.attack.range)

			if mobkit.is_pos_in_box(apos,tgtpos,tgtbox) then	--bite
				target:punch(self.object,1,self.attack)
					-- bounce off
				local vy = self.object:get_velocity().y
				self.object:set_velocity({x=dir.x*-3,y=vy,z=dir.z*-3})	
					-- play attack sound if defined
				mobkit.make_sound(self,'attack')
				phase=4
			end
		end
	end
	mobkit.queue_low(self,func)
end

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

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

by Termos » Post

Update 191017

changes:
  • * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior

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

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

by Termos » Post

Updated zombiestrd

Funny thing, looks like objects that players are attached to become players themselves, so sharks would try to attack boat hulls for example, quite hillarious.
Sharks now ignore players having parents, so to speak.

This update is only essential if using sharks along with boats or other aquatic objects that players can attach to.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

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

by ElCeejo » Post

So pretty much, mob sees the thing it wants to attack, it begins chasing the thing it wants to attack, in the process of chasing the thing it wants to attack it falls in water, and the game crashes, giving me this error.

Code: Select all

2019-10-24 02:19:15: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'paleotest' in callback luaentity_Step(): Invalid float vector dimension range 'y' (expected -2.14748e+006 < y < 2.14748e+006 got -inf).
2019-10-24 02:19:15: ERROR[Main]: stack traceback:
2019-10-24 02:19:15: ERROR[Main]: 	[C]: in function 'set_acceleration'
2019-10-24 02:19:15: ERROR[Main]: 	...s\cjcur\Saved Games\Minetest\bin\..\mods\mobkit\init.lua:890: in function 'stepfunc'
2019-10-24 02:19:15: ERROR[Main]: 	...mes\Minetest\bin\..\mods\paleotest/mobs/velociraptor.lua:252: in function <...mes\Minetest\bin\..\mods\paleotest/mobs/velociraptor.lua:251>

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

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

by Termos » Post

ElCeejo wrote:in the process of chasing the thing it wants to attack it falls in water, and the game crashes, giving me this error.
That must have been a hell of a fall!

Looks like there's some sort of a limit in place, update is on the way.

u18398

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

by u18398 » Post

Termos wrote:Update 191017

changes:
  • * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior
Whales behaving strange now. Did you change something with negative speed ?
I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.

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

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

by Termos » Post

Gundul wrote:Did you change something with negative speed ?
Nope, technically speaking there's no much of a difference between positive and negative speed, maybe check your yaw calculations, when moving backwards the real yaw is really yaw-pi.
Gundul wrote:I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.
If using Blender and b3d plugin, try rotating it around the z axis so it's looking towards positive y (the green one).

u18398

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

by u18398 » Post

Termos wrote:
Gundul wrote:Did you change something with negative speed ?
Nope, technically speaking there's no much of a difference between positive and negative speed, maybe check your yaw calculations, when moving backwards the real yaw is really yaw-pi.
Gundul wrote:I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.
If using Blender and b3d plugin, try rotating it around the z axis so it's looking towards positive y (the green one).
thanks, I will need to read your commits, what actually really changed. On Lilly all works fine, but on Zombies after the update whales suddenly move backwards or do not know anymore to avoid obstacles.

I tried Blender but the gui is so overloaded I do net even know where to click X)

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

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

by Eran » Post

Gundul wrote:I tried Blender but the gui is so overloaded I do net even know where to click X)
To use blender you have to know the keyboard shortcuts, if you want to learn I recommend youtube tutorials.

Select the whale by left or right clicking depending on your settings and blender version
then 'R' to rotate
press 'Z' to only rotate on the z axis
type '180' or however many degrees you want it to rotate
press enter to actually rotate

Then you can export it as b3d.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

Gundul wrote:
Termos wrote:Update 191017

changes:
  • * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior
Whales behaving strange now. Did you change something with negative speed ?
I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.
Use "rotate" in minetest.register_entity.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests