mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 12:56:30 +01:00
Some tweaks to xyzgrid error handling, as part of debugging #3475
This commit is contained in:
parent
3537365e3c
commit
201ffc0da5
2 changed files with 12 additions and 5 deletions
|
|
@ -20,11 +20,11 @@ import uuid
|
|||
from collections import defaultdict
|
||||
|
||||
from django.core import exceptions as django_exceptions
|
||||
|
||||
from evennia.prototypes import spawner
|
||||
from evennia.utils.utils import class_from_module
|
||||
|
||||
from .utils import BIGVAL, MAPSCAN, REVERSE_DIRECTIONS, MapError, MapParserError
|
||||
from .utils import (BIGVAL, MAPSCAN, REVERSE_DIRECTIONS, MapError,
|
||||
MapParserError)
|
||||
|
||||
NodeTypeclass = None
|
||||
ExitTypeclass = None
|
||||
|
|
@ -327,6 +327,12 @@ class MapNode:
|
|||
nodeobj, err = Typeclass.create(self.prototype.get("key", "An empty room"), xyz=xyz)
|
||||
if err:
|
||||
raise RuntimeError(err)
|
||||
except django_exceptions.MultipleObjectsReturned:
|
||||
raise MapError(
|
||||
f"Multiple objects found: {NodeTypeclass.objects.filter_xyz(xyz=xyz)}. "
|
||||
"This may be due to manual creation of XYZRooms at this position. "
|
||||
"Delete duplicates.", self
|
||||
)
|
||||
else:
|
||||
self.log(f" updating existing room (if changed) at xyz={xyz}")
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ used as stand-alone XYZ-coordinate-aware rooms.
|
|||
|
||||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
|
||||
from evennia.objects.manager import ObjectManager
|
||||
from evennia.objects.objects import DefaultExit, DefaultRoom
|
||||
|
||||
|
|
@ -308,7 +307,8 @@ class XYZRoom(DefaultRoom):
|
|||
def xyzgrid(self):
|
||||
global GET_XYZGRID
|
||||
if not GET_XYZGRID:
|
||||
from evennia.contrib.grid.xyzgrid.xyzgrid import get_xyzgrid as GET_XYZGRID
|
||||
from evennia.contrib.grid.xyzgrid.xyzgrid import \
|
||||
get_xyzgrid as GET_XYZGRID
|
||||
return GET_XYZGRID()
|
||||
|
||||
@property
|
||||
|
|
@ -532,7 +532,8 @@ class XYZExit(DefaultExit):
|
|||
def xyzgrid(self):
|
||||
global GET_XYZGRID
|
||||
if not GET_XYZGRID:
|
||||
from evennia.contrib.grid.xyzgrid.xyzgrid import get_xyzgrid as GET_XYZGRID
|
||||
from evennia.contrib.grid.xyzgrid.xyzgrid import \
|
||||
get_xyzgrid as GET_XYZGRID
|
||||
return GET_XYZGRID()
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue