Prevent duplicate entrance entries

This commit is contained in:
codemann8
2024-12-17 06:26:07 -06:00
parent 60c1334c27
commit a5d572a41c
2 changed files with 5 additions and 2 deletions

View File

@@ -1843,7 +1843,8 @@ class Entrance(object):
self.target = target
self.addresses = addresses
self.vanilla = vanilla
region.entrances.append(self)
if self not in region.entrances:
region.entrances.append(self)
def __str__(self):
return str(self.__unicode__())

View File

@@ -863,7 +863,9 @@ def copy_world_premature(world, player):
for location in copied_region.locations:
location.parent_region = copied_region
for entrance in region.entrances:
copied_region.entrances.append(ret.get_entrance(entrance.name, entrance.player))
ent = ret.get_entrance(entrance.name, entrance.player)
if ent not in copied_region.entrances:
copied_region.entrances.append(ent)
for exit in region.exits:
if exit.connected_region:
dest_region = ret.get_region(exit.connected_region.name, region.player)