diff --git a/src/DMAPI/tgs/v5/api.dm b/src/DMAPI/tgs/v5/api.dm index ffdde1ae20..9b64931f8f 100644 --- a/src/DMAPI/tgs/v5/api.dm +++ b/src/DMAPI/tgs/v5/api.dm @@ -276,13 +276,12 @@ return TRUE TGS_DEBUG_LOG("Waiting for completion of event ID: [event_id]") - pending_events[event_id] = TRUE - do + while(!pending_events[event_id]) sleep(world.tick_lag) - while(pending_events[event_id]) TGS_DEBUG_LOG("Completed wait on event ID: [event_id]") + pending_events -= event_id return TRUE diff --git a/src/DMAPI/tgs/v5/topic.dm b/src/DMAPI/tgs/v5/topic.dm index b13f83f82c..e66edc2720 100644 --- a/src/DMAPI/tgs/v5/topic.dm +++ b/src/DMAPI/tgs/v5/topic.dm @@ -285,7 +285,7 @@ return TopicResponse("Invalid or missing [DMAPI5_EVENT_ID]") TGS_DEBUG_LOG("Completing event ID [event_id]...") - pending_events -= event_id + pending_events[event_id] = TRUE return TopicResponse() return TopicResponse("Unknown command: [command]")