Ejemplo n.º 1
0
 def setup(self):
     spmf = ShipPartModelFactory()
     null_offset = MutableOffsets(0, 0, 0)
     null_rotation = MutableDegrees(0, 0, 0)
     target = spmf.manufacture("generator", position=(10, 0, 0))
     cockpit = spmf.manufacture("cockpit")
     parts = {cockpit, target}
     self.ship = ShipModel("foo", parts, null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__())
     self.drydock = Drydock(0,
                            1000,
                            0,
                            1000,
                            self.ship,
                            view_factory=FakeFactory())
     self.ship = self.drydock.ship
     self.target_item: DockableItem = [
         item for item in self.drydock.items
         if item.model.name == "generator"
     ][0]
     self.target_item.held = True
     self.target_item._highlight = True
     self.target = self.target_item.model
     self.cockpit_item: DockableItem = [
         item for item in self.drydock.items if item.model.name == "cockpit"
     ][0]
     self.cockpit = self.cockpit_item.model
     self.ship_rebuild_callback = MagicMock()
     self.ship.observe(self.ship_rebuild_callback, "rebuild")
     self.target_callback = MagicMock()
     self.target.observe(self.target_callback, "move")
Ejemplo n.º 2
0
 def setup(self):
     spmf = ShipPartModelFactory()
     null_offset = MutableOffsets(0, 0, 0)
     null_rotation = MutableDegrees(0, 0, 0)
     self.target = spmf.manufacture("shield", position=(10, 0, 0))
     self.other = spmf.manufacture("shield")
     parts = {self.other, self.target}
     self.ship = ShipModel("foo", parts, null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__())
Ejemplo n.º 3
0
 def setup(self):
     spmf = ShipPartModelFactory()
     null_offset = MutableOffsets(0, 0, 0)
     null_rotation = MutableDegrees(0, 0, 0)
     self.generator = spmf.manufacture("generator", position=(1.5, 0, 0))
     self.cockpit = spmf.manufacture("cockpit")
     parts = {self.cockpit, self.generator}
     self.ship = ShipModel("foo", parts, null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__())
     self.target = list(self.ship._connections)[0]
Ejemplo n.º 4
0
 def setup(self):
     spmf = ShipPartModelFactory()
     null_offset = MutableOffsets(0, 0, 0)
     null_rotation = MutableDegrees(0, 0, 0)
     self.shield1 = spmf.manufacture("shield", position=(2, 0, 0))
     self.obstacles = {
         spmf.manufacture("generator", position=(0, 0, y))
         for y in range(-4, 4)
     }
     self.shield2 = spmf.manufacture("shield", position=(-2, 0, 0))
     parts = self.obstacles | {self.shield1, self.shield2}
     self.ship = ShipModel("foo", parts, null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__())
Ejemplo n.º 5
0
 def setup(self):
     spmf = ShipPartModelFactory()
     null_offset = MutableOffsets(0, 0, 0)
     null_rotation = MutableDegrees(0, 0, 0)
     self.shield1 = spmf.manufacture("shield", position=(2.5, 0, 0))
     self.obstacles = {spmf.manufacture("generator", position=(0, 0, 0))}
     self.shield2 = spmf.manufacture("shield", position=(-2.5, 0, 0))
     parts = self.obstacles | {self.shield1, self.shield2}
     self.ship = ShipModel("foo", parts, null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__(),
                           null_rotation.__copy__(), null_offset.__copy__())
     self.target = [
         c for c in self.ship._connections
         if set(c._ship_parts) == {self.shield1, self.shield2}
     ][0]
Ejemplo n.º 6
0
 def manufacture(self, name, position: MutableOffsets,
                 rotation: MutableDegrees, movement: MutableOffsets,
                 spin: MutableDegrees, acceleration: MutableOffsets,
                 torque: MutableDegrees) -> PlasmaModel:
     if self.projectiles[name]:
         return self.repurpose(name, position, rotation, movement, spin,
                               acceleration, torque)
     #  config = deepcopy(self.projectiles[name])
     bounding_box = MultiPolygon.manufacture([(-.1, -.1), (.1, -.1),
                                              (.1, .1), (-.1, .1)],
                                             x=position.x,
                                             y=position.z,
                                             rotation=rotation.yaw)
     projectile = PlasmaModel(position.__copy__(), rotation.__copy__(),
                              movement.__copy__(), spin.__copy__(),
                              acceleration.__copy__(), torque.__copy__(),
                              bounding_box)
     return projectile