diff --git a/rsc/scripts/door_utility.lua b/rsc/scripts/door_utility.lua index 11f681d..fe02b6c 100644 --- a/rsc/scripts/door_utility.lua +++ b/rsc/scripts/door_utility.lua @@ -60,12 +60,16 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, --move the character characterAPI.SetRoom(entity, roomTwo) - characterAPI.SetOrigin(entity, Xtwo, Ytwo-16) + characterAPI.SetOrigin(entity, Xtwo, Ytwo+16) networkAPI.PumpCharacterUpdate(entity) --disable the other trigger local triggerTwo = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomTwo), handle) triggerAPI.PushExclusionEntity(triggerTwo, entity) + + --bookkeeping: remove from the original trigger's exclusion list + local triggerOne = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomOne), handle) + triggerAPI.RemoveExclusionEntity(triggerOne, entity) end local function scriptTwo(entity) @@ -73,12 +77,16 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, --move the character characterAPI.SetRoom(entity, roomOne) - characterAPI.SetOrigin(entity, Xone, Yone-16) --NOTE: the 16 pixel margin for presentation + characterAPI.SetOrigin(entity, Xone, Yone+16) --NOTE: +16 should prevent double collision issues networkAPI.PumpCharacterUpdate(entity) --disable the other trigger local triggerOne = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomOne), handle) triggerAPI.PushExclusionEntity(triggerOne, entity) + + --bookkeeping: remove from the original trigger's exclusion list + local triggerTwo = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomTwo), handle) + triggerAPI.RemoveExclusionEntity(triggerTwo, entity) end --create the triggers proper @@ -86,4 +94,4 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, doorUtility.CreateTrigger(handle, roomTwo, Xtwo, Ytwo, scriptTwo) end -return doorUtility \ No newline at end of file +return doorUtility diff --git a/server/clients/client_manager.cpp b/server/clients/client_manager.cpp index b9eb238..feeb985 100644 --- a/server/clients/client_manager.cpp +++ b/server/clients/client_manager.cpp @@ -43,6 +43,11 @@ std::list ClientManager::CheckConnections() { for (auto& it : elementMap) { if (it.second.GetAttempts() > 2) { returnList.push_back(it.first); + + //send the drop message + ServerPacket newPacket; + newPacket.type = SerialPacketType::ADMIN_DISCONNECT_FORCED; + UDPNetworkUtility::GetSingleton().SendTo(it.second.GetAddress(), &newPacket); } } @@ -106,4 +111,4 @@ int ClientManager::GetTotalCount() { std::map* ClientManager::GetContainer() { return &elementMap; -} \ No newline at end of file +} diff --git a/server/triggers/trigger_manager.cpp b/server/triggers/trigger_manager.cpp index dba1af6..d93236d 100644 --- a/server/triggers/trigger_manager.cpp +++ b/server/triggers/trigger_manager.cpp @@ -50,6 +50,9 @@ void TriggerManager::Compare(std::stack entityStack) { continue; } + //push to the exclusion list + triggerPair.second.GetExclusionList()->push_back(entity); + //run the trigger script lua_rawgeti(lua, LUA_REGISTRYINDEX, triggerPair.second.GetScriptReference()); lua_pushlightuserdata(lua, entity); @@ -58,13 +61,10 @@ void TriggerManager::Compare(std::stack entityStack) { //error throw(std::runtime_error(std::string() + "Lua error: " + lua_tostring(lua, -1) )); } - - //push to the exclusion list - triggerPair.second.GetExclusionList()->push_back(entity); } else { //remove members of the exclusion list - //NOTE: characters in different rooms won't be removed, but that shouldn't be a problem + //NOTE: characters in different rooms won't be removed, which does tend to be a problem triggerPair.second.GetExclusionList()->remove_if([entity](Entity* ptr) -> bool { return entity == ptr; });