예제 #1
0
void Lua_V2::IsChoreLooping() {
	lua_Object choreObj = lua_getparam(1);

	if (!lua_isuserdata(choreObj) || lua_tag(choreObj) != MKTAG('C','H','O','R'))
		return;

	int chore = lua_getuserdata(choreObj);
	Chore *c = EMIChore::getPool().getObject(chore);

	if (c) {
		pushbool(c->isLooping());
	} else {
		lua_pushnil();
	}
}
예제 #2
0
void Lua_V2::AdvanceChore() {
	lua_Object choreObj = lua_getparam(1);
	lua_Object timeObj = lua_getparam(2);

	if (!lua_isuserdata(choreObj) || lua_tag(choreObj) != MKTAG('C','H','O','R') || !lua_isnumber(timeObj))
		return;

	int chore = lua_getuserdata(choreObj);
	float time = lua_getnumber(timeObj);
	Chore *c = EMIChore::getPool().getObject(chore);
	if (c) {
		if (!c->isPlaying()) {
			warning("AdvanceChore() called on stopped chore %s (%s)",
					c->getName(), c->getOwner()->getFilename().c_str());
			if (c->isLooping()) {
				c->getOwner()->playChoreLooping(c->getName());
			} else {
				c->getOwner()->playChore(c->getName());
			}
		}
		c->setTime(time * 1000);
	}
}