GithubHelp home page GithubHelp logo

mobkit's Introduction

mobkit

Entity API for Minetest

This library is meant to be shared between mods
Please do not write to the mobkit namespace ('mobkit' global table),
nor include own copies of mobkit in your mods and modpacks.

mobkit's People

Contributors

berengma avatar elceejo avatar rubenwardy avatar thetermos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mobkit's Issues

mobkit.isinliquid implies any liquid, not just source

self.isinliquid -- true if feet submerged in liquid type=source

suggestion that this should be changed to true if in source or flowing, however this might break mods that assume this so as a alternative self.isinflowingliquid could exist for liquid type = source

deprecated function 'get_player_velocity'

2023-03-13 13:42:50: WARNING[Server]: Call to deprecated function 'get_player_velocity', please use 'get_velocity' at ...ibrary/Application Support/minetest/mods/mobkit/init.lua:233

game crashes if nodebox is nil

makes a server unplayable because game crashes repeatedly when a mob meets a node with nodebox = nil.

easy solution line 180:
if node.drawtype == 'nodebox' then
if node.node_box == nil then return nil end -- <- This is new and to be added
if node.node_box.type == 'fixed' then

Mobkit breaks entities using multiple texture files.

In minetest entity models can have textures from multiple files by making the model consist of multiple objects in blender. That way each entree in the textures table becomes a texture for one object. (or more if there are more objects than entrees)

The problem is that mobkit picks one file out of the table randomly so the textures for these models become broken. It would be nice if there was a way to have random textures that doesn't break this.

With mobkit.actfunc commented out:
grafik

With mobkit.actfunc called:
grafik

Here's the mod the screenshots are from:

eg_goats.zip

sinking on flowing water

Like I posted at minetest forums:

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 826, in the while loop of mobkit.physics method. So I put the following:

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.

Undeclared global variable "colinfo"

Getting warnings of undeclared variables. Something what would need attention probably.

2022-12-28 16:50:15: WARNING[Server]: Undeclared global variable "colinfo" accessed at ...ibrary/Application Support/minetest/mods/mobkit/init.lua:687
2022-12-28 16:50:15: WARNING[Server]: Undeclared global variable "colinfo" accessed at ...ibrary/Application Support/minetest/mods/mobkit/init.lua:693

crash when try to read abr from mapgen settings

2020-04-19 09:44:48: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'wildlife' in callback luaentity_Step(): .minetest/mods/mobkit/init.lua:712: attempt to perform arithmetic on upvalue 'abr' (a string value)
2020-04-19 09:44:48: ERROR[Main]: stack traceback:
2020-04-19 09:44:48: ERROR[Main]:       .minetest/mods/mobkit/init.lua:712: in function 'get_closest_entity'
2020-04-19 09:44:48: ERROR[Main]:      .minetest/mods/wildlife/init.lua:201: in function 'logic'
2020-04-19 09:44:48: ERROR[Main]:      .minetest/mods/mobkit/init.lua:957: in function </home/mars/.minetest/mods/mobkit/init.lua:937>

happens on my server using mapgen V6
solution is trivial :)
for example like:

local abr = tonumber(minetest.get_mapgen_setting('active_block_range')) or 1

Spawning

I started looking into adding spawning to paleotest, which uses mobkit and noticed how complex spawning is compared to mobs redo, which I am familiar with. I've looked at examples from wildlife and water_life and it seems very complex to implement. Is there a simpler way or plans to make spawning simpler?

Server Crash

Minetest Version: 5.4.1

Mobkit update at commit: ddea141

Crash:
ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '??' in callback luaentity_Step(): /home/minetest/minetest/bin/../mods/mob_core/hq_lq.lua:177: attempt to index a nil value
ERROR[Main]: stack traceback:
ERROR[Main]: /home/minetest/minetest/bin/../mods/mob_core/hq_lq.lua:177: in function 'sensor_floor'
ERROR[Main]: /home/minetest/minetest/bin/../mods/mob_core/hq_lq.lua:428: in function 'func'
ERROR[Main]: /home/minetest/minetest/bin/../mods/mobkit/init.lua:621: in function 'execute_queues'
ERROR[Main]: /home/minetest/minetest/bin/../mods/mobkit/init.lua:848: in function 'stepfunc'
ERROR[Main]: /home/minetest/minetest/bin/../mods/mob_core/api.lua:1147: in function 'on_step'
ERROR[Main]: /home/minetest/minetest/bin/../mods/draconis/api/api.lua:978: in function </home/minetest/minetest/bin/../mods/draconis/api/api.lua:977>

Invalid float vector dimension range 'y' (expected -2.14748e+06 < y < 2.14748e+06 got 4.2413e+09).

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'
2022-02-12 07:51:45: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:106: in function <...inetest_live/bin/../builtin/profiler/instrumentation.lua:100>

The issue arose when someone put a petz pony on a trampoline, resulting in the pony reaching faster than light velocity :D:D:D:D

Even though the pony was removed eventually, I captured its y speed:

2022-02-12 09:15:35: ERROR[Server]: [mobkit] #1476 vnew={
	y = 34507632640,
	x = 0,
	z = 0
}

Could you please defend in the function against crazy horses?

I initially reported to petz: https://github.com/runsy/petz/issues/93

For my reference 1476

Suggestions

I'm looking for mob mods to be improved and then merged into Minetest Game

This looks very well done. The main concern I have is that the entire API is in one Lua file, it would be good to have the base API and common behaviours (hq/lq) in different files.

You should consider using luacheck

Some other misc thoughts:

  • You don't document the signature of the logic function (ie: what does it take as arguments?)
  • Adding methods to the entity def.
    Rather than doing mobkit.thing(self, ...) it would be nicer to do self:thing(...)

deprecated functions

Call to deprecated function 'get_player_velocity', please use 'get_velocity'

  • init.lua:233

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.