mirror of
https://github.com/solero/houdini.git
synced 2024-11-14 14:48:21 +00:00
Setup default penguin string builders on server boot
This commit is contained in:
parent
691040c9e0
commit
550704132b
@ -57,6 +57,7 @@ class HoudiniFactory:
|
|||||||
|
|
||||||
self.client_class = Spheniscidae
|
self.client_class = Spheniscidae
|
||||||
self.penguin_string_compiler = None
|
self.penguin_string_compiler = None
|
||||||
|
self.anonymous_penguin_string_compiler = None
|
||||||
|
|
||||||
self.penguins_by_id = {}
|
self.penguins_by_id = {}
|
||||||
self.penguins_by_username = {}
|
self.penguins_by_username = {}
|
||||||
@ -135,6 +136,10 @@ class HoudiniFactory:
|
|||||||
|
|
||||||
self.client_class = Penguin
|
self.client_class = Penguin
|
||||||
self.penguin_string_compiler = PenguinStringCompiler()
|
self.penguin_string_compiler = PenguinStringCompiler()
|
||||||
|
self.anonymous_penguin_string_compiler = PenguinStringCompiler()
|
||||||
|
|
||||||
|
PenguinStringCompiler.setup_default_builder(self.penguin_string_compiler)
|
||||||
|
PenguinStringCompiler.setup_anonymous_default_builder(self.anonymous_penguin_string_compiler)
|
||||||
|
|
||||||
self.load_handler_modules(exclude_load="Houdini.Handlers.Login.Login")
|
self.load_handler_modules(exclude_load="Houdini.Handlers.Login.Login")
|
||||||
self.logger.info('World server started')
|
self.logger.info('World server started')
|
||||||
|
@ -3,7 +3,8 @@ from Houdini.Spheniscidae import Spheniscidae
|
|||||||
|
|
||||||
class Penguin(Spheniscidae):
|
class Penguin(Spheniscidae):
|
||||||
|
|
||||||
__slots__ = ['x', 'y', 'room', 'waddle', 'table', 'data']
|
__slots__ = ['x', 'y', 'room', 'waddle', 'table', 'data', 'member',
|
||||||
|
'membership_days', 'avatar', 'walking_puffle']
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
super().__init__(*args)
|
super().__init__(*args)
|
||||||
@ -15,8 +16,27 @@ class Penguin(Spheniscidae):
|
|||||||
|
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
|
self.member = None
|
||||||
|
self.membership_days = 0
|
||||||
|
|
||||||
|
self.avatar = None
|
||||||
|
|
||||||
|
self.walking_puffle = None
|
||||||
|
|
||||||
self.logger.debug('New penguin created')
|
self.logger.debug('New penguin created')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def party_state(self):
|
||||||
|
return str()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def puffle_state(self):
|
||||||
|
return str()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def penguin_state(self):
|
||||||
|
return str()
|
||||||
|
|
||||||
async def add_inventory(self, item):
|
async def add_inventory(self, item):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -38,3 +38,42 @@ class PenguinStringCompiler(OrderedDict):
|
|||||||
async def attribute_method(p):
|
async def attribute_method(p):
|
||||||
return getattr(p.data, attribute_name)
|
return getattr(p.data, attribute_name)
|
||||||
return attribute_method
|
return attribute_method
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setup_default_builder(cls, string_builder):
|
||||||
|
string_builder.update({
|
||||||
|
'ID': PenguinStringCompiler.data_attribute_by_name('ID'),
|
||||||
|
'Nickname': PenguinStringCompiler.data_attribute_by_name('Nickname'),
|
||||||
|
'Approval': PenguinStringCompiler.attribute_by_name('approval'),
|
||||||
|
'Color': PenguinStringCompiler.data_attribute_by_name('Color'),
|
||||||
|
'Head': PenguinStringCompiler.data_attribute_by_name('Head'),
|
||||||
|
'Face': PenguinStringCompiler.data_attribute_by_name('Face'),
|
||||||
|
'Neck': PenguinStringCompiler.data_attribute_by_name('Neck'),
|
||||||
|
'Body': PenguinStringCompiler.data_attribute_by_name('Body'),
|
||||||
|
'Hand': PenguinStringCompiler.data_attribute_by_name('Name'),
|
||||||
|
'Photo': PenguinStringCompiler.data_attribute_by_name('Photo'),
|
||||||
|
'X': PenguinStringCompiler.attribute_by_name('x'),
|
||||||
|
'Y': PenguinStringCompiler.attribute_by_name('y'),
|
||||||
|
'Frame': PenguinStringCompiler.attribute_by_name('frame'),
|
||||||
|
'Member': PenguinStringCompiler.attribute_by_name('member'),
|
||||||
|
'MemberDays': PenguinStringCompiler.attribute_by_name('membership_days'),
|
||||||
|
'Avatar': PenguinStringCompiler.attribute_by_name('avatar'),
|
||||||
|
'PenguinState': PenguinStringCompiler.attribute_by_name('penguin_state'),
|
||||||
|
'PartyState': PenguinStringCompiler.attribute_by_name('party_state'),
|
||||||
|
'PuffleState': PenguinStringCompiler.attribute_by_name('puffle_state')
|
||||||
|
})
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setup_anonymous_default_builder(cls, string_builder):
|
||||||
|
string_builder.update({
|
||||||
|
'ID': PenguinStringCompiler.attribute_by_name('ID'),
|
||||||
|
'Nickname': PenguinStringCompiler.attribute_by_name('Nickname'),
|
||||||
|
'Approval': PenguinStringCompiler.attribute_by_name('approval'),
|
||||||
|
'Color': PenguinStringCompiler.attribute_by_name('Color'),
|
||||||
|
'Head': PenguinStringCompiler.attribute_by_name('Head'),
|
||||||
|
'Face': PenguinStringCompiler.attribute_by_name('Face'),
|
||||||
|
'Neck': PenguinStringCompiler.attribute_by_name('Neck'),
|
||||||
|
'Body': PenguinStringCompiler.attribute_by_name('Body'),
|
||||||
|
'Hand': PenguinStringCompiler.attribute_by_name('Name'),
|
||||||
|
'Photo': PenguinStringCompiler.attribute_by_name('Photo')
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user