2021-01-12 14:14:38 -05:00
|
|
|
#include <limits>
|
2021-01-23 14:44:06 -05:00
|
|
|
#include "luastack.hpp"
|
|
|
|
|
#include "animqueue.hpp"
|
2021-01-12 14:14:38 -05:00
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
AnimStep::AnimStep() {
|
|
|
|
|
clear();
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-12 14:14:38 -05:00
|
|
|
AnimStep::~AnimStep() {}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimStep::clear() {
|
|
|
|
|
id_ = 0;
|
|
|
|
|
bits_ = 0;
|
|
|
|
|
action_ = "";
|
|
|
|
|
facing_ = 0;
|
|
|
|
|
xyz_ = util::XYZ(0,0,0);
|
|
|
|
|
graphic_ = "";
|
|
|
|
|
plane_ = "";
|
2021-03-13 13:05:00 -05:00
|
|
|
}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimStep::set_action(const std::string &act) {
|
|
|
|
|
action_ = act;
|
2021-01-12 14:14:38 -05:00
|
|
|
}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimStep::set_facing(float f) {
|
|
|
|
|
bits_ |= HAS_FACING;
|
|
|
|
|
facing_ = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_x(float f) {
|
|
|
|
|
bits_ |= HAS_X;
|
|
|
|
|
xyz_.x = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_y(float f) {
|
|
|
|
|
bits_ |= HAS_Y;
|
|
|
|
|
xyz_.y = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_z(float f) {
|
|
|
|
|
bits_ |= HAS_Z;
|
|
|
|
|
xyz_.z = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_xyz(const util::XYZ &xyz) {
|
|
|
|
|
bits_ |= (HAS_X | HAS_Y | HAS_Z);
|
|
|
|
|
xyz_ = xyz;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_graphic(const std::string &g) {
|
|
|
|
|
bits_ |= HAS_GRAPHIC;
|
|
|
|
|
graphic_ = g;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::set_plane(const std::string &p) {
|
|
|
|
|
bits_ |= HAS_PLANE;
|
|
|
|
|
plane_ = p;
|
2021-01-17 16:23:10 -05:00
|
|
|
}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
AnimQueue::AnimQueue() {
|
|
|
|
|
size_limit_ = 10; // Default size limit.
|
|
|
|
|
clear_steps();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimStep::from_lua(lua_State *L, int idx) {
|
2021-02-25 16:32:48 -05:00
|
|
|
LuaSpecial tab(idx);
|
|
|
|
|
LuaVar value;
|
|
|
|
|
LuaStack LS(L, value);
|
|
|
|
|
if (!LS.istable(tab)) {
|
|
|
|
|
luaL_error(L, "animation spec must be a table");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "action");
|
2021-03-28 15:12:09 -04:00
|
|
|
if (LS.isstring(value)) {
|
|
|
|
|
action_ = LS.ckstring(value);
|
|
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation action must be a string");
|
2021-02-25 16:32:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "facing");
|
|
|
|
|
if (LS.isnumber(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
facing_ = LS.cknumber(value);
|
|
|
|
|
bits_ |= HAS_FACING;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation facing must be a number");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "x");
|
|
|
|
|
if (LS.isnumber(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
xyz_.x = LS.cknumber(value);
|
|
|
|
|
bits_ |= HAS_X;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation X coordinate must be a number");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "y");
|
|
|
|
|
if (LS.isnumber(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
xyz_.y = LS.cknumber(value);
|
|
|
|
|
bits_ |= HAS_Y;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation Y coordinate must be a number");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "z");
|
|
|
|
|
if (LS.isnumber(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
xyz_.z = LS.cknumber(value);
|
|
|
|
|
bits_ |= HAS_Z;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation Z coordinate must be a number");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "graphic");
|
|
|
|
|
if (LS.isstring(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
graphic_ = LS.ckstring(value);
|
|
|
|
|
bits_ |= HAS_GRAPHIC;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation graphic must be a string");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LS.rawget(value, tab, "plane");
|
|
|
|
|
if (LS.isstring(value)) {
|
2021-03-28 15:12:09 -04:00
|
|
|
plane_ = LS.ckstring(value);
|
|
|
|
|
bits_ |= HAS_PLANE;
|
2021-02-25 16:32:48 -05:00
|
|
|
} else if (!LS.isnil(value)) {
|
|
|
|
|
luaL_error(L, "animation plane must be a string");
|
|
|
|
|
}
|
2021-03-28 15:12:09 -04:00
|
|
|
}
|
2021-02-25 16:32:48 -05:00
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimStep::echo(const AnimStep &prev) {
|
|
|
|
|
if (!has_facing()) {
|
|
|
|
|
facing_ = prev.facing_;
|
2021-02-25 16:32:48 -05:00
|
|
|
}
|
2021-03-28 15:12:09 -04:00
|
|
|
if (!has_x()) {
|
|
|
|
|
xyz_.x = prev.xyz_.x;
|
|
|
|
|
}
|
|
|
|
|
if (!has_y()) {
|
|
|
|
|
xyz_.y = prev.xyz_.y;
|
|
|
|
|
}
|
|
|
|
|
if (!has_z()) {
|
|
|
|
|
xyz_.z = prev.xyz_.z;
|
|
|
|
|
}
|
|
|
|
|
if (!has_graphic()) {
|
|
|
|
|
graphic_ = prev.graphic_;
|
|
|
|
|
}
|
|
|
|
|
if (!has_plane()) {
|
|
|
|
|
plane_ = prev.plane_;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AnimStep::echoes(const AnimStep &prev) const {
|
|
|
|
|
if (!has_facing() && (facing_ != prev.facing_)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!has_x() && (xyz_.x != prev.xyz_.x)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!has_y() && (xyz_.y != prev.xyz_.y)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!has_z() && (xyz_.z != prev.xyz_.z)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!has_graphic() && (graphic_ != prev.graphic_)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!has_plane() && (plane_ != prev.plane_)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimQueue::clear_steps() {
|
|
|
|
|
steps_.clear();
|
|
|
|
|
steps_.emplace_back();
|
|
|
|
|
AnimStep &init = steps_.back();
|
2021-02-25 16:32:48 -05:00
|
|
|
init.bits_ = AnimStep::HAS_EVERYTHING;
|
2021-03-28 15:12:09 -04:00
|
|
|
init.action_ = "";
|
|
|
|
|
init.graphic_ = "";
|
|
|
|
|
init.plane_ = "";
|
2021-02-25 16:32:48 -05:00
|
|
|
}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimQueue::set_size_limit(int n) {
|
|
|
|
|
assert(n >= 2);
|
|
|
|
|
size_limit_ = n;
|
|
|
|
|
}
|
2021-01-12 14:14:38 -05:00
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimQueue::keep_only(int n) {
|
|
|
|
|
if (n < 1) n = 1;
|
|
|
|
|
while (int(steps_.size()) > n) {
|
2021-01-12 14:14:38 -05:00
|
|
|
steps_.pop_front();
|
|
|
|
|
}
|
|
|
|
|
AnimStep &init = steps_.front();
|
|
|
|
|
init.id_ = 0;
|
|
|
|
|
init.action_ = "";
|
2021-01-16 01:24:33 -05:00
|
|
|
init.bits_ = AnimStep::HAS_EVERYTHING;
|
2021-01-12 14:14:38 -05:00
|
|
|
}
|
|
|
|
|
|
2021-03-28 15:12:09 -04:00
|
|
|
void AnimQueue::add(int64_t id, const AnimStep &step) {
|
|
|
|
|
AnimStep copy = step;
|
|
|
|
|
copy.echo(steps_.back());
|
|
|
|
|
copy.id_ = id;
|
|
|
|
|
steps_.push_back(copy);
|
|
|
|
|
keep_only(size_limit_);
|
2021-01-12 14:14:38 -05:00
|
|
|
}
|
2021-01-16 01:24:33 -05:00
|
|
|
|
2021-03-13 13:05:00 -05:00
|
|
|
bool AnimQueue::valid() {
|
|
|
|
|
// Animqueue must have at least one step.
|
|
|
|
|
if (steps_.empty()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// First action should be blank.
|
|
|
|
|
if (steps_[0].action_ != "") {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// First step should have all bits.
|
|
|
|
|
if (steps_[0].bits_ != AnimStep::HAS_EVERYTHING) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Any unset bit should correspond to a value copied from the previous step.
|
|
|
|
|
for (size_t i = 1; i < steps_.size(); i++) {
|
|
|
|
|
const AnimStep &prev = steps_[i - 1];
|
|
|
|
|
const AnimStep &curr = steps_[i];
|
2021-03-28 15:12:09 -04:00
|
|
|
if (!curr.echoes(prev)) return false;
|
2021-03-13 13:05:00 -05:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimQueue::serialize(StreamBuffer *sb) {
|
|
|
|
|
assert(valid()); // can't serialize an invalid animqueue.
|
|
|
|
|
sb->write_int32(size_limit_);
|
|
|
|
|
sb->write_size(steps_.size());
|
|
|
|
|
for (const AnimStep &step : steps_) {
|
|
|
|
|
sb->write_int64(step.id_);
|
|
|
|
|
sb->write_int16(step.bits_);
|
|
|
|
|
sb->write_string(step.action_);
|
|
|
|
|
if (step.has_facing()) {
|
|
|
|
|
sb->write_float(step.facing_);
|
|
|
|
|
}
|
2021-03-28 15:12:09 -04:00
|
|
|
if (step.has_x()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
sb->write_float(step.xyz_.x);
|
2021-03-28 15:12:09 -04:00
|
|
|
}
|
|
|
|
|
if (step.has_y()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
sb->write_float(step.xyz_.y);
|
2021-03-28 15:12:09 -04:00
|
|
|
}
|
|
|
|
|
if (step.has_z()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
sb->write_float(step.xyz_.z);
|
|
|
|
|
}
|
|
|
|
|
if (step.has_graphic()) {
|
|
|
|
|
sb->write_string(step.graphic_);
|
|
|
|
|
}
|
|
|
|
|
if (step.has_plane()) {
|
|
|
|
|
sb->write_string(step.plane_);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimQueue::deserialize(StreamBuffer *sb) {
|
|
|
|
|
size_limit_ = sb->read_int32();
|
|
|
|
|
size_t nsteps = sb->read_size();
|
|
|
|
|
steps_.resize(nsteps);
|
|
|
|
|
for (size_t i = 0; i < nsteps; i++) {
|
|
|
|
|
AnimStep &step = steps_[i];
|
|
|
|
|
if (i > 0) step = steps_[i - 1];
|
|
|
|
|
step.id_ = sb->read_int64();
|
|
|
|
|
step.bits_ = sb->read_int16();
|
|
|
|
|
step.action_ = sb->read_string();
|
|
|
|
|
if (step.has_facing()) {
|
|
|
|
|
step.facing_ = sb->read_float();
|
|
|
|
|
}
|
2021-03-28 15:12:09 -04:00
|
|
|
if (step.has_x()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
step.xyz_.x = sb->read_float();
|
2021-03-28 15:12:09 -04:00
|
|
|
}
|
|
|
|
|
if (step.has_y()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
step.xyz_.y = sb->read_float();
|
2021-03-28 15:12:09 -04:00
|
|
|
}
|
|
|
|
|
if (step.has_z()) {
|
2021-03-13 13:05:00 -05:00
|
|
|
step.xyz_.z = sb->read_float();
|
|
|
|
|
}
|
|
|
|
|
if (step.has_graphic()) {
|
|
|
|
|
step.graphic_ = sb->read_string();
|
|
|
|
|
}
|
|
|
|
|
if (step.has_plane()) {
|
|
|
|
|
step.plane_ = sb->read_string();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-28 13:27:28 -04:00
|
|
|
const AnimStep &AnimQueue::back() const {
|
|
|
|
|
return steps_.back();
|
2021-01-16 01:24:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LuaDefine(unittests_animqueue, "c") {
|
|
|
|
|
// Check initial state.
|
2021-03-28 15:12:09 -04:00
|
|
|
AnimStep stp;
|
2021-01-17 16:23:10 -05:00
|
|
|
AnimQueue aq;
|
2021-03-13 13:05:00 -05:00
|
|
|
StreamBuffer sb;
|
|
|
|
|
AnimQueue aqds;
|
2021-01-17 16:23:10 -05:00
|
|
|
aq.set_size_limit(3);
|
|
|
|
|
|
2021-03-13 13:05:00 -05:00
|
|
|
LuaAssert(L, aq.valid());
|
2021-01-16 01:24:33 -05:00
|
|
|
LuaAssert(L, aq.size() == 1);
|
|
|
|
|
const AnimStep *st = &aq.nth(0);
|
|
|
|
|
LuaAssert(L, st->id() == 0);
|
|
|
|
|
LuaAssert(L, st->action() == "");
|
|
|
|
|
LuaAssert(L, st->bits() == AnimStep::HAS_EVERYTHING);
|
|
|
|
|
LuaAssert(L, st->facing() == 0.0);
|
|
|
|
|
LuaAssert(L, st->xyz() == util::XYZ(0,0,0));
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, st->graphic() == "");
|
|
|
|
|
LuaAssert(L, st->plane() == "");
|
|
|
|
|
|
|
|
|
|
// Test the step setters.
|
|
|
|
|
stp.clear();
|
|
|
|
|
stp.set_facing(180);
|
|
|
|
|
LuaAssert(L, stp.facing() == 180);
|
|
|
|
|
LuaAssert(L, stp.bits() == AnimStep::HAS_FACING);
|
|
|
|
|
stp.set_x(3);
|
|
|
|
|
LuaAssert(L, stp.xyz() == util::XYZ(3, 0, 0));
|
|
|
|
|
LuaAssert(L, stp.bits() == (AnimStep::HAS_FACING | AnimStep::HAS_X));
|
|
|
|
|
stp.set_y(4);
|
|
|
|
|
LuaAssert(L, stp.xyz() == util::XYZ(3, 4, 0));
|
|
|
|
|
LuaAssert(L, stp.bits() == (AnimStep::HAS_FACING | AnimStep::HAS_X | AnimStep::HAS_Y));
|
|
|
|
|
stp.set_z(5);
|
|
|
|
|
LuaAssert(L, stp.xyz() == util::XYZ(3, 4, 5));
|
|
|
|
|
LuaAssert(L, stp.bits() == (AnimStep::HAS_FACING | AnimStep::HAS_X | AnimStep::HAS_Y | AnimStep::HAS_Z));
|
|
|
|
|
stp.set_plane("somewhere");
|
|
|
|
|
LuaAssert(L, stp.plane() == "somewhere");
|
|
|
|
|
LuaAssert(L, stp.bits() == (AnimStep::HAS_FACING | AnimStep::HAS_XYZ | AnimStep::HAS_PLANE));
|
|
|
|
|
stp.set_graphic("something");
|
|
|
|
|
LuaAssert(L, stp.graphic() == "something");
|
|
|
|
|
LuaAssert(L, stp.bits() == (AnimStep::HAS_FACING | AnimStep::HAS_XYZ | AnimStep::HAS_PLANE | AnimStep::HAS_GRAPHIC));
|
2021-01-16 01:24:33 -05:00
|
|
|
|
|
|
|
|
// Add a step.
|
2021-03-28 15:12:09 -04:00
|
|
|
stp.clear();
|
|
|
|
|
stp.set_action("walk");
|
|
|
|
|
aq.add(12345, stp);
|
2021-03-13 13:05:00 -05:00
|
|
|
LuaAssert(L, aq.valid());
|
2021-01-16 01:24:33 -05:00
|
|
|
LuaAssert(L, aq.size() == 2);
|
|
|
|
|
st = &aq.nth(1);
|
|
|
|
|
LuaAssert(L, st->id() == 12345);
|
|
|
|
|
LuaAssert(L, st->action() == "walk");
|
|
|
|
|
LuaAssert(L, st->bits() == 0);
|
|
|
|
|
LuaAssert(L, st->facing() == 0.0);
|
|
|
|
|
LuaAssert(L, st->xyz() == util::XYZ(0,0,0));
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, st->graphic() == "");
|
|
|
|
|
LuaAssert(L, st->plane() == "");
|
|
|
|
|
|
2021-01-16 01:24:33 -05:00
|
|
|
// Exceed the length limit, dropping first element.
|
2021-03-28 15:12:09 -04:00
|
|
|
stp.clear();
|
|
|
|
|
stp.set_action("walk");
|
|
|
|
|
aq.add(12346, stp);
|
|
|
|
|
aq.add(12347, stp);
|
2021-01-16 01:24:33 -05:00
|
|
|
LuaAssert(L, aq.size() == 3);
|
|
|
|
|
LuaAssert(L, aq.nth(0).id() == 0);
|
|
|
|
|
LuaAssert(L, aq.nth(0).action() == "");
|
|
|
|
|
LuaAssert(L, aq.nth(0).bits() == AnimStep::HAS_EVERYTHING);
|
|
|
|
|
LuaAssert(L, aq.nth(1).id() == 12346);
|
|
|
|
|
LuaAssert(L, aq.nth(2).id() == 12347);
|
2021-03-13 13:05:00 -05:00
|
|
|
LuaAssert(L, aq.valid());
|
|
|
|
|
|
|
|
|
|
// Test serialization and deserialization.
|
|
|
|
|
aq.set_size_limit(5);
|
|
|
|
|
aq.clear_steps();
|
2021-03-28 15:12:09 -04:00
|
|
|
|
|
|
|
|
stp.clear();
|
|
|
|
|
stp.set_action("walk");
|
|
|
|
|
stp.set_xyz(util::XYZ(3,4,5));
|
|
|
|
|
aq.add(12345, stp);
|
|
|
|
|
|
|
|
|
|
stp.clear();
|
|
|
|
|
stp.set_action("setgraphic");
|
|
|
|
|
stp.set_graphic("banana");
|
|
|
|
|
aq.add(12346, stp);
|
|
|
|
|
|
|
|
|
|
stp.clear();
|
|
|
|
|
stp.set_action("setfacing");
|
|
|
|
|
stp.set_facing(301.0);
|
|
|
|
|
aq.add(12347, stp);
|
|
|
|
|
|
2021-03-13 13:05:00 -05:00
|
|
|
aq.serialize(&sb);
|
|
|
|
|
aqds.deserialize(&sb);
|
|
|
|
|
|
|
|
|
|
LuaAssert(L, aqds.size_limit() == 5);
|
|
|
|
|
LuaAssert(L, aqds.size() == 4);
|
|
|
|
|
|
|
|
|
|
LuaAssert(L, aqds.nth(0).id() == 0);
|
|
|
|
|
LuaAssert(L, aqds.nth(0).bits() == AnimStep::HAS_EVERYTHING);
|
|
|
|
|
LuaAssert(L, aqds.nth(0).action() == "");
|
|
|
|
|
LuaAssert(L, aqds.nth(0).facing() == 0.0);
|
|
|
|
|
LuaAssert(L, aqds.nth(0).xyz() == util::XYZ(0,0,0));
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, aqds.nth(0).graphic() == "");
|
|
|
|
|
LuaAssert(L, aqds.nth(0).plane() == "");
|
2021-03-13 13:05:00 -05:00
|
|
|
|
|
|
|
|
LuaAssert(L, aqds.nth(1).id() == 12345);
|
|
|
|
|
LuaAssert(L, aqds.nth(1).bits() == AnimStep::HAS_XYZ);
|
|
|
|
|
LuaAssert(L, aqds.nth(1).action() == "walk");
|
|
|
|
|
LuaAssert(L, aqds.nth(1).facing() == 0.0);
|
|
|
|
|
LuaAssert(L, aqds.nth(1).xyz() == util::XYZ(3,4,5));
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, aqds.nth(1).graphic() == "");
|
|
|
|
|
LuaAssert(L, aqds.nth(1).plane() == "");
|
2021-03-13 13:05:00 -05:00
|
|
|
|
|
|
|
|
LuaAssert(L, aqds.nth(2).id() == 12346);
|
|
|
|
|
LuaAssert(L, aqds.nth(2).bits() == AnimStep::HAS_GRAPHIC);
|
|
|
|
|
LuaAssert(L, aqds.nth(2).action() == "setgraphic");
|
|
|
|
|
LuaAssert(L, aqds.nth(2).facing() == 0.0);
|
|
|
|
|
LuaAssert(L, aqds.nth(2).xyz() == util::XYZ(3,4,5));
|
|
|
|
|
LuaAssert(L, aqds.nth(2).graphic() == "banana");
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, aqds.nth(2).plane() == "");
|
2021-03-13 13:05:00 -05:00
|
|
|
|
|
|
|
|
LuaAssert(L, aqds.nth(3).id() == 12347);
|
|
|
|
|
LuaAssert(L, aqds.nth(3).bits() == AnimStep::HAS_FACING);
|
|
|
|
|
LuaAssert(L, aqds.nth(3).action() == "setfacing");
|
|
|
|
|
LuaAssert(L, aqds.nth(3).facing() == 301.0);
|
|
|
|
|
LuaAssert(L, aqds.nth(3).xyz() == util::XYZ(3,4,5));
|
|
|
|
|
LuaAssert(L, aqds.nth(3).graphic() == "banana");
|
2021-03-28 15:12:09 -04:00
|
|
|
LuaAssert(L, aqds.nth(3).plane() == "");
|
2021-03-13 13:05:00 -05:00
|
|
|
|
2021-01-16 01:24:33 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|