mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
[ci] auto-format
This commit is contained in:
parent
da505cd56b
commit
36673fc368
8 changed files with 1204 additions and 1124 deletions
|
|
@ -305,7 +305,8 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
'materials': (self._fake_wall_material, )
|
'materials': (self._fake_wall_material, )
|
||||||
})))
|
})))
|
||||||
pos = (0, 0.1, -5)
|
pos = (0, 0.1, -5)
|
||||||
self.main_ground=bs.newnode('region',attrs={'position': pos,'scale': (25,0.001,22),'type': 'box','materials': [self.main_ground_material]})
|
self.main_ground = bs.newnode('region', attrs={'position': pos, 'scale': (
|
||||||
|
25, 0.001, 22), 'type': 'box', 'materials': [self.main_ground_material]})
|
||||||
self._update_scoreboard()
|
self._update_scoreboard()
|
||||||
self._chant_sound.play()
|
self._chant_sound.play()
|
||||||
|
|
||||||
|
|
@ -326,6 +327,7 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
def _kill_puck(self) -> None:
|
def _kill_puck(self) -> None:
|
||||||
self._puck = None
|
self._puck = None
|
||||||
|
|
||||||
def _handle_egg_collision(self) -> None:
|
def _handle_egg_collision(self) -> None:
|
||||||
|
|
||||||
no = bs.getcollision().opposingnode
|
no = bs.getcollision().opposingnode
|
||||||
|
|
@ -335,7 +337,6 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
if source_player == None or pos[0] < -8 or not source_player.node.exists():
|
if source_player == None or pos[0] < -8 or not source_player.node.exists():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
col = source_player.team.color
|
col = source_player.team.color
|
||||||
self.flagg = Flag(pos, touchable=False, color=col).autoretain()
|
self.flagg = Flag(pos, touchable=False, color=col).autoretain()
|
||||||
|
|
@ -344,7 +345,6 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
distance = math.sqrt(pow(player_pos[0]-pos[0], 2) + pow(player_pos[2]-pos[2], 2))
|
distance = math.sqrt(pow(player_pos[0]-pos[0], 2) + pow(player_pos[2]-pos[2], 2))
|
||||||
|
|
||||||
|
|
||||||
dis_mark = bs.newnode('text',
|
dis_mark = bs.newnode('text',
|
||||||
|
|
||||||
attrs={
|
attrs={
|
||||||
|
|
@ -371,8 +371,8 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
except ():
|
except ():
|
||||||
pass
|
pass
|
||||||
def spawn_player(self, player: Player) -> bs.Actor:
|
|
||||||
|
|
||||||
|
def spawn_player(self, player: Player) -> bs.Actor:
|
||||||
|
|
||||||
zoo = random.randrange(-4, 5)
|
zoo = random.randrange(-4, 5)
|
||||||
pos = (-11.204887390136719, 0.2998693287372589, zoo)
|
pos = (-11.204887390136719, 0.2998693287372589, zoo)
|
||||||
|
|
@ -383,6 +383,7 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
# Prevent controlling of characters before the start of the race.
|
# Prevent controlling of characters before the start of the race.
|
||||||
|
|
||||||
return spaz
|
return spaz
|
||||||
|
|
||||||
def _handle_score(self) -> None:
|
def _handle_score(self) -> None:
|
||||||
"""A point has been scored."""
|
"""A point has been scored."""
|
||||||
|
|
||||||
|
|
@ -481,6 +482,7 @@ class EggGame(bs.TeamGameActivity[Player, Team]):
|
||||||
# bs.animate(light, 'intensity', {0.0: 0, 0.25: 1, 0.5: 0}, loop=True)
|
# bs.animate(light, 'intensity', {0.0: 0, 0.25: 1, 0.5: 0}, loop=True)
|
||||||
# bs.timer(1.0, light.delete)
|
# bs.timer(1.0, light.delete)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _spawn_puck(self) -> None:
|
def _spawn_puck(self) -> None:
|
||||||
# self._swipsound.play()
|
# self._swipsound.play()
|
||||||
# self._whistle_sound.play()
|
# self._whistle_sound.play()
|
||||||
|
|
|
||||||
|
|
@ -1002,7 +1002,6 @@ class RaceGame(bs.TeamGameActivity[Player, Team]):
|
||||||
bs.timer(1.6, bs.WeakCall(self._bomb, 'impact',
|
bs.timer(1.6, bs.WeakCall(self._bomb, 'impact',
|
||||||
(-1.5, 5, 0), (0, 0, 0), 1.0, 1.0, (0, 20, 3)), repeat=True)
|
(-1.5, 5, 0), (0, 0, 0), 1.0, 1.0, (0, 20, 3)), repeat=True)
|
||||||
|
|
||||||
|
|
||||||
bs.timer(1.6, bs.WeakCall(self._bomb, 'sticky',
|
bs.timer(1.6, bs.WeakCall(self._bomb, 'sticky',
|
||||||
(-1, 5, -8), (0, 10, 0), 1.0, 1.0), repeat=True)
|
(-1, 5, -8), (0, 10, 0), 1.0, 1.0), repeat=True)
|
||||||
bs.timer(1.6, bs.WeakCall(self._bomb, 'sticky',
|
bs.timer(1.6, bs.WeakCall(self._bomb, 'sticky',
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,11 @@ from bascenev1lib.actor.onscreentimer import OnScreenTimer
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Sequence, Optional, List, Dict, Type, Type
|
from typing import Any, Sequence, Optional, List, Dict, Type, Type
|
||||||
|
|
||||||
|
|
||||||
class _GotTouched():
|
class _GotTouched():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class UFO(bs.Actor):
|
class UFO(bs.Actor):
|
||||||
|
|
||||||
def __init__(self, pos: float = (0, 0, 0)):
|
def __init__(self, pos: float = (0, 0, 0)):
|
||||||
|
|
@ -43,15 +45,19 @@ class UFO(bs.Actor):
|
||||||
self.ufo_collide = None
|
self.ufo_collide = None
|
||||||
|
|
||||||
def create_target(self):
|
def create_target(self):
|
||||||
if not self.node.exists(): return
|
if not self.node.exists():
|
||||||
|
return
|
||||||
self.dis = []
|
self.dis = []
|
||||||
shared = SharedObjects.get()
|
shared = SharedObjects.get()
|
||||||
try:
|
try:
|
||||||
def pass_():
|
def pass_():
|
||||||
self.regs.clear()
|
self.regs.clear()
|
||||||
bs.timer(3875*0.001, self.move)
|
bs.timer(3875*0.001, self.move)
|
||||||
try: bs.timer(3277*0.001, lambda: Bomb(velocity=(0,0,0), position=(self.target[0], self.node.position[1]-0.43999, self.target[2]), bomb_type='impact').autoretain().arm())
|
try:
|
||||||
except: pass
|
bs.timer(3277*0.001, lambda: Bomb(velocity=(0, 0, 0), position=(
|
||||||
|
self.target[0], self.node.position[1]-0.43999, self.target[2]), bomb_type='impact').autoretain().arm())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
key = bs.Material()
|
key = bs.Material()
|
||||||
key.add_actions(
|
key.add_actions(
|
||||||
conditions=('they_have_material', shared.object_material),
|
conditions=('they_have_material', shared.object_material),
|
||||||
|
|
@ -60,7 +66,8 @@ class UFO(bs.Actor):
|
||||||
('modify_part_collision', 'physical', False),
|
('modify_part_collision', 'physical', False),
|
||||||
('call', 'at_connect', pass_()),
|
('call', 'at_connect', pass_()),
|
||||||
))
|
))
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
self.regs.append(bs.NodeActor(bs.newnode('region',
|
self.regs.append(bs.NodeActor(bs.newnode('region',
|
||||||
attrs={
|
attrs={
|
||||||
'position': self.target,
|
'position': self.target,
|
||||||
|
|
@ -69,25 +76,32 @@ class UFO(bs.Actor):
|
||||||
'materials': [key]})))
|
'materials': [key]})))
|
||||||
|
|
||||||
def move(self):
|
def move(self):
|
||||||
if not self.node.exists(): return
|
if not self.node.exists():
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
self.create_target()
|
self.create_target()
|
||||||
for j in bs.getnodes():
|
for j in bs.getnodes():
|
||||||
n = j.getdelegate(object)
|
n = j.getdelegate(object)
|
||||||
if j.getnodetype() == 'prop' and isinstance(n, TileFloor):
|
if j.getnodetype() == 'prop' and isinstance(n, TileFloor):
|
||||||
if n.node.exists(): self.dis.append(n.node)
|
if n.node.exists():
|
||||||
|
self.dis.append(n.node)
|
||||||
self.r = random.randint(0, len(self.dis)-1)
|
self.r = random.randint(0, len(self.dis)-1)
|
||||||
self.target = (self.dis[self.r].position[0], self.node.position[1], self.dis[self.r].position[2])
|
self.target = (self.dis[self.r].position[0],
|
||||||
|
self.node.position[1], self.dis[self.r].position[2])
|
||||||
bs.animate_array(self.node, 'position', 3, {
|
bs.animate_array(self.node, 'position', 3, {
|
||||||
0: self.node.position,
|
0: self.node.position,
|
||||||
3.0: self.target})
|
3.0: self.target})
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def handlemessage(self, msg):
|
def handlemessage(self, msg):
|
||||||
|
|
||||||
if isinstance(msg, bs.DieMessage):
|
if isinstance(msg, bs.DieMessage):
|
||||||
self.node.delete()
|
self.node.delete()
|
||||||
elif isinstance(msg ,bs.OutOfBoundsMessage): self.handlemessage(bs.DieMessage())
|
elif isinstance(msg, bs.OutOfBoundsMessage):
|
||||||
else: super().handlemessage(msg)
|
self.handlemessage(bs.DieMessage())
|
||||||
|
else:
|
||||||
|
super().handlemessage(msg)
|
||||||
|
|
||||||
|
|
||||||
class TileFloor(bs.Actor):
|
class TileFloor(bs.Actor):
|
||||||
|
|
@ -98,8 +112,10 @@ class TileFloor(bs.Actor):
|
||||||
self.pos = pos
|
self.pos = pos
|
||||||
self.scale = 1.5
|
self.scale = 1.5
|
||||||
self.mat, self.mat2, self.test = bs.Material(), bs.Material(), bs.Material()
|
self.mat, self.mat2, self.test = bs.Material(), bs.Material(), bs.Material()
|
||||||
self.mat.add_actions(conditions=('we_are_older_than', 1), actions=(('modify_part_collision', 'collide', False)))
|
self.mat.add_actions(conditions=('we_are_older_than', 1),
|
||||||
self.mat2.add_actions(conditions=('we_are_older_than', 1), actions=(('modify_part_collision', 'collide', True)))
|
actions=(('modify_part_collision', 'collide', False)))
|
||||||
|
self.mat2.add_actions(conditions=('we_are_older_than', 1),
|
||||||
|
actions=(('modify_part_collision', 'collide', True)))
|
||||||
self.test.add_actions(
|
self.test.add_actions(
|
||||||
conditions=('they_have_material', BombFactory.get().bomb_material),
|
conditions=('they_have_material', BombFactory.get().bomb_material),
|
||||||
actions=(
|
actions=(
|
||||||
|
|
@ -125,6 +141,7 @@ class TileFloor(bs.Actor):
|
||||||
'type': 'box',
|
'type': 'box',
|
||||||
'materials': [get_mat.footing_material, self.mat2]
|
'materials': [get_mat.footing_material, self.mat2]
|
||||||
})
|
})
|
||||||
|
|
||||||
def handlemessage(self, msg):
|
def handlemessage(self, msg):
|
||||||
if isinstance(msg, bs.DieMessage):
|
if isinstance(msg, bs.DieMessage):
|
||||||
self.node.delete()
|
self.node.delete()
|
||||||
|
|
@ -132,58 +149,78 @@ class TileFloor(bs.Actor):
|
||||||
elif isinstance(msg, _GotTouched):
|
elif isinstance(msg, _GotTouched):
|
||||||
def do(): self.handlemessage(bs.DieMessage())
|
def do(): self.handlemessage(bs.DieMessage())
|
||||||
bs.timer(0.1, do)
|
bs.timer(0.1, do)
|
||||||
else: super().handlemessage(msg)
|
else:
|
||||||
|
super().handlemessage(msg)
|
||||||
|
|
||||||
|
|
||||||
class defs():
|
class defs():
|
||||||
points = boxes = {}
|
points = boxes = {}
|
||||||
boxes['area_of_interest_bounds'] = (-1.3440, 1.185751251, 3.7326226188) + (
|
boxes['area_of_interest_bounds'] = (-1.3440, 1.185751251, 3.7326226188) + (
|
||||||
0.0, 0.0, 0.0) + (29.8180273, 15.57249038, 22.93859993)
|
0.0, 0.0, 0.0) + (29.8180273, 15.57249038, 22.93859993)
|
||||||
boxes['map_bounds'] = (0.0, 2.585751251, 0.4326226188) + (0.0, 0.0, 0.0) + (29.09506485, 15.81173179, 33.76723155)
|
boxes['map_bounds'] = (0.0, 2.585751251, 0.4326226188) + (0.0, 0.0,
|
||||||
|
0.0) + (29.09506485, 15.81173179, 33.76723155)
|
||||||
|
|
||||||
|
|
||||||
class DummyMapForGame(bs.Map):
|
class DummyMapForGame(bs.Map):
|
||||||
defs, name = defs(), 'Tile Lands'
|
defs, name = defs(), 'Tile Lands'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_play_types(cls) -> List[str]:
|
def get_play_types(cls) -> List[str]:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_preview_texture_name(cls) -> str:
|
def get_preview_texture_name(cls) -> str:
|
||||||
return 'achievementCrossHair'
|
return 'achievementCrossHair'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def on_preload(cls) -> Any:
|
def on_preload(cls) -> Any:
|
||||||
data: Dict[str, Any] = {'bg_1': bs.gettexture('rampageBGColor'),'bg_2': bs.gettexture('rampageBGColor2'),'bg_mesh_1': bs.getmesh('rampageBG'),'bg_mesh_2': bs.getmesh('rampageBG2'),}
|
data: Dict[str, Any] = {'bg_1': bs.gettexture('rampageBGColor'), 'bg_2': bs.gettexture(
|
||||||
|
'rampageBGColor2'), 'bg_mesh_1': bs.getmesh('rampageBG'), 'bg_mesh_2': bs.getmesh('rampageBG2'), }
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.bg1 = bs.newnode('terrain',attrs={'mesh': self.preloaddata['bg_mesh_1'],'lighting': False,'background': True,'color_texture': self.preloaddata['bg_2']})
|
self.bg1 = bs.newnode('terrain', attrs={
|
||||||
self.bg2 = bs.newnode('terrain',attrs={ 'mesh': self.preloaddata['bg_mesh_2'], 'lighting': False,'background': True, 'color_texture': self.preloaddata['bg_2']})
|
'mesh': self.preloaddata['bg_mesh_1'], 'lighting': False, 'background': True, 'color_texture': self.preloaddata['bg_2']})
|
||||||
|
self.bg2 = bs.newnode('terrain', attrs={
|
||||||
|
'mesh': self.preloaddata['bg_mesh_2'], 'lighting': False, 'background': True, 'color_texture': self.preloaddata['bg_2']})
|
||||||
a = bs.getactivity().globalsnode
|
a = bs.getactivity().globalsnode
|
||||||
a.tint, a.ambient_color, a.vignette_outer, a.vignette_inner = (1.2, 1.1, 0.97), (1.3, 1.2, 1.03), (0.62, 0.64, 0.69), (0.97, 0.95, 0.93)
|
a.tint, a.ambient_color, a.vignette_outer, a.vignette_inner = (
|
||||||
|
1.2, 1.1, 0.97), (1.3, 1.2, 1.03), (0.62, 0.64, 0.69), (0.97, 0.95, 0.93)
|
||||||
|
|
||||||
|
|
||||||
class DummyMapForGame2(bs.Map):
|
class DummyMapForGame2(bs.Map):
|
||||||
defs, name = defs(), 'Tile Lands Night'
|
defs, name = defs(), 'Tile Lands Night'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_play_types(cls) -> List[str]:
|
def get_play_types(cls) -> List[str]:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_preview_texture_name(cls) -> str:
|
def get_preview_texture_name(cls) -> str:
|
||||||
return 'achievementCrossHair'
|
return 'achievementCrossHair'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def on_preload(cls) -> Any:
|
def on_preload(cls) -> Any:
|
||||||
data: Dict[str, Any] = {'bg_1': bs.gettexture('menuBG'),'bg_2': bs.gettexture('menuBG'),'bg_mesh_1': bs.getmesh('thePadBG'),'bg_mesh_2': bs.getmesh('thePadBG'),}
|
data: Dict[str, Any] = {'bg_1': bs.gettexture('menuBG'), 'bg_2': bs.gettexture(
|
||||||
|
'menuBG'), 'bg_mesh_1': bs.getmesh('thePadBG'), 'bg_mesh_2': bs.getmesh('thePadBG'), }
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.bg1 = bs.newnode('terrain',attrs={'mesh': self.preloaddata['bg_mesh_1'],'lighting': False,'background': True,'color_texture': self.preloaddata['bg_2']})
|
self.bg1 = bs.newnode('terrain', attrs={
|
||||||
self.bg2 = bs.newnode('terrain',attrs={ 'mesh': self.preloaddata['bg_mesh_2'], 'lighting': False,'background': True, 'color_texture': self.preloaddata['bg_2']})
|
'mesh': self.preloaddata['bg_mesh_1'], 'lighting': False, 'background': True, 'color_texture': self.preloaddata['bg_2']})
|
||||||
|
self.bg2 = bs.newnode('terrain', attrs={
|
||||||
|
'mesh': self.preloaddata['bg_mesh_2'], 'lighting': False, 'background': True, 'color_texture': self.preloaddata['bg_2']})
|
||||||
a = bs.getactivity().globalsnode
|
a = bs.getactivity().globalsnode
|
||||||
a.tint, a.ambient_color, a.vignette_outer, a.vignette_inner = (0.5, 0.7, 1.27), (2.5, 2.5, 2.5), (0.62, 0.64, 0.69), (0.97, 0.95, 0.93)
|
a.tint, a.ambient_color, a.vignette_outer, a.vignette_inner = (
|
||||||
|
0.5, 0.7, 1.27), (2.5, 2.5, 2.5), (0.62, 0.64, 0.69), (0.97, 0.95, 0.93)
|
||||||
|
|
||||||
|
|
||||||
bs._map.register_map(DummyMapForGame)
|
bs._map.register_map(DummyMapForGame)
|
||||||
bs._map.register_map(DummyMapForGame2)
|
bs._map.register_map(DummyMapForGame2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Player(bs.Player['Team']):
|
class Player(bs.Player['Team']):
|
||||||
"""Our player type for this game."""
|
"""Our player type for this game."""
|
||||||
|
|
||||||
|
|
@ -215,9 +252,11 @@ class UFOAttackGame(bs.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
# Print messages when players die (since its meaningful in this game).
|
# Print messages when players die (since its meaningful in this game).
|
||||||
announce_player_deaths = True
|
announce_player_deaths = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
|
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
|
||||||
return ['Tile Lands', 'Tile Lands Night']
|
return ['Tile Lands', 'Tile Lands Night']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
|
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
|
||||||
return (issubclass(sessiontype, bs.DualTeamSession)
|
return (issubclass(sessiontype, bs.DualTeamSession)
|
||||||
|
|
@ -237,7 +276,8 @@ class UFOAttackGame(bs.TeamGameActivity[Player, Team]):
|
||||||
if self._epic_mode else bs.MusicType.SURVIVAL)
|
if self._epic_mode else bs.MusicType.SURVIVAL)
|
||||||
if bool(settings["Display Map Area Dimension"]):
|
if bool(settings["Display Map Area Dimension"]):
|
||||||
self.game_name = "UFO Attack " + "(" + str(self.col) + "x" + str(self.row) + ")"
|
self.game_name = "UFO Attack " + "(" + str(self.col) + "x" + str(self.row) + ")"
|
||||||
else: self.game_name = "UFO Attack"
|
else:
|
||||||
|
self.game_name = "UFO Attack"
|
||||||
if self._epic_mode:
|
if self._epic_mode:
|
||||||
self.slow_motion = True
|
self.slow_motion = True
|
||||||
|
|
||||||
|
|
@ -280,7 +320,8 @@ class UFOAttackGame(bs.TeamGameActivity[Player, Team]):
|
||||||
if a.getnodetype() == 'prop' and isinstance(g, TileFloor):
|
if a.getnodetype() == 'prop' and isinstance(g, TileFloor):
|
||||||
dis.append(g.node)
|
dis.append(g.node)
|
||||||
r = random.randint(0, len(dis)-1)
|
r = random.randint(0, len(dis)-1)
|
||||||
spaz = self.spawn_player_spaz(player, position=(dis[r].position[0], dis[r].position[1]+1.005958, dis[r].position[2]))
|
spaz = self.spawn_player_spaz(player, position=(
|
||||||
|
dis[r].position[0], dis[r].position[1]+1.005958, dis[r].position[2]))
|
||||||
spaz.connect_controls_to_player(enable_punch=False,
|
spaz.connect_controls_to_player(enable_punch=False,
|
||||||
enable_bomb=False,
|
enable_bomb=False,
|
||||||
enable_run=self.bool1,
|
enable_run=self.bool1,
|
||||||
|
|
@ -288,6 +329,7 @@ class UFOAttackGame(bs.TeamGameActivity[Player, Team]):
|
||||||
enable_pickup=False)
|
enable_pickup=False)
|
||||||
spaz.play_big_death_sound = True
|
spaz.play_big_death_sound = True
|
||||||
return spaz
|
return spaz
|
||||||
|
|
||||||
def handlemessage(self, msg: Any) -> Any:
|
def handlemessage(self, msg: Any) -> Any:
|
||||||
if isinstance(msg, bs.PlayerDiedMessage):
|
if isinstance(msg, bs.PlayerDiedMessage):
|
||||||
super().handlemessage(msg)
|
super().handlemessage(msg)
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@ class Team(bs.Team[Player]):
|
||||||
self.survival_seconds: Optional[int] = None
|
self.survival_seconds: Optional[int] = None
|
||||||
self.spawn_order: List[Player] = []
|
self.spawn_order: List[Player] = []
|
||||||
|
|
||||||
|
|
||||||
lang = bs.app.lang.language
|
lang = bs.app.lang.language
|
||||||
if lang == 'Spanish':
|
if lang == 'Spanish':
|
||||||
description = 'Mantente en la zona segura.'
|
description = 'Mantente en la zona segura.'
|
||||||
|
|
@ -187,6 +188,8 @@ else:
|
||||||
kill_timer = 'Kill timer: '
|
kill_timer = 'Kill timer: '
|
||||||
|
|
||||||
# ba_meta export bascenev1.GameActivity
|
# ba_meta export bascenev1.GameActivity
|
||||||
|
|
||||||
|
|
||||||
class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
||||||
"""Game type where last player(s) left alive win."""
|
"""Game type where last player(s) left alive win."""
|
||||||
|
|
||||||
|
|
@ -362,10 +365,14 @@ class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
def spawn_zone(self):
|
def spawn_zone(self):
|
||||||
self.zone_pos = (random.randrange(-10, 10), 0.05, random.randrange(-5, 5))
|
self.zone_pos = (random.randrange(-10, 10), 0.05, random.randrange(-5, 5))
|
||||||
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':self.zone_pos,'color':(1, 1, 0),'opacity':0.8,'draw_beauty':True,'additive':False,'drawShadow':False})
|
self.zone = bs.newnode('locator', attrs={'shape': 'circle', 'position': self.zone_pos, 'color': (
|
||||||
self.zone_limit = bs.newnode('locator',attrs={'shape':'circleOutline','position':self.zone_pos,'color':(1, 0.2, 0.2),'opacity':0.8,'draw_beauty':True,'additive':False,'drawShadow':False})
|
1, 1, 0), 'opacity': 0.8, 'draw_beauty': True, 'additive': False, 'drawShadow': False})
|
||||||
bs.animate_array(self.zone, 'size', 1,{0:[0], 0.3:[self.get_players_count()*0.85], 0.35:[self.get_players_count()*0.8]})
|
self.zone_limit = bs.newnode('locator', attrs={'shape': 'circleOutline', 'position': self.zone_pos, 'color': (
|
||||||
bs.animate_array(self.zone_limit, 'size', 1,{0:[0], 0.3:[self.get_players_count()*1.2], 0.35:[self.get_players_count()*0.95]})
|
1, 0.2, 0.2), 'opacity': 0.8, 'draw_beauty': True, 'additive': False, 'drawShadow': False})
|
||||||
|
bs.animate_array(self.zone, 'size', 1, {0: [0], 0.3: [
|
||||||
|
self.get_players_count()*0.85], 0.35: [self.get_players_count()*0.8]})
|
||||||
|
bs.animate_array(self.zone_limit, 'size', 1, {0: [0], 0.3: [
|
||||||
|
self.get_players_count()*1.2], 0.35: [self.get_players_count()*0.95]})
|
||||||
self.last_players_count = self.get_players_count()
|
self.last_players_count = self.get_players_count()
|
||||||
bs.getsound('laserReverse').play()
|
bs.getsound('laserReverse').play()
|
||||||
self.start_timer()
|
self.start_timer()
|
||||||
|
|
@ -380,11 +387,15 @@ class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
||||||
bs.timer(1, self.spawn_zone)
|
bs.timer(1, self.spawn_zone)
|
||||||
|
|
||||||
def move_zone(self):
|
def move_zone(self):
|
||||||
if self.zone_pos[0] > 0: x = random.randrange(0,10)
|
if self.zone_pos[0] > 0:
|
||||||
else: x = random.randrange(-10,0)
|
x = random.randrange(0, 10)
|
||||||
|
else:
|
||||||
|
x = random.randrange(-10, 0)
|
||||||
|
|
||||||
if self.zone_pos[2] > 0: y = random.randrange(0,5)
|
if self.zone_pos[2] > 0:
|
||||||
else: y = random.randrange(-5,0)
|
y = random.randrange(0, 5)
|
||||||
|
else:
|
||||||
|
y = random.randrange(-5, 0)
|
||||||
|
|
||||||
new_pos = (x, 0.05, y)
|
new_pos = (x, 0.05, y)
|
||||||
bs.animate_array(self.zone, 'position', 3, {0: self.zone.position, 8: new_pos})
|
bs.animate_array(self.zone, 'position', 3, {0: self.zone.position, 8: new_pos})
|
||||||
|
|
@ -418,8 +429,10 @@ class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
||||||
def check_players(self):
|
def check_players(self):
|
||||||
if self._time_remaining <= 0:
|
if self._time_remaining <= 0:
|
||||||
self.stop_timer()
|
self.stop_timer()
|
||||||
bs.animate_array(self.zone, 'size', 1,{0:[self.last_players_count*0.8], 1.4:[self.last_players_count*0.8],1.5:[0]})
|
bs.animate_array(self.zone, 'size', 1, {
|
||||||
bs.animate_array(self.zone_limit, 'size', 1,{0:[self.last_players_count*0.95], 1.45:[self.last_players_count*0.95],1.5:[0]})
|
0: [self.last_players_count*0.8], 1.4: [self.last_players_count*0.8], 1.5: [0]})
|
||||||
|
bs.animate_array(self.zone_limit, 'size', 1, {
|
||||||
|
0: [self.last_players_count*0.95], 1.45: [self.last_players_count*0.95], 1.5: [0]})
|
||||||
bs.timer(1.5, self.delete_zone)
|
bs.timer(1.5, self.delete_zone)
|
||||||
for player in self.players:
|
for player in self.players:
|
||||||
if not player.actor is None:
|
if not player.actor is None:
|
||||||
|
|
@ -654,10 +667,14 @@ class SafeZoneGame(bs.TeamGameActivity[Player, Team]):
|
||||||
spaz._charge_speed = self._get_bot_speed(spaz_type)
|
spaz._charge_speed = self._get_bot_speed(spaz_type)
|
||||||
|
|
||||||
def add_bot(self, pos=None):
|
def add_bot(self, pos=None):
|
||||||
if pos == 'left': position = (-11,0,random.randrange(-5,5))
|
if pos == 'left':
|
||||||
elif pos == 'right': position = (11,0,random.randrange(-5,5))
|
position = (-11, 0, random.randrange(-5, 5))
|
||||||
else: position = pos
|
elif pos == 'right':
|
||||||
self._bots.spawn_bot(self.get_random_bot(),pos=position,spawn_time=1,on_spawn_call=babase.Call(self._on_bot_spawn))
|
position = (11, 0, random.randrange(-5, 5))
|
||||||
|
else:
|
||||||
|
position = pos
|
||||||
|
self._bots.spawn_bot(self.get_random_bot(), pos=position, spawn_time=1,
|
||||||
|
on_spawn_call=babase.Call(self._on_bot_spawn))
|
||||||
|
|
||||||
def move_bot(self, bot):
|
def move_bot(self, bot):
|
||||||
p = bot.node.position
|
p = bot.node.position
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
|
|
||||||
Spaz._old_init = Spaz.__init__
|
Spaz._old_init = Spaz.__init__
|
||||||
|
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||||
|
|
@ -31,6 +33,7 @@ def __init__(self,
|
||||||
can_accept_powerups, powerups_expire, demo_mode)
|
can_accept_powerups, powerups_expire, demo_mode)
|
||||||
if self.source_player:
|
if self.source_player:
|
||||||
self.equip_shields()
|
self.equip_shields()
|
||||||
|
|
||||||
def animate_shield():
|
def animate_shield():
|
||||||
if not self.shield:
|
if not self.shield:
|
||||||
return
|
return
|
||||||
|
|
@ -41,6 +44,7 @@ def __init__(self,
|
||||||
bs.timer(0.2, animate_shield, repeat=True)
|
bs.timer(0.2, animate_shield, repeat=True)
|
||||||
self.impact_scale = 0
|
self.impact_scale = 0
|
||||||
|
|
||||||
|
|
||||||
def equip_shields(self, decay: bool = False) -> None:
|
def equip_shields(self, decay: bool = False) -> None:
|
||||||
"""
|
"""
|
||||||
Give this spaz a nice energy shield.
|
Give this spaz a nice energy shield.
|
||||||
|
|
|
||||||
|
|
@ -52,18 +52,22 @@ Configs = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Useful global fucntions
|
# Useful global fucntions
|
||||||
|
|
||||||
|
|
||||||
def setconfigs() -> None:
|
def setconfigs() -> None:
|
||||||
"""
|
"""
|
||||||
Set required defualt configs for mod
|
Set required defualt configs for mod
|
||||||
"""
|
"""
|
||||||
cnfg = babase.app.config
|
cnfg = babase.app.config
|
||||||
profiles = cnfg['Player Profiles']
|
profiles = cnfg['Player Profiles']
|
||||||
if not "TagConf" in cnfg: cnfg["TagConf"] = {}
|
if not "TagConf" in cnfg:
|
||||||
|
cnfg["TagConf"] = {}
|
||||||
for p in profiles:
|
for p in profiles:
|
||||||
if not p in cnfg["TagConf"]:
|
if not p in cnfg["TagConf"]:
|
||||||
cnfg["TagConf"][str(p)] = Configs
|
cnfg["TagConf"][str(p)] = Configs
|
||||||
babase.app.config.apply_and_commit()
|
babase.app.config.apply_and_commit()
|
||||||
|
|
||||||
|
|
||||||
def getanimcolor(name: str) -> dict:
|
def getanimcolor(name: str) -> dict:
|
||||||
"""
|
"""
|
||||||
Returns dictnary of colors with prefective time -> {seconds: (r, g, b)}
|
Returns dictnary of colors with prefective time -> {seconds: (r, g, b)}
|
||||||
|
|
@ -80,6 +84,7 @@ def getanimcolor(name: str) -> dict:
|
||||||
}
|
}
|
||||||
return animcolor
|
return animcolor
|
||||||
|
|
||||||
|
|
||||||
def gethostname() -> str:
|
def gethostname() -> str:
|
||||||
"""
|
"""
|
||||||
Return player name, by using -1 only host can use tags.
|
Return player name, by using -1 only host can use tags.
|
||||||
|
|
@ -94,11 +99,14 @@ def gethostname() -> str:
|
||||||
return '__account__'
|
return '__account__'
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
# Dummy functions for extend functionality for class object
|
# Dummy functions for extend functionality for class object
|
||||||
PlayerSpaz.init = PlayerSpaz.__init__
|
PlayerSpaz.init = PlayerSpaz.__init__
|
||||||
EditProfileWindow.init = EditProfileWindow.__init__
|
EditProfileWindow.init = EditProfileWindow.__init__
|
||||||
|
|
||||||
# PlayerSpaz object at -> bascenev1lib.actor.playerspaz
|
# PlayerSpaz object at -> bascenev1lib.actor.playerspaz
|
||||||
|
|
||||||
|
|
||||||
def NewPlayerSzapInit(self,
|
def NewPlayerSzapInit(self,
|
||||||
player: bs.Player,
|
player: bs.Player,
|
||||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||||
|
|
@ -112,7 +120,8 @@ def NewPlayerSzapInit(self,
|
||||||
cnfg = babase.app.config["TagConf"]
|
cnfg = babase.app.config["TagConf"]
|
||||||
if cnfg[str(self.curname)]["enabletag"]:
|
if cnfg[str(self.curname)]["enabletag"]:
|
||||||
# Tag node
|
# Tag node
|
||||||
self.mnode = bs.newnode('math', owner=self.node, attrs={'input1': (0, 1.5, 0),'operation': 'add'})
|
self.mnode = bs.newnode('math', owner=self.node, attrs={
|
||||||
|
'input1': (0, 1.5, 0), 'operation': 'add'})
|
||||||
self.node.connectattr('torso_position', self.mnode, 'input2')
|
self.node.connectattr('torso_position', self.mnode, 'input2')
|
||||||
|
|
||||||
tagtext = cnfg[str(self.curname)]["tag"]
|
tagtext = cnfg[str(self.curname)]["tag"]
|
||||||
|
|
@ -138,7 +147,8 @@ def NewPlayerSzapInit(self,
|
||||||
if cnfg[str(self.curname)]["animtag"]:
|
if cnfg[str(self.curname)]["animtag"]:
|
||||||
kys = getanimcolor(self.curname)
|
kys = getanimcolor(self.curname)
|
||||||
bs.animate_array(node=self.Tag, attr='color', size=3, keys=kys, loop=True)
|
bs.animate_array(node=self.Tag, attr='color', size=3, keys=kys, loop=True)
|
||||||
except Exception: pass
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def NewEditProfileWindowInit(self,
|
def NewEditProfileWindowInit(self,
|
||||||
|
|
@ -168,6 +178,7 @@ def NewEditProfileWindowInit(self,
|
||||||
text_scale=1.2,
|
text_scale=1.2,
|
||||||
on_activate_call=babase.Call(_on_tagwinbtn_press, self))
|
on_activate_call=babase.Call(_on_tagwinbtn_press, self))
|
||||||
|
|
||||||
|
|
||||||
def _on_tagwinbtn_press(self):
|
def _on_tagwinbtn_press(self):
|
||||||
"""
|
"""
|
||||||
Calls tag config window passes all paramisters
|
Calls tag config window passes all paramisters
|
||||||
|
|
@ -558,7 +569,8 @@ class CustomConfigNumberEdit:
|
||||||
self._update_display()
|
self._update_display()
|
||||||
if self._callback:
|
if self._callback:
|
||||||
self._callback(self._value)
|
self._callback(self._value)
|
||||||
babase.app.config[self._configkey[0]][self._configkey[1]][self._configkey[2]] = float(str(f'{self._value:.1f}'))
|
babase.app.config[self._configkey[0]][self._configkey[1]
|
||||||
|
][self._configkey[2]] = float(str(f'{self._value:.1f}'))
|
||||||
babase.app.config.apply_and_commit()
|
babase.app.config.apply_and_commit()
|
||||||
|
|
||||||
def _update_display(self) -> None:
|
def _update_display(self) -> None:
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,17 @@ from bascenev1lib.gameutils import SharedObjects
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BombPickupMessage:
|
class BombPickupMessage:
|
||||||
""" message says that someone pick up the dropped bomb """
|
""" message says that someone pick up the dropped bomb """
|
||||||
|
|
||||||
|
|
||||||
# for bs.FreezeMessage
|
# for bs.FreezeMessage
|
||||||
freeze: bool = True
|
freeze: bool = True
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class Plugin(babase.Plugin):
|
class Plugin(babase.Plugin):
|
||||||
|
|
||||||
# there are two ways to ignore our team player hits
|
# there are two ways to ignore our team player hits
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue