diff --git a/rsc/scripts/door_utility.lua b/rsc/scripts/door_utility.lua index 11f681d..7901acc 100644 --- a/rsc/scripts/door_utility.lua +++ b/rsc/scripts/door_utility.lua @@ -66,6 +66,10 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, --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) @@ -79,6 +83,10 @@ function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, --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 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; });