Fixed traceback issue, improved animqueue primitives

This commit is contained in:
2021-06-03 13:29:19 -04:00
parent 427c82ea8b
commit 5b19d407fb
7 changed files with 79 additions and 91 deletions

View File

@@ -194,28 +194,6 @@ World::Redirects World::fetch_redirects() {
return std::move(result);
}
// void Tangible::be_a_player() {
// if (!id_player_pool_.fifo_enabled()) {
// id_player_pool_.enable_fifo();
// AnimStep asinit;
// asinit.set_graphic("player");
// anim_queue_.add(world_->id_global_pool_.get_one(), asinit);
// anim_queue_.keep_only(1);
// update_plane_item();
// LuaVar classtab, mt, place, tangibles;
// LuaStack LS(world_->state(), classtab, mt, place, tangibles);
// LS.makeclass(classtab, "player");
// LS.rawget(tangibles, LuaRegistry, "tangibles");
// LS.rawget(place, tangibles, id());
// LS.getmetatable(mt, place);
// LS.rawset(mt, "__index", classtab);
// LS.result();
// }
// }
int64_t World::create_login_actor() {
Tangible *tan = tangible_make(state(), 0, true);
LuaArg database;
@@ -414,7 +392,7 @@ void World::run_scheduled_threads(int64_t clk) {
thread_sched_.add(sched.clock() + int64_t(delay), sched.thread_id(), sched.place_id());
std::cerr << "Added to schedule." << std::endl;
}
} else if (status == 0) {
} else if (status == LUA_OK) {
// Successfully ran to completion. Remove from thread table.
std::cerr << "Thread ran to completion." << std::endl;
LS.rawset(threads, sched.thread_id(), LuaNil);
@@ -511,8 +489,9 @@ LuaDefine(tangible_animate, "c") {
World *w = World::fetch_global_pointer(L);
Tangible *tan = w->tangible_get(L, tanobj.index());
int64_t id = w->id_global_pool_.alloc_id_for_thread(L);
const AnimStep &prev = tan->anim_queue_.back();
AnimStep step;
step.from_lua(L, config.index());
step.from_lua(L, config.index(), prev);
if (step.action() == "") {
luaL_error(L, "animation action must be specified");
}
@@ -561,8 +540,8 @@ LuaDefine(tangible_build, "c") {
LS.getclass(classtab, classname);
// Parse the initial animation step.
AnimStep initstep;
initstep.from_lua(L, config.index());
AnimStep initstep, blank;
initstep.from_lua(L, config.index(), blank);
if (!initstep.has_xyz()) {
luaL_error(L, "You must specify (X,Y,Z) for new tangible");
}