Mobkit - Entity API [mobkit][alpha]

Post Reply
u18398

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

by u18398 » Post

Well done. Zombieworld is up to date now.

just one thing in your wildlife mod:

Code: Select all

local function herbivore_brain(self)

	if self.object:get_hp() <=100 then	
same for the predators. You forgot to change to your new api I guess :)

Like this all wildlife mobs die as soon as they spawn :D

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

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

by runs » Post

Gundul wrote:Well done. Zombieworld is up to date now.

just one thing in your wildlife mod:

Code: Select all

local function herbivore_brain(self)

	if self.object:get_hp() <=100 then	
same for the predators. You forgot to change to your new api I guess :)

Like this all wildlife mobs die as soon as they spawn :D
Change to:

Code: Select all

 if self.hp <= 0 then

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

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

by Termos » Post

Damnation! The files must have mixed up somehow during the upload,
reuploaded again, please check.

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

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

by runs » Post

mobkit.heal(luaent,dmg) can increase over max_hp and mobkit.hurt(luaent,dmg) below 0.

Well, no problem, I do a check. But it'd be cool if you put a note in mobkit_api.txt

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

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

by Termos » Post

runs wrote:mobkit.heal(luaent,dmg) can increase over max_hp and mobkit.hurt(luaent,dmg) below 0.
No no, heal shouldn't increase over max hp, this is a bug sorry.
As to hurt, shouldn't really matter, you can choose.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

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

by Stix » Post

I tried downloading wildlife from the ContentDB and got the error "no proper mod or modpack found" perhaps it needs to be reuploaded?
Hey, what can i say? I'm the bad guy.

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

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

by runs » Post

Stix wrote:I tried downloading wildlife from the ContentDB and got the error "no proper mod or modpack found" perhaps it needs to be reuploaded?
ContentDB is bugged from a day ago. :-(

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

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

by runs » Post

Some requests:
-iddle animations, more than one, and randomly selected, as the textures. Mobs redo have 5 max for each animation, but i do not understand this limit.
-when runaway apply the run animation, if not existed, then the walk one.

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

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

by Termos » Post

runs wrote: -iddle animations, more than one, and randomly selected, as the textures. Mobs redo have 5 max for each animation, but i do not understand this limit.
Should work already, I added that a couple versions ago, doesn't it?
I'm sure I've seen it working in Petz.
runs wrote: -when runaway apply the run animation, if not existed, then the walk one.
For now I recommend copying relevant behaviors over to your mod and modifying them there.
I'll think about adding a fallback to animate() for the next version.

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

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

by runs » Post

Termos wrote:
runs wrote: -iddle animations, more than one, and randomly selected, as the textures. Mobs redo have 5 max for each animation, but i do not understand this limit.
Should work already, I added that a couple versions ago, doesn't it?
I'm sure I've seen it working in Petz.
runs wrote: -when runaway apply the run animation, if not existed, then the walk one.
For now I recommend copying relevant behaviors over to your mod and modifying them there.
I'll think about adding a fallback to animate() for the next version.
Sorry, it works hahaha

OK I will do so.

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

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

by runs » Post

A request:

Code: Select all

-- Memory functions. 
-- Stuff in memory is serialized, never try to remember objectrefs.
function mobkit.remember(self,key,val)
  self.memory[key]=val
  return val
end
What about adding a 'return' to the remember function? With this, you could set a var and saved it at the same time.

u18398

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

by u18398 » Post

Yesterday server crashed once.
Fist time in a very long period that this happened:

Code: Select all

2019-07-30 18:50:36: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'zombiestrd' in callback luaentity_Step(): .minetest/mods/petz/mobkit/init.lua:56: attempt to index local 'vec' (a nil value)
2019-07-30 18:50:36: ERROR[Main]: stack traceback:
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/petz/mobkit/init.lua:56: in function 'pos_shift'
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/petz/mobkit/init.lua:389: in function 'is_neighbor_node_reachable'
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/petz/mobkit/init.lua:444: in function 'get_next_waypoint'
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/petz/mobkit/init.lua:529: in function 'goto_next_waypoint'
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/zombiestrd/init.lua:132: in function 'func'
2019-07-30 18:50:36: ERROR[Main]:       /home/mars/.minetest/mods/petz/mobkit/init.lua:648: in function 'execute_queues'
2019-07-30 18:50:36: ERROR[Main]:       .minetest/mods/petz/mobkit/init.lua:1322: in function </home/mars/.minetest/mods/petz/mobkit/init.lua:1213>


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

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

by Termos » Post

Gundul wrote: 2019-07-30 18:50:36: ERROR[Main]: .minetest/mods/zombiestrd/init.lua:132: in function 'func'
Not sure how to help, looks like this version of zombiestrd has been modified, there's a comment at line 132 in the original.
runs wrote: What about adding a 'return' to the remember function? With this, you could set a var and saved it at the same time.
Sure, the next version.

u18398

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

by u18398 » Post

Termos wrote:
Gundul wrote: 2019-07-30 18:50:36: ERROR[Main]: .minetest/mods/zombiestrd/init.lua:132: in function 'func'
Not sure how to help, looks like this version of zombiestrd has been modified, there's a comment at line 132 in the original.
Sorry I always forget that I added code for highscore list etc.

The error happened here:

Code: Select all


-- custom behaviour
-- makes them move in stimulus' general direction for limited time
local function hq_attracted(self,prty,tpos)
        local timer = time() + random(20,30)    -- zombie's attention span
        local func = function(self)
                if time() > timer then return true end
                if mobkit.is_queue_empty_low(self) and self.isonground then
                        local pos = mobkit.get_stand_pos(self)
                        if vector.distance(pos,tpos) > 3 then
                                mobkit.goto_next_waypoint(self,tpos)     *** This is line 132 ***
                        else
                                return true
                        end
                end
        end
        mobkit.queue_high(self,func,prty)
end


I hope that helps.

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

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

by Termos » Post

Gundul wrote: Sorry I always forget that I added code for highscore list etc.
Turns out your mobkit has been modified as well.
Identified a possible cause, a small bugfix release coming very soon.

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

Hello, I think you should look into CME and make it more like that, also it would be awesome if you could add support for playereffects, so mobs could inflict magical dmg. Red flash would be cool too.

Anyways really loving this, I hope to make a mod out of it soon.
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

u18398

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

by u18398 » Post

Termos wrote: Turns out your mobkit has been modified as well.
Identified a possible cause, a small bugfix release coming very soon.
I am innocent in this case :) But I remember like that runs added something
for his flying petz.

Petz mod, wildlife and zombiestrd are running for 2 months now together with
your mobkit on ZombieTest server. That was the first and only crash in a long
period of time. For being still alpha your mobkit is very stable and reliable.

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: Turns out your mobkit has been modified as well.
Identified a possible cause, a small bugfix release coming very soon.
I am innocent in this case :) But I remember like that runs added something
for his flying petz.

Petz mod, wildlife and zombiestrd are running for 2 months now together with
your mobkit on ZombieTest server. That was the first and only crash in a long
period of time. For being still alpha your mobkit is very stable and reliable.
Thermos is right, bugs has t be reported with original mobkit.

I've only changed two lines:
-- dumb friction
if self.isonground and not(self.can_fly) then
and

self.isinliquid = false
if not(self.can_fly) then
self.object:set_acceleration({x=0,y=mobkit.gravity,z=0})
end

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

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

by Termos » Post

runs wrote: -- dumb friction
if self.isonground and not(self.can_fly) then
I've seen your flying behavior, it seems to use the collisionbox-too-tall trick ;), that's why it's affected by friction.

Ultimately flying must be a separate behavior based on different principles than walking, and that much node awareness is redundant when flying anyway.
I feel flying must be synced with animation, alas, I've run into problems with that. I'd appreciate any help.

I hope I did something wrong there, because fixing engine bugs seems to take forever.
StarNinjas wrote:Hello, I think you should look into CME and make it more like that, also it would be awesome if you could add support for playereffects, so mobs could inflict magical dmg. Red flash would be cool too.
Mobkit is an api and has no dependencies, that means it supports anything that can be done using minetest api and is compatible with other mods, including playereffects, red flashes and other colors as well.

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

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

by Termos » Post

Small bugfix release
0.10.31

- mobkit.remember now also returns the passed value.
- mobkit.hurt and mobkit.heal now keep it in <0,max_hp> range
- fixed possible crash when a mob is commanded to go to its' own position.
Last edited by Termos on Wed Aug 07, 2019 11:54, 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

Thanx for the new version.
I feel flying must be synced with animation, alas, I've run into problems with that. I'd appreciate any help.
I can't be much help, I don't know much, to say almost nothing, of animations.

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

@Termos could you show me how?
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

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

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

by runs » Post

Hi Thermos I report you an error in line 346

luaent.hp = min(self.max_hp,(luaent.hp or 0) + dmg)

it should be:

luaent.hp = min(luaent.max_hp,(luaent.hp or 0) + dmg)

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

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

by Termos » Post

runs wrote:Hi Thermos I report you an error in line 346
Examples don't use heal, that's why it slipped through testing, thanks.

Ver 0.10.32

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

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

by Termos » Post

StarNinjas wrote:@Termos could you show me how?
Short answer, you code using minetest api and other mods of your choice as you normally would.

Mobkit is an api, that is a set of functions and standards for modders to help them code their own entities. It is not a self contained mod and it does't define any entities itself.
Well, there are example mods included, but they are just that, examples, their main function is to provide example code for modders.

The api doesn't depend nor is aware of any other mods, and will never be, that's why you can use any other mod/api alongside it, including playereffects.

For details on how to use mobkit see mobkit_api.txt and examples.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests