mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 16:56:32 +01:00
Replace ExitTypeclass (XYZExit) with specified Typeclass in prototype.
This commit is contained in:
parent
0e91c21488
commit
865babb357
2 changed files with 9 additions and 11 deletions
|
|
@ -1522,4 +1522,4 @@ class TestCallbacks(BaseEvenniaTest):
|
|||
|
||||
# Two rooms and 2 exits.
|
||||
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
|
||||
|
||||
exitnode = self.links[direction]
|
||||
# TODO: Use specified Typeclass
|
||||
exi, err = ExitTypeclass.create(
|
||||
prot = maplinks[key.lower()][3].prototype
|
||||
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,
|
||||
xyz=xyz,
|
||||
xyz_destination=exitnode.get_spawn_xyz(),
|
||||
|
|
@ -410,15 +415,8 @@ class MapNode:
|
|||
)
|
||||
if err:
|
||||
raise RuntimeError(err)
|
||||
|
||||
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
|
||||
for key, linkobj in linkobjs.items():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue