21 lines
675 B
Lua
21 lines
675 B
Lua
|
|
local dbg
|
|
if moddebug then dbg=moddebug.dbg("people") else dbg={v1=function() end,v2=function() end,v3=function() end} end
|
|
|
|
people.actions.face = function(state)
|
|
if state.action.pos and state.action.pos.x and state.action.pos.y and state.action.pos.z then
|
|
state.yaw = vector.get_yaw(state.pos, state.action.pos)
|
|
dbg.v3(state.ent.name.." setting calculated yaw to "..state.yaw)
|
|
return true, true
|
|
elseif state.action.yaw then
|
|
dbg.v3(state.ent.name.." setting yaw to "..state.action.yaw)
|
|
state.yaw = state.action.yaw
|
|
return true, true
|
|
end
|
|
|
|
dbg.v1(state.ent.name.." has invalid face action "..dump(state.action))
|
|
return true, false
|
|
end
|
|
|
|
|