Exemplo n.º 1
0
void Lua_V2::StopChore() {
	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);
	// FIXME: implement missing rest part of code
	warning("Lua_V2::StopChore: stub, chore: %d time: %f", chore, time);
	Chore *c = EMIChore::getPool().getObject(chore);
	if (c) {
		c->stop();
	}
}
Exemplo n.º 2
0
void Lua_V2::StopChore() {
	lua_Object choreObj = lua_getparam(1);
	lua_Object fadeTimeObj = lua_getparam(2);

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

	int chore = lua_getuserdata(choreObj);
	float fadeTime = 0.0f;

	if (!lua_isnil(fadeTimeObj)) {
		if (lua_isnumber(fadeTimeObj))
			fadeTime = lua_getnumber(fadeTimeObj);
	}

	Chore *c = EMIChore::getPool().getObject(chore);
	if (c) {
		c->stop((int)(fadeTime * 1000));
	}
}