Пример #1
0
 def __init__(self, application):
     self.application = application
     self.object_db = {}
     GameVariables.add_callback(self.update_game_variables)
     self.register_mandatory_components()
     yaml.add_representer(RPGEntity, self.entity_representer,
                          yaml.SafeDumper)
     yaml.add_constructor('!Entity', self.entity_constructor,
                          yaml.SafeLoader)
     yaml.add_representer(helpers.DoublePointYaml,
                          helpers.double_point_representer,
                          yaml.SafeDumper)
     yaml.add_constructor("!DoublePoint",
                          helpers.double_point_constructor,
                          yaml.SafeLoader)
     yaml.add_representer(helpers.DoublePoint3DYaml,
                          helpers.double_point_3d_representer,
                          yaml.SafeDumper)
     yaml.add_constructor("!DoublePoint3D",
                          helpers.double_point_3d_constructor,
                          yaml.SafeLoader)
     World.__init__(self, application.engine)
     self.entities = RPGWorldEntitySet(self)
     self._full_extent = EntityExtent(self, self.entities)
     self._entity_delete_callbacks = set()
     self.__entity_cache = {}
Пример #2
0
 def __init__(self, application):
     self.application = application
     self.object_db = {}
     GameVariables.add_callback(self.update_game_variables)
     if not Agent.registered_as:
         Agent.register()
     if not FifeAgent.registered_as:
         FifeAgent.register()
     if not General.registered_as:
         General.register()
     yaml.add_representer(RPGEntity, self.entity_representer)
     yaml.add_constructor('!Entity', self.entity_constructor,
                          yaml.SafeLoader)
     World.__init__(self, application.engine)
Пример #3
0
 def create_world(self):
     """Creates the world used by this application"""
     self.world = RPGWorld(self)
     GameVariables.add_callback(self.update_game_variables)
     ScriptingSystem.register_command("set_global_lighting",
                                      self.set_global_lighting,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("get_global_lighting",
                                      self.get_global_lighting,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("is_location_in_region",
                                      self.is_location_in_region,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("is_agent_in_region",
                                      self.is_agent_in_region,
                                      _SCRIPTING_MODULE)
Пример #4
0
 def create_world(self):
     """Creates the world used by this application"""
     self.world = RPGWorld(self)
     GameVariables.add_callback(self.update_game_variables)
     ScriptingSystem.register_command("set_global_lighting",
                                      self.set_global_lighting,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("get_global_lighting",
                                      self.get_global_lighting,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("is_location_in_region",
                                      self.is_location_in_region,
                                      _SCRIPTING_MODULE)
     ScriptingSystem.register_command("is_agent_in_region",
                                      self.is_agent_in_region,
                                      _SCRIPTING_MODULE)