aboutsummaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-30 13:26:40 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-30 13:34:21 +0300
commit3241ad3ae8da687262db32776a1da2ef7403b3e9 (patch)
treedaa4e42ed2501e1ad6b9caa17087e4c50c65c1fd /doc/lua_api.txt
parent9e7ccedba4d9a94c7f2d20013c55e82aac3fe6a3 (diff)
downloadminetest-3241ad3ae8da687262db32776a1da2ef7403b3e9.tar.gz
minetest-3241ad3ae8da687262db32776a1da2ef7403b3e9.tar.bz2
minetest-3241ad3ae8da687262db32776a1da2ef7403b3e9.zip
ObjectRef:set_armor_groups() and ObjectRef:set_properties() - works on players too!
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt17
1 files changed, 14 insertions, 3 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 740f73b07..1199f8108 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -614,6 +614,7 @@ methods:
- get_wielded_item() -> ItemStack
- set_wielded_item(item): replaces the wielded item, returns true if successful
- set_armor_groups({group1=rating, group2=rating, ...})
+- set_properties(object property table)
LuaEntitySAO-only: (no-op for other objects)
- setvelocity({x=num, y=num, z=num})
- getvelocity() -> {x=num, y=num, z=num}
@@ -716,20 +717,30 @@ Registered entities
Definition tables
------------------
-Entity definition (register_entity)
+Object Properties
{
physical = true,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- visual = "cube"/"sprite",
+ visual = "cube"/"sprite"/"upright_sprite",
visual_size = {x=1, y=1},
- textures = {texture,texture,texture,texture,texture,texture},
+ textures = {}, -- number of required textures depends on visual
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
+ is_visible = true,
+ makes_footstep_sound = false,
+}
+
+Entity definition (register_entity)
+{
+ Everything from object properties,
+ -- entity specific --
on_activate = function(self, staticdata),
on_step = function(self, dtime),
on_punch = function(self, hitter),
on_rightclick = function(self, clicker),
get_staticdata = function(self),
+ ^ Called sometimes; the string returned is passed to on_activate when
+ the entity is re-activated from static state
# Also you can define arbitrary member variables here
myvariable = whatever,
}