forked from op-hui/mu2ch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
27 lines (21 loc) · 1.13 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
# Соединяет две локации
from evennia import create_object
from evennia import settings
from evennia import utils
def locationTunnel(location1, location1_exit_name, location2, location2_exit_name):
exit1 = location2_exit_name if (location2_exit_name) else location2.key
exit2 = location1_exit_name if (location1_exit_name) else location1.key
print "Create tunnel between '%s' and '%s'" % ( exit1, exit2 )
exit1 = create_object(settings.BASE_EXIT_TYPECLASS, exit1, location = location1, destination = location2)
exit2 = create_object(settings.BASE_EXIT_TYPECLASS, exit2, location = location2, destination = location1)
return [ exit1, exit2 ]
def locationTunnelDefault(location1, location2):
return locationTunnel(location1, None, location2, None)
def isCharacter(obj):
return utils.inherits_from(obj, 'typeclasses.character.Character')
def isBuildingLocation(obj):
return obj.__class__.__name__ == 'Building' or \
obj.__class__.__name__ == 'BuildingFloor' or \
obj.__class__.__name__ == 'Box' or \
utils.inherits_from(obj, 'BuildingApartment')