Merge branch 'master' into drunk

This commit is contained in:
2016-12-09 18:36:00 +11:00
4 changed files with 33 additions and 8 deletions
+12
View File
@@ -33,3 +33,15 @@ Instructions For Setup
from the main menu; this displays the list of available servers. from the main menu; this displays the list of available servers.
7. Select the name of a server (default is 'Public') and select 'Join'. 7. Select the name of a server (default is 'Public') and select 'Join'.
8. Welcome to Tortuga, enjoy your stay. 8. Welcome to Tortuga, enjoy your stay.
-------------------------
Linux Users
-------------------------
Before running this on linux, you may need to run the following commands:
sudo apt-get install libsdl2-net-2.0-0
sudo apt-get install libsdl2-image-2.0-0
sudo apt-get install libsdl2-ttf-2.0-0
+10 -2
View File
@@ -60,12 +60,16 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo,
--move the character --move the character
characterAPI.SetRoom(entity, roomTwo) characterAPI.SetRoom(entity, roomTwo)
characterAPI.SetOrigin(entity, Xtwo, Ytwo-16) characterAPI.SetOrigin(entity, Xtwo, Ytwo+16)
networkAPI.PumpCharacterUpdate(entity) networkAPI.PumpCharacterUpdate(entity)
--disable the other trigger --disable the other trigger
local triggerTwo = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomTwo), handle) local triggerTwo = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomTwo), handle)
triggerAPI.PushExclusionEntity(triggerTwo, entity) 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 end
local function scriptTwo(entity) local function scriptTwo(entity)
@@ -73,12 +77,16 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo,
--move the character --move the character
characterAPI.SetRoom(entity, roomOne) 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) networkAPI.PumpCharacterUpdate(entity)
--disable the other trigger --disable the other trigger
local triggerOne = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomOne), handle) local triggerOne = triggerManagerAPI.FindTrigger(roomAPI.GetTriggerMgr(roomOne), handle)
triggerAPI.PushExclusionEntity(triggerOne, entity) 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 end
--create the triggers proper --create the triggers proper
+5
View File
@@ -43,6 +43,11 @@ std::list<int> ClientManager::CheckConnections() {
for (auto& it : elementMap) { for (auto& it : elementMap) {
if (it.second.GetAttempts() > 2) { if (it.second.GetAttempts() > 2) {
returnList.push_back(it.first); returnList.push_back(it.first);
//send the drop message
ServerPacket newPacket;
newPacket.type = SerialPacketType::ADMIN_DISCONNECT_FORCED;
UDPNetworkUtility::GetSingleton().SendTo(it.second.GetAddress(), &newPacket);
} }
} }
+4 -4
View File
@@ -50,6 +50,9 @@ void TriggerManager::Compare(std::stack<Entity*> entityStack) {
continue; continue;
} }
//push to the exclusion list
triggerPair.second.GetExclusionList()->push_back(entity);
//run the trigger script //run the trigger script
lua_rawgeti(lua, LUA_REGISTRYINDEX, triggerPair.second.GetScriptReference()); lua_rawgeti(lua, LUA_REGISTRYINDEX, triggerPair.second.GetScriptReference());
lua_pushlightuserdata(lua, entity); lua_pushlightuserdata(lua, entity);
@@ -58,13 +61,10 @@ void TriggerManager::Compare(std::stack<Entity*> entityStack) {
//error //error
throw(std::runtime_error(std::string() + "Lua error: " + lua_tostring(lua, -1) )); throw(std::runtime_error(std::string() + "Lua error: " + lua_tostring(lua, -1) ));
} }
//push to the exclusion list
triggerPair.second.GetExclusionList()->push_back(entity);
} }
else { else {
//remove members of the exclusion list //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 { triggerPair.second.GetExclusionList()->remove_if([entity](Entity* ptr) -> bool {
return entity == ptr; return entity == ptr;
}); });