private void HandleGameEvent(EmpyrionGameEventData TypedMsg) { if (TypedMsg.eventId == CmdId.Request_GlobalStructure_List) { GetGlobalStructureListEvents.Enqueue(TypedMsg); GetGlobalStructureList.Set(); } else { GameAPI.Game_Request(TypedMsg.eventId, TypedMsg.seqNr, TypedMsg.GetEmpyrionObject()); } }
private void ReadGlobalStructureInfoForEvent() { var gsl = new EgsDbTools.GlobalStructureListAccess(); while (!Exit) { if (GetGlobalStructureList.WaitOne(1000)) { if (GetGlobalStructureListEvents.TryDequeue(out var TypedMsg)) { gsl.UpdateIntervallInSeconds = CurrentConfig.Current.GlobalStructureListUpdateIntervallInSeconds; gsl.GlobalDbPath = Path.Combine(ModAPI.Application.GetPathFor(AppFolder.SaveGame), "global.db"); switch (TypedMsg.eventId) { case CmdId.Request_GlobalStructure_List: Game_Event(TypedMsg.eventId, TypedMsg.seqNr, gsl.CurrentList); break; case CmdId.Request_GlobalStructure_Update: gsl.UpdateNow = true; Game_Event(TypedMsg.eventId, TypedMsg.seqNr, true); break; } } GetGlobalStructureList.Reset(); } } }