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;
|
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);
|
LuaSpecial tab(idx);
|
||||||
LuaVar key, value;
|
LuaVar key, value;
|
||||||
LuaStack LS(L, 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") {
|
} else if (skey == "facing") {
|
||||||
from_lua_store_number(L, value.index(), &facing_, 0.0, HAS_FACING, "facing");
|
from_lua_store_number(L, value.index(), &facing_, 0.0, HAS_FACING, "facing");
|
||||||
} else {
|
} 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
|
// qback: the animation queue back, from which relative
|
||||||
// moves are computed.
|
// 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.
|
// Make this step into a first-step of an anim queue.
|
||||||
void keep_state_only();
|
void keep_state_only();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ LuaDefine(tangible_animate, "c") {
|
|||||||
int64_t id = w->alloc_id_predictable();
|
int64_t id = w->alloc_id_predictable();
|
||||||
const AnimStep &prev = tan->anim_queue_.back();
|
const AnimStep &prev = tan->anim_queue_.back();
|
||||||
AnimStep step;
|
AnimStep step;
|
||||||
step.from_lua(L, config.index(), prev);
|
step.from_lua(L, config.index(), false, prev);
|
||||||
if (step.action() == "") {
|
if (step.action() == "") {
|
||||||
luaL_error(L, "animation action must be specified");
|
luaL_error(L, "animation action must be specified");
|
||||||
}
|
}
|
||||||
@@ -74,14 +74,18 @@ LuaDefine(tangible_build, "c") {
|
|||||||
LS.checktable(config);
|
LS.checktable(config);
|
||||||
// Get the class of the new tangible.
|
// Get the class of the new tangible.
|
||||||
LS.rawget(classname, config, "class");
|
LS.rawget(classname, config, "class");
|
||||||
|
|
||||||
if (LS.isnil(classname)) {
|
if (LS.isnil(classname)) {
|
||||||
luaL_error(L, "must specify a class name");
|
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.
|
// Parse the initial animation step.
|
||||||
AnimStep initstep, blank;
|
AnimStep initstep, blank;
|
||||||
initstep.from_lua(L, config.index(), blank);
|
initstep.from_lua(L, config.index(), true, blank);
|
||||||
if (!initstep.has_xyz()) {
|
if (!initstep.has_xyz()) {
|
||||||
luaL_error(L, "You must specify (X,Y,Z) for new tangible");
|
luaL_error(L, "You must specify (X,Y,Z) for new tangible");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user