Skip to content

Commit

Permalink
RESOLVE #85: Add coordinate, mass, radius, and warp radius to Celesti…
Browse files Browse the repository at this point in the history
…al. (#89)
  • Loading branch information
ecdavis committed Oct 20, 2016
1 parent 6736b49 commit 6ab6b70
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
12 changes: 12 additions & 0 deletions spacegame/universe/celestial.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def __init__(self):
self.universe = None
self.name = ""
self.star_system_uuid = None
self.coordinate = (0, 0, 0)
self.mass = 0
self.radius = 0
self.warp_radius = 0
self.aux = auxiliary.new_data(aux_types.AUX_TYPE_CELESTIAL)

def load_data(self, data):
Expand All @@ -32,6 +36,10 @@ def load_data(self, 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"])

def save_data(self):
Expand All @@ -42,6 +50,10 @@ def save_data(self):
"uuid": str(self.uuid),
"name": self.name,
"star_system_uuid": str(self.star_system_uuid),
"coordinate": self.coordinate,
"mass": self.mass,
"radius": self.radius,
"warp_radius": self.warp_radius,
"auxiliary": auxiliary.save_data(self.aux)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"star_system_uuid": "cbde4247-6780-465b-b81c-2b52e61efa2e",
"auxiliary": {},
"uuid": "f5102606-bacc-4055-8e64-600efb874985",
"star_system_uuid": "cbde4247-6780-465b-b81c-2b52e61efa2e",
"auxiliary": {},
"uuid": "f5102606-bacc-4055-8e64-600efb874985",
"coordinate": [
0,
0,
0
],
"mass": 0,
"radius": 0,
"warp_radius": 0,
"name": "Earth"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"star_system_uuid": "99707042-84df-404a-8475-d73afe6b88ef",
"auxiliary": {},
"uuid": "35b81fc4-0313-4fac-9054-7f8cc05cf092",
"uuid": "35b81fc4-0313-4fac-9054-7f8cc05cf092",
"coordinate": [
0,
0,
0
],
"mass": 0,
"radius": 0,
"warp_radius": 0,
"name": "Alpha Centauri"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"star_system_uuid": "cbde4247-6780-465b-b81c-2b52e61efa2e",
"auxiliary": {},
"uuid": "a74b22ea-6aa1-4410-b819-32a1b6c6613f",
"uuid": "a74b22ea-6aa1-4410-b819-32a1b6c6613f",
"coordinate": [
0,
0,
0
],
"mass": 0,
"radius": 0,
"warp_radius": 0,
"name": "Sol"
}

0 comments on commit 6ab6b70

Please sign in to comment.