tangible.animate uses the new keyword parser.
This commit is contained in:
@@ -58,12 +58,13 @@ LuaDefine(tangible_animate, "tan,configtable",
|
||||
"|action,graphic,plane,x,y,z,facing") {
|
||||
LuaArg tanobj, config;
|
||||
LuaStack LS(L, tanobj, config);
|
||||
LuaKeywordParser kp(LS, config);
|
||||
World *w = World::fetch_global_pointer(L);
|
||||
Tangible *tan = w->tangible_get(LS, tanobj);
|
||||
int64_t id = w->alloc_id_predictable();
|
||||
const AnimStep &prev = tan->anim_queue_.back();
|
||||
AnimStep step;
|
||||
step.from_lua(L, config.index(), false, prev);
|
||||
step.configure(kp, tan->anim_queue_.back());
|
||||
kp.check_unparsed_keywords();
|
||||
if (step.action() == "") {
|
||||
luaL_error(L, "animation action must be specified");
|
||||
}
|
||||
@@ -129,18 +130,20 @@ LuaDefine(tangible_delete, "tan",
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
LuaDefine(tangible_build, "configtable",
|
||||
LuaDefine(tangible_build, "config",
|
||||
"|Build a new tangible object."
|
||||
"|The configtable must contain: class,x,y,z,plane,graphic."
|
||||
"|The configtable can optionally contain: facing.") {
|
||||
"|The config table must contain: class,x,y,z,plane,graphic."
|
||||
"|The config table can optionally contain: facing.") {
|
||||
LuaArg config;
|
||||
LuaVar classname, classtab, mt;
|
||||
LuaRet database;
|
||||
LuaStack LS(L, config, classname, classtab, database, mt);
|
||||
|
||||
LS.checktable(config, "config");
|
||||
LuaKeywordParser kp(LS, config);
|
||||
|
||||
// Get the class of the new tangible.
|
||||
LS.rawget(classname, config, "class");
|
||||
if (!kp.parse(classname, "class")) {
|
||||
luaL_error(L, "You must specify a class for the tangible");
|
||||
}
|
||||
eng::string err = LS.getclass(classtab, classname);
|
||||
if (err != "") {
|
||||
luaL_error(L, "%s", err.c_str());
|
||||
@@ -148,7 +151,8 @@ LuaDefine(tangible_build, "configtable",
|
||||
|
||||
// Parse the initial animation step.
|
||||
AnimStep initstep, blank;
|
||||
initstep.from_lua(L, config.index(), true, blank);
|
||||
initstep.configure(kp, blank);
|
||||
kp.check_unparsed_keywords();
|
||||
if (!initstep.has_xyz()) {
|
||||
luaL_error(L, "You must specify (X,Y,Z) for new tangible");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user