Skip to content

Commit aae2f70

Browse files
committed
Flag Touch Switches: don't crash if in a map that wasn't processed by map data processors
That's a simple check that will allow for some rooms with flag touch switches to be included in the randomizer.
1 parent be1b7a3 commit aae2f70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Entities/FlagTouchSwitch.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ private void turnOn() {
207207
level.Session.SetFlag(flag + "_switch" + id, true);
208208
}
209209

210-
if (SpringCollab2020MapDataProcessor.FlagTouchSwitches[level.Session.Area.ID][(int) level.Session.Area.Mode][flag]
211-
.All(touchSwitchID => touchSwitchID.Level == level.Session.Level || level.Session.GetFlag(flag + "_switch" + touchSwitchID.ID))
210+
if ((SpringCollab2020MapDataProcessor.FlagTouchSwitches.Count <= level.Session.Area.ID
211+
|| SpringCollab2020MapDataProcessor.FlagTouchSwitches[level.Session.Area.ID][(int) level.Session.Area.Mode][flag]
212+
.All(touchSwitchID => touchSwitchID.Level == level.Session.Level || level.Session.GetFlag(flag + "_switch" + touchSwitchID.ID)))
212213
&& allTouchSwitchesInRoom.All(touchSwitch => touchSwitch.activated)) {
213214

214215
// all switches in the room are enabled, and all session flags for switches outside the room are enabled.

0 commit comments

Comments
 (0)