diff --git a/plugins/minigames/castel_queen.py b/plugins/minigames/castel_queen.py index 02986ce..df86368 100644 --- a/plugins/minigames/castel_queen.py +++ b/plugins/minigames/castel_queen.py @@ -26,9 +26,12 @@ if TYPE_CHECKING: from typing import Any, Sequence, Dict, Type, List, Optional, Union # ba_meta export game + + class ChooseQueen(KeepAwayGame): name = 'FCUK The Queen' description = 'Carry the queen for a set length of time' + @classmethod def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: return issubclass(sessiontype, ba.DualTeamSession) @@ -42,7 +45,7 @@ class ChooseQueen(KeepAwayGame): def get_instance_description_short(self) -> str | Sequence: return 'FCUK the queen for ${ARG1} seconds', self._hold_time - + def __init__(self, settings: dict): super().__init__(settings) shared = SharedObjects.get() @@ -99,7 +102,7 @@ class ChooseQueen(KeepAwayGame): self._flag = spaz.Spaz((0, 0, 0), character="Pixel").autoretain() self._flag.handlemessage(ba.StandMessage((0, 14.63, -5.52), 93)) self._flag.node.hold_position_pressed = True - self._flag.node.materials = (self._queen_material,shared.object_material) + self._flag.node.materials = (self._queen_material, shared.object_material) # self._flag.node.extras_material= tuple(list(self._flag.node.extras_material).append(self._queen_materia)) self._flag.hitpoints = 5000 self._flag.hitpoints_max = 5000 diff --git a/plugins/minigames/demolition_war.py b/plugins/minigames/demolition_war.py index 31f2abe..1c26433 100644 --- a/plugins/minigames/demolition_war.py +++ b/plugins/minigames/demolition_war.py @@ -22,6 +22,8 @@ if TYPE_CHECKING: from typing import Any, Sequence # ba_meta export game + + class DemolitionWar(EliminationGame): name = 'DemolitionWar' description = 'Last remaining alive wins.' @@ -121,7 +123,7 @@ class DemolitionWar(EliminationGame): (0, 2, 0), 30, 1, spread=1, chunk_type='splinter') ba.timer(0.1, ba.Call(node.delete)) - def map_extend(self): + def map_extend(self): # TODO need to improve here , so we can increase size of map easily with settings p = [-6, -4.3, -2.6, -0.9, 0.8, 2.5, 4.2, 5.9] q = [-4, -2.3, -0.6, 1.1, 2.8, 4.5] @@ -186,7 +188,6 @@ class DemolitionWar(EliminationGame): return ud_1_r - class mapdefs: points = {} # noinspection PyDictCreation @@ -203,9 +204,9 @@ class mapdefs: points['flag2'] = (11.01486398, 0.03986567039, 0.1095578275) points['flag_default'] = (-0.1001374046, 0.04180340146, 0.1095578275) boxes['goal1'] = (12.22454533, 1.0, - 0.1087926362) + (0.0, 0.0, 0.0) + (2.0, 2.0, 12.97466313) + 0.1087926362) + (0.0, 0.0, 0.0) + (2.0, 2.0, 12.97466313) boxes['goal2'] = (-12.15961605, 1.0, - 0.1097860203) + (0.0, 0.0, 0.0) + (2.0, 2.0, 13.11856424) + 0.1097860203) + (0.0, 0.0, 0.0) + (2.0, 2.0, 13.11856424) boxes['map_bounds'] = (0.0, 1.185751251, 0.4326226188) + (0.0, 0.0, 0.0) + ( 42.09506485, 22.81173179, 29.76723155) points['powerup_spawn1'] = (5.414681236, 0.9515026107, -5.037912441) @@ -215,6 +216,8 @@ class mapdefs: points['spawn1'] = (-10.03866341, 0.02275111462, 0.0) + (0.5, 1.0, 4.0) points['spawn2'] = (9.823107149, 0.01092306765, 0.0) + (0.5, 1.0, 4.0) points['tnt1'] = (-0.08421587483, 0.9515026107, -0.7762602271) + + class WoodenFloor(ba.Map): """Stadium map for football games.""" defs = mapdefs @@ -261,13 +264,13 @@ class WoodenFloor(ba.Map): 'color_texture': self.preloaddata['model_bg_tex'] }) self.vr = ba.newnode('terrain', - attrs={ - 'model': self.preloaddata['bg_vr_fill_model'], - 'lighting': False, - 'vr_only': True, - 'background': True, - 'color_texture': self.preloaddata['model_bg_tex'] - }) + attrs={ + 'model': self.preloaddata['bg_vr_fill_model'], + 'lighting': False, + 'vr_only': True, + 'background': True, + 'color_texture': self.preloaddata['model_bg_tex'] + }) gnode = ba.getactivity().globalsnode gnode.tint = (1.3, 1.2, 1.0) gnode.ambient_color = (1.3, 1.2, 1.0) @@ -276,7 +279,6 @@ class WoodenFloor(ba.Map): gnode.vr_camera_offset = (0, -0.8, -1.1) gnode.vr_near_clip = 0.5 - def is_point_near_edge(self, point: ba.Vec3, running: bool = False) -> bool: @@ -296,8 +298,7 @@ class WoodenFloor(ba.Map): player.shatter(True) - try: ba._map.register_map(WoodenFloor) except: - pass \ No newline at end of file + pass diff --git a/plugins/minigames/drone_war.py b/plugins/minigames/drone_war.py index b27276a..4877afa 100644 --- a/plugins/minigames/drone_war.py +++ b/plugins/minigames/drone_war.py @@ -31,6 +31,8 @@ STORAGE_ATTR_NAME = f'_shared_{__name__}_factory' # SMoothy's Drone (fixed version of floater) with rocket launcher # use drone as long as you want , unlike floater which dies after being idle. + + class Drone(ba.Actor): def __init__(self, spaz): super().__init__() @@ -60,137 +62,149 @@ class Drone(ba.Actor): self.node = ba.newnode( 'prop', delegate=self, - owner = None, + owner=None, attrs={ 'position': spaz.node.position, - 'model':ba.getmodel('landMine'), - 'light_model':ba.getmodel('landMine'), - 'body':'landMine', - 'body_scale':1, - 'model_scale':1, - 'shadow_size':0.25, - 'density':999999, - 'gravity_scale':0.0, - 'color_texture':ba.gettexture('achievementCrossHair'), - 'reflection':'soft', + 'model': ba.getmodel('landMine'), + 'light_model': ba.getmodel('landMine'), + 'body': 'landMine', + 'body_scale': 1, + 'model_scale': 1, + 'shadow_size': 0.25, + 'density': 999999, + 'gravity_scale': 0.0, + 'color_texture': ba.gettexture('achievementCrossHair'), + 'reflection': 'soft', 'reflection_scale': [0.25], - 'materials':[shared.footing_material, self._drone_material] - }) + 'materials': [shared.footing_material, self._drone_material] + }) self.grab_node = ba.newnode( 'prop', owner=self.node, attrs={ 'position': (0, 0, 0), - 'body':'sphere', + 'body': 'sphere', 'model': None, - 'color_texture':None, - 'body_scale':0.2, - 'reflection':'powerup', - 'density':999999, + 'color_texture': None, + 'body_scale': 0.2, + 'reflection': 'powerup', + 'density': 999999, 'reflection_scale': [1.0], - 'model_scale':0.2, - 'gravity_scale':0, - 'shadow_size':0.1, - 'is_area_of_interest':True, - 'materials':[shared.object_material, self._drone_material] + 'model_scale': 0.2, + 'gravity_scale': 0, + 'shadow_size': 0.1, + 'is_area_of_interest': True, + 'materials': [shared.object_material, self._drone_material] }) self.node.connectattr('position', self.grab_node, 'position') - self._rcombine=ba.newnode('combine', - owner=self.node, - attrs={ - 'input0':self.spaz.node.position[0], - 'input1':self.spaz.node.position[1]+3, - 'input2':self.spaz.node.position[2], - 'size':3 - }) + self._rcombine = ba.newnode('combine', + owner=self.node, + attrs={ + 'input0': self.spaz.node.position[0], + 'input1': self.spaz.node.position[1]+3, + 'input2': self.spaz.node.position[2], + 'size': 3 + }) + + self._rcombine.connectattr('output', self.node, 'position') - self._rcombine.connectattr('output',self.node,'position') def set_rocket_launcher(self, launcher: RocketLauncher): self.rocket_launcher = launcher + def fire(self): - if hasattr(self.grab_node,"position"): - self.rocket_launcher.shot(self.spaz, self.x_direction, self.z_direction , (self.grab_node.position[0], self.grab_node.position[1] -1, self.grab_node.position[2])) + if hasattr(self.grab_node, "position"): + self.rocket_launcher.shot(self.spaz, self.x_direction, self.z_direction, ( + self.grab_node.position[0], self.grab_node.position[1] - 1, self.grab_node.position[2])) + def ascend(self): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input1',{ - 0:self.node.position[1], - 1:self.node.position[1] + 2 - }) + ba.animate(self._rcombine, 'input1', { + 0: self.node.position[1], + 1: self.node.position[1] + 2 + }) loop() - self.loop_ascend = ba.Timer(1, loop , repeat = True) - + self.loop_ascend = ba.Timer(1, loop, repeat=True) + def pause_movement(self): self.loop_ascend = None + def decend(self): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input1',{ - 0:self.node.position[1], - 1:self.node.position[1] - 2 - }) + ba.animate(self._rcombine, 'input1', { + 0: self.node.position[1], + 1: self.node.position[1] - 2 + }) loop() - self.loop_ascend = ba.Timer(1, loop , repeat = True ) + self.loop_ascend = ba.Timer(1, loop, repeat=True) + def pause_lr(self): self.loop_lr = None + def pause_ud(self): self.loop_ud = None - def left_(self, value = -1): + + def left_(self, value=-1): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input0',{ - 0:self.node.position[0], - 1:self.node.position[0] + 2 * value - }) + ba.animate(self._rcombine, 'input0', { + 0: self.node.position[0], + 1: self.node.position[0] + 2 * value + }) if value == 0.0: self.loop_lr = None else: self.x_direction = value self.z_direction = 0 loop() - self.loop_lr = ba.Timer(1, loop , repeat = True ) - def right_(self, value = 1): + self.loop_lr = ba.Timer(1, loop, repeat=True) + + def right_(self, value=1): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input0',{ - 0:self.node.position[0], - 1:self.node.position[0] + 2 * value - }) + ba.animate(self._rcombine, 'input0', { + 0: self.node.position[0], + 1: self.node.position[0] + 2 * value + }) if value == 0.0: self.loop_lr = None else: self.x_direction = value self.z_direction = 0 loop() - self.loop_lr = ba.Timer(1, loop , repeat = True ) + self.loop_lr = ba.Timer(1, loop, repeat=True) + def up_(self, value=1): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input2',{ - 0:self.node.position[2], - 1:self.node.position[2] - 2 * value - }) + ba.animate(self._rcombine, 'input2', { + 0: self.node.position[2], + 1: self.node.position[2] - 2 * value + }) if value == 0.0: self.loop_ud = None else: self.x_direction = 0 self.z_direction = - value loop() - self.loop_ud = ba.Timer(1, loop , repeat = True ) + self.loop_ud = ba.Timer(1, loop, repeat=True) + def down_(self, value=-1): def loop(): if self.node.exists(): - ba.animate( self._rcombine,'input2',{ - 0:self.node.position[2], - 1:self.node.position[2] - 2 * value - }) + ba.animate(self._rcombine, 'input2', { + 0: self.node.position[2], + 1: self.node.position[2] - 2 * value + }) if value == 0.0: self.loop_ud = None else: self.x_direction = 0 self.z_direction = - value loop() - self.loop_ud = ba.Timer(1, loop , repeat = True ) + self.loop_ud = ba.Timer(1, loop, repeat=True) + def handlemessage(self, msg): if isinstance(msg, ba.DieMessage): self.node.delete() @@ -204,6 +218,8 @@ class Drone(ba.Actor): super().handlemessage(msg) # =============================================Copied from Quake Game - Dliwk ===================================================================== + + class RocketFactory: """Quake Rocket factory""" @@ -261,7 +277,7 @@ class RocketLauncher: time = ba.time() if time - self.last_shot > 0.6: self.last_shot = time - + direction = [x, 0, z] direction[1] = 0.0 @@ -368,30 +384,31 @@ class ChooseQueen(DeathMatchGame): @classmethod def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: return ['Football Stadium'] - + def spawn_player_spaz( self, player: PlayerType, position: Sequence[float] | None = None, angle: float | None = None, ) -> PlayerSpaz: - spaz = super().spawn_player_spaz(player, position, angle) + spaz = super().spawn_player_spaz(player, position, angle) self.spawn_drone(spaz) return spaz - + def on_begin(self): super().on_begin() shared = SharedObjects.get() self.ground_material = ba.Material() self.ground_material.add_actions( - conditions=('they_have_material',shared.player_material), + conditions=('they_have_material', shared.player_material), actions=( ('modify_part_collision', 'collide', True), - ( 'call','at_connect',ba.Call(self._handle_player_collide )), + ('call', 'at_connect', ba.Call(self._handle_player_collide)), ), - ) - pos=(0,0.1,-5) - self.main_region=ba.newnode('region',attrs={'position': pos,'scale': (30,0.001,23),'type': 'box','materials': [shared.footing_material,self.ground_material]}) + ) + pos = (0, 0.1, -5) + self.main_region = ba.newnode('region', attrs={'position': pos, 'scale': ( + 30, 0.001, 23), 'type': 'box', 'materials': [shared.footing_material, self.ground_material]}) def _handle_player_collide(self): try: @@ -404,7 +421,7 @@ class ChooseQueen(DeathMatchGame): def spawn_drone(self, spaz): with ba.Context(_ba.get_foreground_host_activity()): - + drone = Drone(spaz) r_launcher = RocketLauncher() drone.set_rocket_launcher(r_launcher) @@ -423,4 +440,4 @@ class ChooseQueen(DeathMatchGame): player.assigninput(InputType.UP_PRESS, drone.up_) player.assigninput(InputType.DOWN_PRESS, drone.down_) player.assigninput(InputType.UP_RELEASE, drone.pause_ud) - player.assigninput(InputType.DOWN_RELEASE, drone.pause_ud) \ No newline at end of file + player.assigninput(InputType.DOWN_RELEASE, drone.pause_ud) diff --git a/plugins/minigames/the_spaz_game.py b/plugins/minigames/the_spaz_game.py index 5bbebac..278b521 100644 --- a/plugins/minigames/the_spaz_game.py +++ b/plugins/minigames/the_spaz_game.py @@ -24,6 +24,8 @@ if TYPE_CHECKING: CHARACTER = 'Spaz' # ba_meta export game + + class TheSpazGame(EliminationGame): name = 'TheSpazGame' description = 'Enemy Spaz AmongUs. Kill them all' @@ -84,7 +86,7 @@ class TheSpazGame(EliminationGame): @classmethod def get_supported_maps(cls, sessiontype: type[ba.Session]) -> list[str]: return ba.getmaps('melee') - + def get_instance_description(self) -> str | Sequence: return ( 'Enemy Spaz AmongUs. Kill them all' @@ -94,6 +96,7 @@ class TheSpazGame(EliminationGame): return ( 'Enemy Spaz AmongUs. Kill them all' ) + def __init__(self, settings: dict): super().__init__(settings) self._solo_mode = False @@ -105,13 +108,13 @@ class TheSpazGame(EliminationGame): x = random.randrange(0, len(p)) y = random.randrange(0, len(q)) spaz = self.spawn_player_spaz(player, position=(p[x], 1.8, q[y])) - spaz.node.color = (1,1,1) - spaz.node.highlight = (1,0.4,1) + spaz.node.color = (1, 1, 1) + spaz.node.highlight = (1, 0.4, 1) self.update_appearance(spaz, character=CHARACTER) # Also lets have them make some noise when they die. spaz.play_big_death_sound = True return spaz - + def update_appearance(self, spaz, character): factory = SpazFactory.get() media = factory.get_media(character) @@ -119,4 +122,3 @@ class TheSpazGame(EliminationGame): setattr(spaz.node, field, value) spaz.node.style = factory.get_style(character) spaz.node.name = '' -