Replace ExitTypeclass (XYZExit) with specified Typeclass in prototype.
This commit is contained in:
parent
cca49d30a5
commit
1b1145c1e6
2 changed files with 9 additions and 11 deletions
|
|
@ -1522,4 +1522,4 @@ class TestCallbacks(BaseEvenniaTest):
|
||||||
|
|
||||||
# Two rooms and 2 exits.
|
# Two rooms and 2 exits.
|
||||||
self.assertEqual(mock_room_callbacks.at_object_creation.mock_calls, [mock.call(), mock.call()])
|
self.assertEqual(mock_room_callbacks.at_object_creation.mock_calls, [mock.call(), mock.call()])
|
||||||
# self.assertEqual(mock_exit_callbacks.at_object_creation.mock_calls, [mock.call(), mock.call()])
|
self.assertEqual(mock_exit_callbacks.at_object_creation.mock_calls, [mock.call(), mock.call()])
|
||||||
|
|
|
||||||
|
|
@ -401,8 +401,13 @@ class MapNode:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
exitnode = self.links[direction]
|
exitnode = self.links[direction]
|
||||||
# TODO: Use specified Typeclass
|
prot = maplinks[key.lower()][3].prototype
|
||||||
exi, err = ExitTypeclass.create(
|
typeclass = prot.get("typeclass", "")
|
||||||
|
self.log(f" spawning/updating exit xyz={xyz}, direction={key} ({typeclass})")
|
||||||
|
|
||||||
|
Typeclass = class_from_module(typeclass,
|
||||||
|
fallback="evennia.contrib.grid.xyzgrid.xyzroom.XYZExit")
|
||||||
|
exi, err = Typeclass.create(
|
||||||
key,
|
key,
|
||||||
xyz=xyz,
|
xyz=xyz,
|
||||||
xyz_destination=exitnode.get_spawn_xyz(),
|
xyz_destination=exitnode.get_spawn_xyz(),
|
||||||
|
|
@ -410,15 +415,8 @@ class MapNode:
|
||||||
)
|
)
|
||||||
if err:
|
if err:
|
||||||
raise RuntimeError(err)
|
raise RuntimeError(err)
|
||||||
|
|
||||||
linkobjs[key.lower()] = exi
|
linkobjs[key.lower()] = exi
|
||||||
prot = maplinks[key.lower()][3].prototype
|
|
||||||
tclass = prot["typeclass"]
|
|
||||||
tclass = (
|
|
||||||
f" ({tclass})"
|
|
||||||
if tclass != "evennia.contrib.grid.xyzgrid.xyzroom.XYZExit"
|
|
||||||
else ""
|
|
||||||
)
|
|
||||||
self.log(f" spawning/updating exit xyz={xyz}, direction={key}{tclass}")
|
|
||||||
|
|
||||||
# apply prototypes to catch any changes
|
# apply prototypes to catch any changes
|
||||||
for key, linkobj in linkobjs.items():
|
for key, linkobj in linkobjs.items():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue