Fix tangible.build
This commit is contained in:
@@ -167,7 +167,7 @@ void AnimStep::from_lua_store_number(lua_State *L, int idx, float *target, float
|
||||
bits_ |= bits;
|
||||
}
|
||||
|
||||
void AnimStep::from_lua(lua_State *L, int idx, const AnimStep &qback) {
|
||||
void AnimStep::from_lua(lua_State *L, int idx, bool ignex, const AnimStep &qback) {
|
||||
LuaSpecial tab(idx);
|
||||
LuaVar key, value;
|
||||
LuaStack LS(L, key, value);
|
||||
@@ -201,7 +201,9 @@ void AnimStep::from_lua(lua_State *L, int idx, const AnimStep &qback) {
|
||||
} else if (skey == "facing") {
|
||||
from_lua_store_number(L, value.index(), &facing_, 0.0, HAS_FACING, "facing");
|
||||
} else {
|
||||
luaL_error(L, "Unrecognized animation spec: %s", skey.c_str());
|
||||
if (!ignex) {
|
||||
luaL_error(L, "Unrecognized animation spec: %s", skey.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
// qback: the animation queue back, from which relative
|
||||
// moves are computed.
|
||||
//
|
||||
void from_lua(lua_State *L, int idx, const AnimStep &qback);
|
||||
void from_lua(lua_State *L, int idx, bool ignex, const AnimStep &qback);
|
||||
|
||||
// Make this step into a first-step of an anim queue.
|
||||
void keep_state_only();
|
||||
|
||||
@@ -26,7 +26,7 @@ LuaDefine(tangible_animate, "c") {
|
||||
int64_t id = w->alloc_id_predictable();
|
||||
const AnimStep &prev = tan->anim_queue_.back();
|
||||
AnimStep step;
|
||||
step.from_lua(L, config.index(), prev);
|
||||
step.from_lua(L, config.index(), false, prev);
|
||||
if (step.action() == "") {
|
||||
luaL_error(L, "animation action must be specified");
|
||||
}
|
||||
@@ -74,14 +74,18 @@ LuaDefine(tangible_build, "c") {
|
||||
LS.checktable(config);
|
||||
// Get the class of the new tangible.
|
||||
LS.rawget(classname, config, "class");
|
||||
|
||||
if (LS.isnil(classname)) {
|
||||
luaL_error(L, "must specify a class name");
|
||||
} else if (LS.classname(classname) != "") {
|
||||
LS.set(classtab, classname);
|
||||
} else {
|
||||
LS.getclass(classtab, classname);
|
||||
}
|
||||
LS.getclass(classtab, classname);
|
||||
|
||||
// Parse the initial animation step.
|
||||
AnimStep initstep, blank;
|
||||
initstep.from_lua(L, config.index(), blank);
|
||||
initstep.from_lua(L, config.index(), true, blank);
|
||||
if (!initstep.has_xyz()) {
|
||||
luaL_error(L, "You must specify (X,Y,Z) for new tangible");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user