Mobkit - Entity API [mobkit][alpha]

User avatar
Eris
Member
Posts: 175
Joined: Thu Nov 19, 2020 23:12
IRC: definitelya Ovalo
In-game: Eris_still_crafts

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

by Eris » Post

Grubler wrote:
Tue Sep 14, 2021 18:44
I would like to be able to do it myself if possible.
Ah gotcha.
Jump in the caac

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

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

by MisterE » Post

you could conceivably write a function to replace grass with air and then call it in the brain function.

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

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

by Termos » Post

Grubler wrote:
Tue Sep 14, 2021 17:17
Big fan of the deer and wolf. Can I ask if there is a way to make the deer eat grass and stuff?
Definitely,
I only haven't implemented grazing behavior because I'm to lazy to make a proper model animation.

See mobkit_api.txt for instructions on custom behavior creation, and should you have any specific questions ask them here.

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

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

by Grubler » Post

I guess I really don't know what to do. I sort of am not even sure what I am looking at.

u18398

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

by u18398 » Post

Grubler wrote:
Fri Sep 17, 2021 19:20
I guess I really don't know what to do. I sort of am not even sure what I am looking at.
Hungry, tamable deers that even run from water_life:snakes:

https://github.com/berengma/wildlife

BlueTangs Rock
Member
Posts: 204
Joined: Sun Jul 10, 2016 05:00
Location: Under Le' Sea

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

by BlueTangs Rock » Post

Is it possible for one to set loot drops from Wildlife's deers and wolves?

As an example, could it be possible for me to set it to that they could drop meat, leather, or bones from other mods?
Look at that, a signiture box! To bad I have nothing to put in i-... Wait...

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

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

by Termos » Post

BlueTangs Rock wrote:
Wed Sep 22, 2021 06:10
Is it possible for one to set loot drops from Wildlife's deers and wolves?
Sure.
Probably the easiest way is to copy function [yournamespace].hq_die(self) from behaviors2override.lua, and put your drop logic in this block: if timer < 0 then self.object:remove() end. Then use your version instead of mobkit.hq_die()

Wildlife only doesn't do drops because it's supposed to be dependencyless.

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

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

by AccidentallyRhine » Post

These mobs feel less robotic than other mods, especially the flying mobs. Everything worked great on my first world startup but ever since, all the animals just seem to stand in place. They will turn to face me and make noise like they want to attack but never actually do. Deer no longer flee. I'm trying to figure out what might have changed.

wsor4035
Member
Posts: 182
Joined: Sun Aug 11, 2019 21:23
GitHub: wsor4035
IRC: wsor
In-game: wsor

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

by wsor4035 » Post

unless im missing something, it appears returning true in a behavior doesnt always end it on that step. issue https://github.com/TheTermos/mobkit/issues/37 unless I am missing something.
j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o

User avatar
apercy
Member
Posts: 638
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

AccidentallyRhine wrote:
Fri Dec 10, 2021 21:02
These mobs feel less robotic than other mods, especially the flying mobs. Everything worked great on my first world startup but ever since, all the animals just seem to stand in place. They will turn to face me and make noise like they want to attack but never actually do. Deer no longer flee. I'm trying to figure out what might have changed.
I had this issue when I was using mob_core (a dependency of animalia). Then when I disabled it, all worked fine again.

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

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

by AccidentallyRhine » Post

apercy wrote:
Fri Dec 10, 2021 23:00
I had this issue when I was using mob_core (a dependency of animalia). Then when I disabled it, all worked fine again.
It now works with mob_core disabled. Thanks! Animalia wasn't even working anyway since it kept erroring about spawn light level issues so I deactivated it.

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

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

by j0j0n4th4n » Post

Would it be possible to get some mob examples with mobkit?

I'm running into all sort of problems converting some mobs from NSSM into mobkit and somethings are not very clear in the documentation
cdb_894a100ddd76

wsor4035
Member
Posts: 182
Joined: Sun Aug 11, 2019 21:23
GitHub: wsor4035
IRC: wsor
In-game: wsor

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

by wsor4035 » Post

j0j0n4th4n wrote:
Tue Dec 14, 2021 01:51
Would it be possible to get some mob examples with mobkit?

I'm running into all sort of problems converting some mobs from NSSM into mobkit and somethings are not very clear in the documentation
https://github.com/TheTermos/zombiestrd and https://github.com/TheTermos/wildlife for ones by the author.

https://content.minetest.net/metapackages/mobkit/ shows you all packages that use it
j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

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

by j0j0n4th4n » Post

That did helped, but it also confuse me more =P
The thing is, the example mobs don't really work. I dunno why but the wolf and the zombie don't move at all when they are suppose to wander around, the wolf hunt the deer but after reaching it don't do damage instead both mobs get stuck in air doing their walking animation but not moving from that node. I run it in 5.3 and 5.4 so maybe that is the reason?
cdb_894a100ddd76

wsor4035
Member
Posts: 182
Joined: Sun Aug 11, 2019 21:23
GitHub: wsor4035
IRC: wsor
In-game: wsor

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

by wsor4035 » Post

j0j0n4th4n wrote:
Tue Dec 14, 2021 15:53

That did helped, but it also confuse me more =P
The thing is, the example mobs don't really work. I dunno why but the wolf and the zombie don't move at all when they are suppose to wander around, the wolf hunt the deer but after reaching it don't do damage instead both mobs get stuck in air doing their walking animation but not moving from that node. I run it in 5.3 and 5.4 so maybe that is the reason?
works for me :tm:

try having only mobkit and the two demo mods by termos enabled on stock mtg to make sure something else isnt interfering
j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

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

by j0j0n4th4n » Post

try having only mobkit and the two demo mods by termos enabled on stock mtg to make sure something else isnt interfering
Thanks! That worked well, when I disabled mob core the mobs start behaving as I expected them to be. I guess that was a conflict between both mods
cdb_894a100ddd76

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

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

by runs » Post

Code: Select all

2022-02-12 07:51:28: WARNING[Server]: collisionMoveSimple: Loop count exceeded, aborting to avoid infiniite loop
2022-02-12 07:51:45: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): Invalid float vector dimension range 'y' (expected -2.14748e+06 < y < 2.14748e+06 got 4.2413e+09).
2022-02-12 07:51:45: ERROR[Main]: stack traceback:
2022-02-12 07:51:45: ERROR[Main]: 	[C]: in function 'set_velocity'
2022-02-12 07:51:45: ERROR[Main]: 	/home/mtlive1/.minetest/mods/mobkit/init.lua:702: in function 'physics'
2022-02-12 07:51:45: ERROR[Main]: 	/home/mtlive1/.minetest/mods/mobkit/init.lua:843: in function 'stepfunc'
2022-02-12 07:51:45: ERROR[Main]: 	/home/mtlive1/.minetest/mods/petz/petz/petz/pony_mobkit.lua:121: in function 'func'

Probably in 5.5 error caused for the new vector definition.

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

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

by runs » Post

The problematic line is the last one (self.object:set_velocity(vnew)) in the following code:

Code: Select all

function mobkit.physics(self)
	local vel=self.object:get_velocity()
	local vnew = vector.new(vel)
		-- dumb friction

	if self.isonground and not self.isinliquid then
		vnew = {x= vel.x> 0.2 and vel.x*mobkit.friction or 0,
				y=vel.y,
				z=vel.z > 0.2 and vel.z*mobkit.friction or 0}
	end

	-- bounciness
	if self.springiness and self.springiness > 0 then

		if colinfo and colinfo.collides then
			for _,c in ipairs(colinfo.collisions) do
				if c.old_velocity[c.axis] > 0.1 then
					vnew[c.axis] = vnew[c.axis] * self.springiness * -1
				end
			end
		elseif not colinfo then					-- MT 5.2 and earlier
			for _,k in ipairs({'y','z','x'}) do
				if vel[k]==0 and abs(self.lastvelocity[k])> 0.1 then
					vnew[k]=-self.lastvelocity[k]*self.springiness
				end
			end
		end
	end

	self.object:set_velocity(vnew)

User avatar
apercy
Member
Posts: 638
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

runs wrote:
Sat Feb 12, 2022 17:13
The problematic line is the last one (self.object:set_velocity(vnew)) in the following code:

Code: Select all

function mobkit.physics(self)
	local vel=self.object:get_velocity()
	local vnew = vector.new(vel)
		-- dumb friction

	if self.isonground and not self.isinliquid then
		vnew = {x= vel.x> 0.2 and vel.x*mobkit.friction or 0,
				y=vel.y,
				z=vel.z > 0.2 and vel.z*mobkit.friction or 0}
	end

	-- bounciness
	if self.springiness and self.springiness > 0 then

		if colinfo and colinfo.collides then
			for _,c in ipairs(colinfo.collisions) do
				if c.old_velocity[c.axis] > 0.1 then
					vnew[c.axis] = vnew[c.axis] * self.springiness * -1
				end
			end
		elseif not colinfo then					-- MT 5.2 and earlier
			for _,k in ipairs({'y','z','x'}) do
				if vel[k]==0 and abs(self.lastvelocity[k])> 0.1 then
					vnew[k]=-self.lastvelocity[k]*self.springiness
				end
			end
		end
	end

	self.object:set_velocity(vnew)
you can make your own physics function and set it instead the default function, as I did in my motorboat mod.
Look at line 302 in "init.lua" file
and the file "motorboat_custom_physics.lua"

https://content.minetest.net/packages/apercy/motorboat/

https://content.minetest.net/packages/apercy/motorboat/

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

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

by runs » Post

Forget it. The conflict was with another mod.

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

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

by runs » Post

apercy wrote:
Sat Feb 12, 2022 18:16
runs wrote:
Sat Feb 12, 2022 17:13
The problematic line is the last one (self.object:set_velocity(vnew)) in the following code:

Code: Select all

function mobkit.physics(self)
	local vel=self.object:get_velocity()
	local vnew = vector.new(vel)
		-- dumb friction

	if self.isonground and not self.isinliquid then
		vnew = {x= vel.x> 0.2 and vel.x*mobkit.friction or 0,
				y=vel.y,
				z=vel.z > 0.2 and vel.z*mobkit.friction or 0}
	end

	-- bounciness
	if self.springiness and self.springiness > 0 then

		if colinfo and colinfo.collides then
			for _,c in ipairs(colinfo.collisions) do
				if c.old_velocity[c.axis] > 0.1 then
					vnew[c.axis] = vnew[c.axis] * self.springiness * -1
				end
			end
		elseif not colinfo then					-- MT 5.2 and earlier
			for _,k in ipairs({'y','z','x'}) do
				if vel[k]==0 and abs(self.lastvelocity[k])> 0.1 then
					vnew[k]=-self.lastvelocity[k]*self.springiness
				end
			end
		end
	end

	self.object:set_velocity(vnew)
you can make your own physics function and set it instead the default function, as I did in my motorboat mod.
Look at line 302 in "init.lua" file
and the file "motorboat_custom_physics.lua"

https://content.minetest.net/packages/apercy/motorboat/

https://content.minetest.net/packages/apercy/motorboat/
Thanks, solved.

Post Reply

Who is online

Users browsing this forum: Unacceptium_core and 8 guests