Go to file
Lars Mueller 06a8c9f71c Fix ID assignment 2022-01-05 12:12:54 +01:00
Readme.md Fix formatting 2022-01-05 11:57:36 +01:00
init.lua Code quality: use new modlib functionality 2020-07-30 00:07:44 +02:00
main.lua Fix ID assignment 2022-01-05 12:12:54 +01:00
mod.conf Add modlib dependency 2020-05-07 12:38:33 +02:00
screenshot.png Optimize screenshot 2020-05-24 13:09:05 +02:00

Readme.md

Entity Library (moblib)

Low-level high-performance entity library

About

Depends on modlib. Licensed under the MIT License. Written by Lars Mueller aka LMD or appguru(eu).

  • GitHub - sources, issue tracking, contributing
  • Discord - discussion, chatting
  • Minetest Forum - (more organized) discussion
  • ContentDB - releases (cloning from GitHub is recommended)

API

Mostly self-documenting code. Mod namespace is moblib, containing all variables & functions.

vector get_rotation(vector direction)

Returns rotation required to rotate a z-facing model in direction.

vector get_wield_rotation(vector direction)

Same as get_rotation but for wield_images.

vector get_direction(vector rotation)

Inverse of get_rotation.

register_entity(name, def)

register_entity(text name, table def)

moblib.register_entity(name, {
    initial_properties = {...},
    lua_properties = {
        moveresult = {
            collisions = nil,
            axes = nil,
            old_velocity = nil,
            acceleration_dependent = nil
        },
        staticdata = "json" or "lua"
    },
    on_step = ...,
    ...
})