mirror of
https://github.com/BigJk/end_of_eden.git
synced 2026-02-06 10:48:09 +00:00
fix: save being broken after a while
This commit is contained in:
parent
1604f876a8
commit
efbc74077a
@ -292,7 +292,12 @@ func (s *Session) ToSavedState() SavedState {
|
||||
PointsPerRound: s.pointsPerRound,
|
||||
Merchant: s.merchant,
|
||||
EventHistory: s.eventHistory,
|
||||
StateCheckpoints: s.stateCheckpoints,
|
||||
StateCheckpoints: lo.Map(s.stateCheckpoints, func(item StateCheckpoint, index int) StateCheckpoint {
|
||||
return StateCheckpoint{
|
||||
Session: nil,
|
||||
Events: item.Events,
|
||||
}
|
||||
}),
|
||||
CtxData: s.ctxData,
|
||||
LoadedMods: s.loadedMods,
|
||||
}
|
||||
@ -512,6 +517,14 @@ func (s *Session) SetEvent(id string) {
|
||||
if _, ok := s.resources.Events[id]; ok {
|
||||
s.eventHistory = append(s.eventHistory, id)
|
||||
_, _ = s.resources.Events[id].OnEnter.Call(CreateContext("type_id", id))
|
||||
} else {
|
||||
s.log.Println("Event not found:", id)
|
||||
s.currentEvent = ""
|
||||
|
||||
// If we can't find the event, we just go to the next state
|
||||
if s.state == GameStateEvent {
|
||||
s.SetGameState(GameStateRandom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user