[ci] auto-format

This commit is contained in:
imayushsaini 2023-05-06 17:43:30 +00:00 committed by github-actions[bot]
parent d770fd9ee1
commit 52094fc51b
2 changed files with 138 additions and 102 deletions

View file

@ -9,7 +9,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import ba,_ba
import ba
import _ba
from bastd.actor.playerspaz import PlayerSpaz
from bastd.actor.scoreboard import Scoreboard
from bastd.actor.powerupbox import PowerupBoxFactory
@ -25,15 +26,18 @@ class PuckDiedMessage:
def __init__(self, puck: Puck):
self.puck = puck
def create_slope(self):
shared = SharedObjects.get()
x = 5
y = 12
for i in range(0, 10):
ba.newnode('region',attrs={'position': (x, y, -5.52),'scale': (0.2,0.1,6),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (0.2, 0.1, 6),
'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
x = x+0.3
y = y+0.1
class Puck(ba.Actor):
"""A lovely giant hockey puck."""
@ -306,14 +310,18 @@ class AirSoccerGame(ba.TeamGameActivity[Player, Team]):
def make_map(self):
shared = SharedObjects.get()
_ba.get_foreground_host_activity()._map.leftwall.materials= [shared.footing_material,self._real_wall_material ]
_ba.get_foreground_host_activity()._map.leftwall.materials = [
shared.footing_material, self._real_wall_material]
_ba.get_foreground_host_activity()._map.rightwall.materials=[shared.footing_material,self._real_wall_material ]
_ba.get_foreground_host_activity()._map.topwall.materials=[shared.footing_material,self._real_wall_material ]
self.floorwall=ba.newnode('region',attrs={'position': (0, 5, -5.52),'scale': (35.4,0.2,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('locator', attrs={'shape':'box', 'position':(0, 5, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(35.4,0.2,2)})
_ba.get_foreground_host_activity()._map.rightwall.materials = [
shared.footing_material, self._real_wall_material]
_ba.get_foreground_host_activity()._map.topwall.materials = [
shared.footing_material, self._real_wall_material]
self.floorwall = ba.newnode('region', attrs={'position': (0, 5, -5.52), 'scale': (
35.4, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (
0, 5, -5.52), 'color': (0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (35.4, 0.2, 2)})
self.create_goal_post(-16.65, 12.69)
self.create_goal_post(-16.65, 16.69)
@ -335,10 +343,13 @@ class AirSoccerGame(ba.TeamGameActivity[Player, Team]):
floor += "_ "
shared = SharedObjects.get()
step = {}
step["r"]=ba.newnode('region',attrs={'position': (x, y, -5.52),'scale': (3,0.1,6),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('locator', attrs={'shape':'box', 'position':( x, y, -5.52), 'color':(1,1,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(3,0.1,2)})
step["r"] = ba.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (
3, 0.1, 6), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (
x, y, -5.52), 'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (3, 0.1, 2)})
return step
def create_goal_post(self, x, y):
shared = SharedObjects.get()
if x > 0:
@ -348,19 +359,21 @@ class AirSoccerGame(ba.TeamGameActivity[Player, Team]):
floor = ""
for i in range(0, 4):
floor += "_ "
ba.newnode('region',attrs={'position': (x-0.2, y, -5.52),'scale': (1.8,0.1,6),'type': 'box','materials': [shared.footing_material,self._goal_post_material]})
ba.newnode('locator', attrs={'shape':'box', 'position':( x-0.2, y, -5.52), 'color': color, 'opacity':1,'draw_beauty':True,'additive':False,'size':(1.8,0.1,2)})
ba.newnode('region', attrs={'position': (x-0.2, y, -5.52), 'scale': (1.8, 0.1, 6),
'type': 'box', 'materials': [shared.footing_material, self._goal_post_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (
x-0.2, y, -5.52), 'color': color, 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (1.8, 0.1, 2)})
def create_vertical(self, x, y):
shared = SharedObjects.get()
floor = ""
for i in range(0, 4):
floor += "|\n"
ba.newnode('region',attrs={'position': (x, y, -5.52),'scale': (0.1,2.8,1),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('locator', attrs={'shape':'box', 'position':( x, y, -5.52), 'color':(1,1,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(0.1,2.8,2)})
ba.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (0.1, 2.8, 1),
'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (
x, y, -5.52), 'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 2.8, 2)})
def spawn_player_spaz(self,
player: Player,
@ -372,7 +385,6 @@ class AirSoccerGame(ba.TeamGameActivity[Player, Team]):
elif player.team.id == 1:
position = (8.75152479, 5.057427485, -5.52)
spaz = super().spawn_player_spaz(player, position, angle)
return spaz
@ -527,6 +539,8 @@ class mapdefs:
0.9516389866, 0.6666414677, 0.08607244075)
points['spawn_by_flag4'] = (0.4932087091, 12.74493212, -5.598987003) + (
0.5245740665, 0.5245740665, 0.01941146064)
class CreativeThoughts(ba.Map):
"""Freaking map by smoothy."""
@ -569,7 +583,8 @@ class CreativeThoughts(ba.Map):
self._fake_wall_material = ba.Material()
self._real_wall_material = ba.Material()
self._fake_wall_material.add_actions(
conditions=(('they_are_younger_than',9000),'and',('they_have_material', shared.player_material)),
conditions=(('they_are_younger_than', 9000), 'and',
('they_have_material', shared.player_material)),
actions=(
('modify_part_collision', 'collide', True),
('modify_part_collision', 'physical', True)
@ -591,12 +606,18 @@ class CreativeThoughts(ba.Map):
'color_texture': ba.gettexture("rampageBGColor")
})
self.leftwall=ba.newnode('region',attrs={'position': (-17.75152479, 13, -5.52),'scale': (0.1,15.5,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
self.rightwall=ba.newnode('region',attrs={'position': (17.75, 13, -5.52),'scale': (0.1,15.5,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
self.topwall=ba.newnode('region',attrs={'position': (0, 21.0, -5.52),'scale': (35.4,0.2,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('locator', attrs={'shape':'box', 'position':(-17.75152479, 13, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(0.1,15.5,2)})
ba.newnode('locator', attrs={'shape':'box', 'position':(17.75, 13, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(0.1,15.5,2)})
ba.newnode('locator', attrs={'shape':'box', 'position':(0, 21.0, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(35.4,0.2,2)})
self.leftwall = ba.newnode('region', attrs={'position': (-17.75152479, 13, -5.52), 'scale': (
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
self.rightwall = ba.newnode('region', attrs={'position': (17.75, 13, -5.52), 'scale': (
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
self.topwall = ba.newnode('region', attrs={'position': (0, 21.0, -5.52), 'scale': (
35.4, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (-17.75152479, 13, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
ba.newnode('locator', attrs={'shape': 'box', 'position': (17.75, 13, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
ba.newnode('locator', attrs={'shape': 'box', 'position': (0, 21.0, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (35.4, 0.2, 2)})
gnode = ba.getactivity().globalsnode
gnode.happy_thoughts_mode = True

View file

@ -20,6 +20,8 @@ if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union
# ba_meta export game
class ShimlaGame(DeathMatchGame):
name = 'Shimla'
@ -74,11 +76,13 @@ class ShimlaGame(DeathMatchGame):
self.make_map()
ba.timer(2, self.disable_fly)
def disable_fly(self):
activity = _ba.get_foreground_host_activity()
for players in activity.players:
players.actor.node.fly = False
def spawn_player_spaz(
self,
player: Player,
@ -197,11 +201,13 @@ class ShimlaGame(DeathMatchGame):
_tcombine.connectattr('output', floor, 'position')
mnode.connectattr('output', lift, 'position')
self.lifts[floor] = {"state":"origin","lift":_tcombine,"cleaner":_cleaner_combine,'leftLift': x < 0}
self.lifts[floor] = {"state": "origin", "lift": _tcombine,
"cleaner": _cleaner_combine, 'leftLift': x < 0}
def _handle_lift(self):
region = ba.getcollision().sourcenode
lift = self.lifts[region]
def clean(lift):
ba.animate(lift["cleaner"], 'input0', {
0: -19 if lift["leftLift"] else 19,
@ -220,7 +226,6 @@ class ShimlaGame(DeathMatchGame):
ba.timer(16, ba.Call(lambda lift: lift.update({'state': 'end'}), lift))
ba.timer(12, ba.Call(clean, lift))
def _handle_lift_disconnect(self):
region = ba.getcollision().sourcenode
lift = self.lifts[region]
@ -242,6 +247,7 @@ class ShimlaGame(DeathMatchGame):
x = x-0.1
y = y+0.1
class mapdefs:
points = {}
# noinspection PyDictCreation
@ -284,6 +290,8 @@ class mapdefs:
0.9516389866, 0.6666414677, 0.08607244075)
points['spawn_by_flag4'] = (0.4932087091, 12.74493212, -5.598987003) + (
0.5245740665, 0.5245740665, 0.01941146064)
class CreativeThoughts(ba.Map):
"""Freaking map by smoothy."""
@ -326,7 +334,8 @@ class CreativeThoughts(ba.Map):
self._fake_wall_material = ba.Material()
self._real_wall_material = ba.Material()
self._fake_wall_material.add_actions(
conditions=(('they_are_younger_than',9000),'and',('they_have_material', shared.player_material)),
conditions=(('they_are_younger_than', 9000), 'and',
('they_have_material', shared.player_material)),
actions=(
('modify_part_collision', 'collide', True),
('modify_part_collision', 'physical', True)
@ -348,12 +357,18 @@ class CreativeThoughts(ba.Map):
'color_texture': ba.gettexture("rampageBGColor")
})
self.leftwall=ba.newnode('region',attrs={'position': (-17.75152479, 13, -5.52),'scale': (0.1,15.5,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
self.rightwall=ba.newnode('region',attrs={'position': (17.75, 13, -5.52),'scale': (0.1,15.5,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
self.topwall=ba.newnode('region',attrs={'position': (0, 21.0, -5.52),'scale': (35.4,0.2,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
ba.newnode('locator', attrs={'shape':'box', 'position':(-17.75152479, 13, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(0.1,15.5,2)})
ba.newnode('locator', attrs={'shape':'box', 'position':(17.75, 13, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(0.1,15.5,2)})
ba.newnode('locator', attrs={'shape':'box', 'position':(0, 21.0, -5.52), 'color':(0,0,0), 'opacity':1,'draw_beauty':True,'additive':False,'size':(35.4,0.2,2)})
self.leftwall = ba.newnode('region', attrs={'position': (-17.75152479, 13, -5.52), 'scale': (
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
self.rightwall = ba.newnode('region', attrs={'position': (17.75, 13, -5.52), 'scale': (
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
self.topwall = ba.newnode('region', attrs={'position': (0, 21.0, -5.52), 'scale': (
35.4, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
ba.newnode('locator', attrs={'shape': 'box', 'position': (-17.75152479, 13, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
ba.newnode('locator', attrs={'shape': 'box', 'position': (17.75, 13, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
ba.newnode('locator', attrs={'shape': 'box', 'position': (0, 21.0, -5.52), 'color': (
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (35.4, 0.2, 2)})
gnode = ba.getactivity().globalsnode
gnode.happy_thoughts_mode = True