From Minetest Developer Wiki
(Redirected from ObjectRef:set attach)
Jump to: navigation, search

Moving things in the game are generally these (basically reference to a C++ ServerActiveObject).

Note that all ObjectRefs except player are actually LuaEntitySAO.


  • getpos() — returns {x=num, y=num, z=num}.
  • get_armor_groups() - Returns {group1=rating, group2=rating, ...})
Note: Documented in lua_api.txt but not yet implemented as of version 0.4.4

  • get_animation() - Returns frames, frame_speed, frame_blend, frame_loop.
  • frames - {x=int,y=int}
  • frame_speed - integer
  • frame_blend - integer
  • frame_loop - true if the animation is looping
  • get_hp() — returns number of hitpoints (2 * number of hearts).
  • get_inventory() — returns the InvRef of the object.
  • get_wielded_item() — returns the wielded item (ItemStack). This is essentially just a pseudonym for object:get_inventory():get_stack(object:get_wield_list(), object:get_wield_index()) so please note the caveats for inventory manipulation (changes will need to be "committed" by calling object:set_wielded_item(modifiedStack) after modifying the stack unless they are done in the context of a callback that implicitly modifies the stack; see minetest.register_node#on_use).
  • get_wield_index() — returns the index of the wielded item
  • get_wield_list() — returns the name of the inventory list the wielded item is in
  • moveto(pos, continuous=false) — interpolated move
  • punch(puncher, time_from_last_punch, tool_capabilities, direction)
  • puncher — an another ObjectRef
  • time_from_last_punch — time since last punch action of the puncher
  • direction: can be nil
  • clicker — another ObjectRef

Object property table

    hp_max = 1,
    physical = true,
    weight = 5,
    collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
    visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
    visual_size = {x=1, y=1},
    mesh = "model",
    textures = {}, -- number of required textures depends on visual
    colors = {}, -- number of required colors depends on visual
    spritediv = {x=1, y=1},
    initial_sprite_basepos = {x=0, y=0},
    is_visible = true,
    makes_footstep_sound = false,
    automatic_rotate = false,


This article is incomplete.

Personal tools