Minor tweak to hCharacterMovement()

This commit is contained in:
Kayne Ruse
2015-03-13 19:36:03 +11:00
parent d2bb3575fc
commit 954213f1ff
3 changed files with 9 additions and 3 deletions
+3 -2
View File
@@ -49,9 +49,10 @@ static int setRoomIndex(lua_State* L) { //TODO: (1) take the room userdata as a
//error checking
if (characterIndex == -1) {
throw(std::runtime_error("Failed to find character index by reference"));
throw(std::runtime_error("Lua Error: Failed to find character index by reference"));
}
//send the delete & create messages
pumpAndChangeRooms(character, lua_tointeger(L, 2), characterIndex);
return 0;
}
@@ -75,8 +76,8 @@ static int getAvatar(lua_State* L) {
}
static const luaL_Reg characterLib[] = {
// {"GetOwner", getOwner}, //unusable without account API
{"SetRoomIndex", setRoomIndex},
// {"GetOwner", getOwner}, //unusable without account API
{"GetHandle", getHandle},
{"GetAvatar", getAvatar},
{nullptr, nullptr}
+5
View File
@@ -212,6 +212,11 @@ void ServerApplication::hCharacterMovement(CharacterPacket* const argPacket) {
//check if moving rooms
if (characterData->GetRoomIndex() != argPacket->roomIndex) {
//set the character's origin and motion
characterData->SetOrigin(argPacket->origin);
characterData->SetMotion(argPacket->motion);
//send the delete & create messages
pumpAndChangeRooms(characterData, argPacket->roomIndex, argPacket->characterIndex);
}
//if not moving between rooms