Ejemplo n.º 1
0
    def __init__(self, id_prefix, pos=sc([0, 0, 0]), mass=100000.0):
        global id_count
        if type(pos) == sc:
            self.position = pos
        else:
            self.position = sc(pos)

        self.inventory = items.inventory()
        self.identifier = id_prefix + "-" + "%06i" % id_count
        self.heading = Quaternion()
        id_count += 1
        global objects
        objects.append(self)
        logging.info("New object: " + str(self))
Ejemplo n.º 2
0
    def __init__(self, position=sc([0, 0, 0])):
        super().__init__("ship", position)
        self.modules = {
            "radio":
            commands.radio(),
            "thruster":
            commands.thrusters(self),
            "rudder":
            commands.rudder(self, np.array([100000.0, 100000.0, 100000.0])),
            "ship":
            commands.ship_info(self),
            "log":
            commands.log(),
            "time":
            commands.timer(),
            "radar":
            commands.radar(self),
            "crew":
            commands.crew(self),
            "reactor":
            commands.reactor(self, 1000000000),
            "cargo":
            commands.cargo(self),
            "laser":
            commands.laser(self),
            "shield":
            commands.shield(self),
        }

        self.name = 'Восток'
        self.inventory.insert(items.item("uranium", 10.0))

        #Vector for telling  where ship is going
        self.velocity = np.array([0.0, 0.0, 0.0])
        self.thrust_acc = np.array([0.0, 0.0, 0.0])
Ejemplo n.º 3
0
    def __init__(self, position=sc([0, 0, 0])):
        super().__init__("ship", position)
        self.modules = {
            "radio":
            commands.radio(),
            "thrust_front":
            commands.thrusters(self, np.array([0.0, 0.0, -100000.0])),
            "thrust_back":
            commands.thrusters(self, np.array([0.0, 0.0, 500000.0])),
            "rudder":
            commands.rudder(self, np.array([100000.0, 100000.0, 100000.0])),
            "ship":
            commands.ship_info(self),
            "log":
            commands.log(),
            "time":
            commands.timer(),
            "radar":
            commands.radar(self),
            "crew":
            commands.crew(self),
            "generator":
            commands.generator(self, 1000000000),
            "cargo":
            commands.cargo(self),
            "laser":
            commands.laser(self),
        }

        self.name = 'Восток'

        #Vector for telling  where ship is going
        self.velocity = np.array([0.0, 0.0, 0.0])
        self.thrust_acc = np.array([0.0, 0.0, 0.0])
Ejemplo n.º 4
0
    def simulate(self, dt):

        self.thrust_acc = np.array([0.0, 0.0, 0.0])

        acceleration = self.heading.rotate(self.thrust_acc)

        self.velocity += acceleration * dt
        dpos = self.velocity * dt
        self.position += sc(dpos)
Ejemplo n.º 5
0
    def simulate(self, dt):

        self.thrust_acc = np.array([0.0, 0.0, 0.0])
        power_factor = self.calc_power()

        for module in self.modules:
            self.modules[module].simulate(dt, power_factor)

        self.velocity += self.getAcceleration() * dt
        dpos = self.velocity * dt
        self.position += sc(dpos)
Ejemplo n.º 6
0
    def __init__(self, position=sc([0, 0, 0])):
        super().__init__("ast", position)

        self.velocity = np.array([0.0, 0.0, 0.0])
        self.thrust_acc = np.array([0.0, 0.0, 0.0])

        self.inventory.insert(items.item("ice", np.random.rand() * 100000.0))
        self.inventory.insert(items.item("iron", np.random.rand() * 1000.0))
        self.inventory.insert(items.item("gold", np.random.rand() * 1000.0))
        self.inventory.insert(items.item("stone", np.random.rand() * 100000.0))
        self.inventory.insert(items.item("uranium", np.random.rand() * 10.0))
Ejemplo n.º 7
0
    def simulate(self, dt):

        self.thrust_acc = np.array([0.0, 0.0, 0.0])
        power_factor = self.calc_power()

        for module in self.modules:
            self.modules[module].simulate(dt, power_factor)

        #acceleration = np.array([0.0, 0.0, 0.0])
        acceleration = self.heading.rotate(self.thrust_acc)

        self.velocity += acceleration * dt
        dpos = self.velocity * dt
        self.position += sc(dpos)