Basic station classes

This commit is contained in:
harmacist 2021-05-29 23:32:03 -05:00
parent 60011b16b9
commit e676d1d51e
5 changed files with 82 additions and 0 deletions

0
README.md Normal file
View File

10
src/main.py Normal file
View File

@ -0,0 +1,10 @@
def hello():
print("""Welcome to Terminus.
This is the idea of a game, wherein you are responsible for managing and maintaining a space station.
Send out missions to gather resources, stake claims, or commit politics!
What will your intergalactic legacy be?""")
if __name__ == '__main__':
hello()

44
src/module.py Normal file
View File

@ -0,0 +1,44 @@
from resource import Oxygen, Power
from position import Position
from enum import Enum
class Module:
def __init__(self, name, oxygen=Oxygen(), power=Power(), parent=None, position=None):
self.name = name
self.Oxygen = oxygen
self.Power = power
self.Parent = parent
self.Position = position
self.Connections = []
class Connection:
class Direction(Enum):
A_TO_B = 1
B_TO_A = 2
TWO_WAY = 0
def __init__(self,
from_module: Module,
to_module: Module,
resources: list,
direction: Direction = Direction.A_TO_B):
self.FROM = from_module
self.TO = to_module
self.RESOURCES = resources
self.DIRECTION = direction
class Core(Module):
def __init__(self, station_name, name):
super().__init__(name)
self.name = station_name
self.Power.rate = 50
self.Modules = []
self.Parent = self
def __str__(self):
return f"{self.name}: {self.Oxygen.amount} Oxygen, {self.Power.amount} Power"

14
src/position.py Normal file
View File

@ -0,0 +1,14 @@
class Position:
def __init__(self, x, y, z):
self.X = x
self.Y = y
self.Z = z
def move(self, x=0, y=0, z=0):
self.X += x
self.Y += y
self.Z += z
def __str__(self):
return f"X: {self.X}, Y: {self.Y}, Z: {self.Z}"

14
src/resource.py Normal file
View File

@ -0,0 +1,14 @@
class Resource:
def __init__(self, amount=0, rate=0):
self.rate = rate
self.amount = amount
class Oxygen(Resource):
pass
class Power(Resource):
pass