diff --git a/server/accounts/account_manager.cpp b/server/accounts/account_manager.cpp index 7b2a423..02dc85c 100644 --- a/server/accounts/account_manager.cpp +++ b/server/accounts/account_manager.cpp @@ -27,6 +27,7 @@ //Define the queries //------------------------- +//TODO: (1) ensure this is independant of column order static const char* CREATE_USER_ACCOUNT = "INSERT INTO Accounts (username) VALUES (?);"; static const char* LOAD_USER_ACCOUNT = "SELECT * FROM Accounts WHERE username = ?;"; static const char* SAVE_USER_ACCOUNT = "UPDATE OR FAIL Accounts SET blacklisted = ?2, whitelisted = ?3, mod = ?4, admin = ?5 WHERE uid = ?1;"; diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index a51b09e..4663735 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -47,17 +47,16 @@ void RoomData::RunFrame() { it.second.Update(); } - //compare the triggers to the entities + //compare the triggers to the entities, using their real hitboxes for (auto& it : *triggerMgr.GetContainer()) { + BoundingBox itBox = it.second.GetBoundingBox() + it.second.GetOrigin(); for (auto& character : characterList) { - //positional boxes BoundingBox hitBox = character->GetBounds() + character->GetOrigin(); - BoundingBox itBox = it.second.GetBoundingBox() + it.second.GetOrigin(); if ( itBox.CheckOverlap(hitBox) ) { - //TODO: trigger script + //trigger script lua_rawgeti(lua, LUA_REGISTRYINDEX, it.second.GetScriptReference()); - lua_pushlightuserdata(lua, character); + lua_pushlightuserdata(lua, character); //TODO: (1) entity type //run the script if (lua_pcall(lua, 1, 0, 0) != LUA_OK) { diff --git a/server/triggers/trigger_manager_api.cpp b/server/triggers/trigger_manager_api.cpp index 572b7dd..580ea5e 100644 --- a/server/triggers/trigger_manager_api.cpp +++ b/server/triggers/trigger_manager_api.cpp @@ -23,8 +23,6 @@ #include "trigger_manager.hpp" -//TODO: (1) figure out a way to iterate through elements of managers from lua - static int create(lua_State* L) { //DOCS: params: create(triggerMgr, name[, originX, originY[, boundsX, boundsY, boundsW, boundsH]][, script])