[UPDATE] Use automatic_face_movement_dir

This commit is contained in:
tacigar 2016-09-15 19:12:19 +09:00
parent eb68cf21a9
commit 006ab613b5
2 changed files with 28 additions and 28 deletions

View File

@ -313,40 +313,41 @@ function maidroid.register_maidroid(product_name, def)
-- register a definition of a new maidroid. -- register a definition of a new maidroid.
minetest.register_entity(product_name, { minetest.register_entity(product_name, {
-- basic initial properties -- basic initial properties
hp_max = def.hp_max, hp_max = def.hp_max,
weight = def.weight, weight = def.weight,
mesh = def.mesh, mesh = def.mesh,
textures = def.textures, textures = def.textures,
physical = true, physical = true,
visual = "mesh", visual = "mesh",
visual_size = {x = 10, y = 10}, visual_size = {x = 10, y = 10},
collisionbox = {-0.25, -0.5, -0.25, 0.25, 1.05, 0.25}, collisionbox = {-0.25, -0.5, -0.25, 0.25, 1.05, 0.25},
is_visible = true, is_visible = true,
makes_footstep_sound = true, makes_footstep_sound = true,
automatic_face_movement_dir = 90.0,
-- extra initial properties -- extra initial properties
pause = false, pause = false,
product_name = "", product_name = "",
manufacturing_number = -1, manufacturing_number = -1,
core_name = "", core_name = "",
-- callback methods. -- callback methods.
on_activate = on_activate, on_activate = on_activate,
on_step = on_step, on_step = on_step,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
on_punch = on_punch, on_punch = on_punch,
get_staticdata = get_staticdata, get_staticdata = get_staticdata,
-- extra methods. -- extra methods.
get_inventory = maidroid.maidroid.get_inventory, get_inventory = maidroid.maidroid.get_inventory,
get_core = maidroid.maidroid.get_core, get_core = maidroid.maidroid.get_core,
get_core_name = maidroid.maidroid.get_core_name, get_core_name = maidroid.maidroid.get_core_name,
get_nearest_player = maidroid.maidroid.get_nearest_player, get_nearest_player = maidroid.maidroid.get_nearest_player,
get_front_node = maidroid.maidroid.get_front_node, get_front_node = maidroid.maidroid.get_front_node,
get_look_direction = maidroid.maidroid.get_look_direction, get_look_direction = maidroid.maidroid.get_look_direction,
set_animation = maidroid.maidroid.set_animation, set_animation = maidroid.maidroid.set_animation,
set_yaw_by_direction = maidroid.maidroid.set_yaw_by_direction, set_yaw_by_direction = maidroid.maidroid.set_yaw_by_direction,
}) })
-- register a spawner for debugging maidroid mods. -- register a spawner for debugging maidroid mods.

View File

@ -45,7 +45,6 @@ local function on_step(self, dtime)
end end
self.object:setvelocity{x = direction.x, y = velocity.y, z = direction.z} -- TODO self.object:setvelocity{x = direction.x, y = velocity.y, z = direction.z} -- TODO
end end
self:set_yaw_by_direction(direction)
-- if maidroid is stoped by obstacle, the maidroid must jump. -- if maidroid is stoped by obstacle, the maidroid must jump.
if velocity.y == 0 and self.state == state.ACCOMPANY then if velocity.y == 0 and self.state == state.ACCOMPANY then