Beispiel #1
0
    def load_data(self, data):
        """
        Loads a dictionary containing saved Universe data onto the object.

        This method expects well-formed data. It will validate all fields and raise an exception if any of the data is
        invalid.

        Data layout:
            {
                "auxiliary": <dict>  # This will be passed to pantsmud.auxiliary.load_data
            }
        """
        self.core_star_system_uuids = set((uuid.UUID(s) for s in data["core_star_system_uuids"]))
        self.aux = auxiliary.load_data(self.aux, data["auxiliary"])
Beispiel #2
0
    def load_data(self, data):
        """
        Loads a dictionary containing saved Item data onto the object.

        This method expects well-formed data. It will validate all fields and raise an exception if any of the data is
        invalid.

        Data layout:
            {
                "uuid": "<uuid>",
                "name": "<word>",
                "auxiliary": <dict>  # This will be passed to pantsmud.auxiliary.load_data
            }
        """
        self.uuid = uuid.UUID(data["uuid"])
        self.name = data["name"]
        self.aux = auxiliary.load_data(self.aux, data["auxiliary"])
Beispiel #3
0
    def load_data(self, data):
        """
        Loads a dictionary containing saved Celestial data onto the object.

        This method expects well-formed data. It will validate all fields and raise an exception if any of the data is
        invalid.

        Data layout:
            {
                "uuid": "<uuid>",
                "name": "<string>",
                "star_system_uuid": "<uuid>",
                "auxiliary": <dict>  # This will be passed to pantsmud.auxiliary.load_data
            }
        """
        self.uuid = uuid.UUID(data["uuid"])
        self.name = data["name"]
        self.star_system_uuid = uuid.UUID(data["star_system_uuid"])
        self.coordinate = tuple(data["coordinate"])
        self.mass = int(data["mass"])
        self.radius = int(data["radius"])
        self.warp_radius = int(data["warp_radius"])
        self.aux = auxiliary.load_data(self.aux, data["auxiliary"])
Beispiel #4
0
    def load_data(self, data):
        """
        Loads a dictionary containing saved StarSystem data onto the object.

        This method expects well-formed data. It will validate all fields and raise an exception if any of the data is
        invalid.

        Data layout:
            {
                "uuid": "<uuid>",
                "name": "<name>",
                "core_celestial_uuids": ["<uuid>"],
                "link_uuids": ["<uuid>"],
                "reset_interval": <int>,
                "auxiliary": <dict>  # This will be passed to pantsmud.auxiliary.load_data
            }
        """
        self.uuid = uuid.UUID(data["uuid"])
        self.name = data["name"]
        self.core_celestial_uuids = set((uuid.UUID(s) for s in data["core_celestial_uuids"]))
        self.link_uuids = set((uuid.UUID(s) for s in data["link_uuids"]))
        self.reset_interval = data["reset_interval"]
        self.aux = auxiliary.load_data(self.aux, data["auxiliary"])
Beispiel #5
0
    def load_data(self, data):
        """
        Loads a dictionary containing saved Entity data onto the object.

        This method expects well-formed data. It will validate all fields and raise an exception if any of the data is
        invalid.

        Data layout:
            {
                "uuid": "<uuid>",
                "name": "<word>",
                "celestial_uuid": "<uuid>",
                "is_pilotable": <bool>,
                "is_warp_beacon": <bool>,
                "auxiliary": <dict>  # This will be passed to pantsmud.auxiliary.load_data
            }
        """
        self.uuid = uuid.UUID(data["uuid"])
        self.name = data["name"]
        self.celestial_uuid = uuid.UUID(data["celestial_uuid"])  # TODO This isn't safe if the Celestial no longer exists.
        self.is_pilotable = data["is_pilotable"]
        self.is_warp_beacon = data["is_warp_beacon"]
        self.aux = auxiliary.load_data(self.aux, data["auxiliary"])