From e676d1d51eb5f23c25e735f15f6af46a24422239 Mon Sep 17 00:00:00 2001 From: harmacist Date: Sat, 29 May 2021 23:32:03 -0500 Subject: [PATCH] Basic station classes --- README.md | 0 src/main.py | 10 ++++++++++ src/module.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/position.py | 14 ++++++++++++++ src/resource.py | 14 ++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 README.md create mode 100644 src/main.py create mode 100644 src/module.py create mode 100644 src/position.py create mode 100644 src/resource.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..dc5b4c1 --- /dev/null +++ b/src/main.py @@ -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() diff --git a/src/module.py b/src/module.py new file mode 100644 index 0000000..118b7a7 --- /dev/null +++ b/src/module.py @@ -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" diff --git a/src/position.py b/src/position.py new file mode 100644 index 0000000..edc542f --- /dev/null +++ b/src/position.py @@ -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}" diff --git a/src/resource.py b/src/resource.py new file mode 100644 index 0000000..2cd7985 --- /dev/null +++ b/src/resource.py @@ -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