OK, this is looking good.
The infinite skills hotkey method now checks for an existing Infinite Skills replay event prior to the current frame as its first and foremost priority.
If it finds one (and, it only cares about the
very first if there are multiple existing events for any reason), it then:
- Logs the Infinite Skills event frame
- Skips back to that frame
- Deletes all future existing Infinite Skills replay events (important, so that the state isn't triggered again by a future event)
- Resets all skill counts to (the original count - any skills used (N.B. all skill assignments are preserved))
- Sets the InfiniteSkillsMode flag to false
If it doesn't find one, it then:
- Sets all skill counts to infinite
- Sets the InfiniteSkillsMode flag to true
- Records the event in the replay
Meanwhile, if an event is found whilst playing back a replay, the skill counts are all set to infinite and the InfiniteSkillsMode flag is set to true.
Also, toggling Infinite Skills on doesn't cancel the existing replay - so, if at any point a player wants to go back and reactivate Infinite Skills after deactivating it, all future skill assignments will play out as normal. And of course, if the mode is toggled off, assignments made beyond the original skill count being exhausted simply won't play out (but will be preserved in the replay).
Next steps:
1) Check for InfiniteSkillsMode when setting level records. If true, count the level as attempted but not passed, and do not save any user records for lems saved, time, skill counts, etc. If false, proceed as normal.
2) Check for InfiniteSkillsMode in postview. Display the text "This level was played in Infinite Skills mode - Go back and try again some other time" (or something similar) in place of the usual "You saved every lemming on that level, etc".
3) The Infinite Skills replay events are currently not displayed in the replay editor form, despite everything to do with replays working correctly elsewhere - find out why, make sure the events are displayed.