trolley: fix new district crash when requesting a minigame

This commit is contained in:
demiurgeQuantified 2023-05-19 23:43:37 +01:00
parent 5be4056d2f
commit 5814facc54

View file

@ -335,7 +335,7 @@ class Minigame(MagicWord):
mgId = None
mgDiff = None if difficulty == 0 else difficulty
mgKeep = None
mgSzId = ZoneUtil.getSafeZoneId(toon.zoneId)
mgSzId = ZoneUtil.getSafeZoneId(toon.zoneId) if isTeleport else None
if not any ((isTeleport, isRequest)):
return f"Unknown command or minigame \"{command}\". Valid commands: \"teleport\", \"request\", or a minigame to automatically teleport or request"
@ -350,9 +350,11 @@ class Minigame(MagicWord):
mgId = ToontownGlobals.MinigameNames.get(minigame)
if any((isTeleport, isRequest)):
if isTeleport and (ZoneUtil.isDynamicZone(toon.zoneId) or not toon.zoneId == mgSzId):
return "Target needs to be in a playground to teleport to a minigame."
MinigameCreatorAI.RequestMinigame[avId] = (mgId, mgKeep, mgDiff, ToontownGlobals.ToontownCentral if ZoneUtil.isWelcomeValley(mgSzId) else mgSzId)
if isTeleport:
if ZoneUtil.isDynamicZone(toon.zoneId) or not toon.zoneId == mgSzId:
return "Target needs to be in a playground to teleport to a minigame."
mgSzId = ToontownGlobals.ToontownCentral if ZoneUtil.isWelcomeValley(mgSzId) else mgSzId
MinigameCreatorAI.RequestMinigame[avId] = (mgId, mgKeep, mgDiff, mgSzId)
if isTeleport:
try:
result = MinigameCreatorAI.createMinigame(self.air, [avId], mgSzId)