New animation step constructor

This commit is contained in:
2021-02-25 16:32:48 -05:00
parent 1814f39e1a
commit 9076666b2b
4 changed files with 145 additions and 23 deletions

View File

@@ -365,17 +365,23 @@ LuaDefine(tangible_xyz, "c") {
return LS.result();
}
LuaDefine(tangible_walkto, "c") {
LuaArg tanobj, x, y, z;
LuaStack LS(L, tanobj, x, y, z);
LuaDefine(tangible_plane, "c") {
LuaArg tanobj;
LuaRet plane;
LuaStack LS(L, tanobj, plane);
World *w = World::fetch_global_pointer(L);
Tangible *tan = w->tangible_get(L, tanobj.index());
LS.set(plane, tan->anim_queue_.get_plane());
return LS.result();
}
LuaDefine(tangible_animate, "c") {
LuaArg tanobj, config;
LuaStack LS(L, tanobj, config);
World *w = World::fetch_global_pointer(L);
lua_Number nx = LS.cknumber(x);
lua_Number ny = LS.cknumber(y);
lua_Number nz = LS.cknumber(z);
Tangible *tan = w->tangible_get(L, tanobj.index());
int64_t id = w->id_global_pool_.alloc_id_for_thread(L);
tan->anim_queue_.add(id, "walk");
tan->anim_queue_.set_xyz(util::XYZ(nx, ny, nz));
tan->anim_queue_.add(id, L, config.index());
tan->update_plane_item();
return LS.result();
}