Update/Add my gamemodes for 1.7.20+ (API 8)

This commit is contained in:
! Freaku 2023-07-28 17:02:59 +05:30 committed by GitHub
parent 654d99c555
commit cd29dacf98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 890 additions and 773 deletions

View file

@ -1,9 +1,10 @@
# Ported by: Freaku / @[Just] Freak#4999 # Ported by your friend: Freaku
# Join BCS: #Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
# ba_meta require api 8 # ba_meta require api 8
from __future__ import annotations from __future__ import annotations
@ -11,7 +12,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import babase import babase
import bauiv1 as bui
import bascenev1 as bs import bascenev1 as bs
from bascenev1lib.actor.playerspaz import PlayerSpaz from bascenev1lib.actor.playerspaz import PlayerSpaz
@ -19,6 +19,7 @@ if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
class State: class State:
def __init__(self, bomb=None, grab=False, punch=False, curse=False, required=False, final=False, name=''): def __init__(self, bomb=None, grab=False, punch=False, curse=False, required=False, final=False, name=''):
self.bomb = bomb self.bomb = bomb
@ -35,8 +36,8 @@ class State:
def apply(self, spaz): def apply(self, spaz):
spaz.disconnect_controls_from_player() spaz.disconnect_controls_from_player()
spaz.connect_controls_to_player(enable_punch=self.punch, spaz.connect_controls_to_player(enable_punch=self.punch,
enable_bomb=self.bomb, enable_bomb=self.bomb,
enable_pickup=self.grab) enable_pickup=self.grab)
if self.curse: if self.curse:
spaz.curse_time = -1 spaz.curse_time = -1
spaz.curse() spaz.curse()
@ -48,18 +49,16 @@ class State:
return (self.name) return (self.name)
states = [State(bomb='normal', name='Basic Bombs'), states = [ State(bomb='normal', name='Basic Bombs'),
State(bomb='ice', name='Frozen Bombs'), State(bomb='ice', name='Frozen Bombs'),
State(bomb='sticky', name='Sticky Bombs'), State(bomb='sticky', name='Sticky Bombs'),
State(bomb='impact', name='Impact Bombs'), State(bomb='impact', name='Impact Bombs'),
State(grab=True, name='Grabbing only'), State(grab=True, name='Grabbing only'),
State(punch=True, name='Punching only'), State(punch=True, name='Punching only'),
State(curse=True, name='Cursed', final=True)] State(curse=True, name='Cursed', final=True) ]
class Player(bs.Player['Team']): class Player(bs.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
def __init__(self): def __init__(self):
self.state = None self.state = None

View file

@ -0,0 +1,18 @@
# Ported by your friend: Freaku
import babase
import bascenev1 as bs
from bascenev1lib.game.chosenone import Player, ChosenOneGame
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class FrozenOneGame(ChosenOneGame):
name = 'Frozen One'
def _set_chosen_one_player(self, player: Player) -> None:
super()._set_chosen_one_player(player)
if hasattr(player, 'actor'):
player.actor.frozen = True
player.actor.node.frozen = 1

View file

@ -0,0 +1,46 @@
# Made by your friend: Freaku
import babase
import bascenev1 as bs, random
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.game.meteorshower import Player, MeteorShowerGame
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class IcyEmitsGame(MeteorShowerGame):
name = 'Icy Emits'
@classmethod
def get_supported_maps(cls, sessiontype):
return ['Lake Frigid','Hockey Stadium']
def _drop_bomb_cluster(self) -> None:
delay = 0.0
for _i in range(random.randrange(1, 3)):
# Drop them somewhere within our bounds with velocity pointing
# toward the opposite side.
pos = (-7.3 + 15.3 * random.random(), 5.3,
-5.5 + 2.1 * random.random())
dropdir = (-1.0 if pos[0] > 0 else 1.0)
vel = (0,10,0)
bs.timer(delay, babase.Call(self._drop_bomb, pos, vel))
delay += 0.1
self._set_meteor_timer()
def _drop_bomb(self, position, velocity):
random_xpositions = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10]
random_zpositions = [-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5]
bomb_position = (random.choice(random_xpositions), 0.2,random.choice(random_zpositions))
Bomb(position=bomb_position, velocity=velocity, bomb_type = 'ice').autoretain()
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
## Campaign support ##
randomPic = ['lakeFrigidPreview','hockeyStadiumPreview']
babase.app.classic.add_coop_practice_level(bs.Level(name='Icy Emits', displayname='${GAME}', gametype=IcyEmitsGame, settings={}, preview_texture_name=random.choice(randomPic)))

File diff suppressed because it is too large Load diff

View file

@ -1,100 +1,99 @@
# Made by MattZ45986 on GitHub ## Made by MattZ45986 on GitHub
# Ported by: Freaku / @[Just] Freak#4999 ## Ported by your friend: Freaku
# Bug Fixes & Improvements as well... #Bug Fixes & Improvements as well...
# Join BCS: #Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import _babase, random, math
import ba import bascenev1 as bs
import random from bascenev1lib.actor.flag import Flag,FlagPickedUpMessage
import math from bascenev1lib.actor.playerspaz import PlayerSpaz
from bastd.actor.flag import Flag, FlagPickedUpMessage
from bastd.actor.playerspaz import PlayerSpaz
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
class Player(ba.Player['Team']):
class Player(bs.Player['Team']):
def __init__(self) -> None: def __init__(self) -> None:
self.done: bool = False self.done: bool = False
self.survived: bool = True self.survived: bool = True
class Team(bs.Team[Player]):
class Team(ba.Team[Player]):
def __init__(self) -> None: def __init__(self) -> None:
self.score = 0 self.score = 0
# ba_meta require api 7 # ba_meta require api 8
# ba_meta export game # ba_meta export bascenev1.GameActivity
class MFGame(ba.TeamGameActivity[Player, Team]): class MFGame(bs.TeamGameActivity[Player, Team]):
name = 'Musical Flags' name = 'Musical Flags'
description = "Don't be the one stuck without a flag!" description = "Don't be the one stuck without a flag!"
@classmethod @classmethod
def get_available_settings( def get_available_settings(
cls, sessiontype: Type[ba.Session]) -> List[ba.Setting]: cls, sessiontype: Type[bs.Session]) -> List[babase.Setting]:
settings = [ settings = [
ba.IntChoiceSetting( bs.IntSetting(
'Time Limit', 'Max Round Time',
choices=[ min_value=15,
('None', 0), default=25,
('1 Minute', 60), increment=5,
('2 Minutes', 120),
('5 Minutes', 300),
('10 Minutes', 600),
('20 Minutes', 1200),
],
default=0,
), ),
ba.BoolSetting('Epic Mode', default=False), bs.BoolSetting('Epic Mode', default=False),
ba.BoolSetting('Enable Running', default=True), bs.BoolSetting('Enable Running', default=True),
ba.BoolSetting('Enable Punching', default=False), bs.BoolSetting('Enable Punching', default=False),
ba.BoolSetting('Enable Bottom Credit', True) bs.BoolSetting('Enable Bottom Credit', True)
] ]
return settings return settings
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession) return (issubclass(sessiontype, bs.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession)) or issubclass(sessiontype, bs.FreeForAllSession))
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return ['Doom Shroom'] return ['Doom Shroom']
def __init__(self, settings: dict): def __init__(self, settings: dict):
super().__init__(settings) super().__init__(settings)
self.nodes = [] self.nodes = []
self._dingsound = ba.getsound('dingSmall') self._dingsound = bs.getsound('dingSmall')
self._epic_mode = bool(settings['Epic Mode']) self._epic_mode = bool(settings['Epic Mode'])
self.credit_text = bool(settings['Enable Bottom Credit']) self.credit_text = bool(settings['Enable Bottom Credit'])
self._time_limit = float(settings['Time Limit'])
self.is_punch = bool(settings['Enable Punching']) self.is_punch = bool(settings['Enable Punching'])
self.is_run = bool(settings['Enable Running']) self.is_run = bool(settings['Enable Running'])
self._textRound = ba.newnode('text', self._textRound = bs.newnode('text',
attrs={'text': '', attrs={'text': '',
'position': (0, -38), 'position': (0, -38),
'scale': 1, 'scale': 1,
'shadow': 1.0, 'shadow': 1.0,
'flatness': 1.0, 'flatness': 1.0,
'color': (1.0, 0.0, 1.0), 'color': (1.0, 0.0, 1.0),
'opacity': 1, 'opacity': 1,
'v_attach': 'top', 'v_attach': 'top',
'h_attach': 'center', 'h_attach': 'center',
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self.round_time = int(settings['Max Round Time'])
self.reset_round_time = int(settings['Max Round Time'])
self.should_die_occur = True
self.round_time_textnode = bs.newnode('text',
attrs={
'text': "",'flatness':1.0,'h_align':'center','h_attach':'center','v_attach':'top','v_align':'center','position':(0,-15),'scale':0.9,'color':(1,0.7,0.9)})
self.slow_motion = self._epic_mode self.slow_motion = self._epic_mode
# A cool music, matching our gamemode theme # A cool music, matching our gamemode theme
self.default_music = ba.MusicType.FLAG_CATCHER self.default_music = bs.MusicType.FLAG_CATCHER
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
return 'Catch Flag for yourself' return 'Catch Flag for yourself'
@ -104,10 +103,10 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def on_player_join(self, player: Player) -> None: def on_player_join(self, player: Player) -> None:
if self.has_begun(): if self.has_begun():
ba.screenmessage( bs.broadcastmessage(
ba.Lstr(resource='playerDelayedJoinText', bs.Lstr(resource='playerDelayedJoinText',
subs=[('${PLAYER}', player.getname(full=True))]), subs=[('${PLAYER}', player.getname(full=True))]),
color=(0, 1, 0), transient=True) color=(0, 1, 0),transient=True)
player.survived = False player.survived = False
return return
self.spawn_player(player) self.spawn_player(player)
@ -115,7 +114,7 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def on_player_leave(self, player: Player) -> None: def on_player_leave(self, player: Player) -> None:
super().on_player_leave(player) super().on_player_leave(player)
# A departing player may trigger game-over. # A departing player may trigger game-over.
self.checkEnd() bs.timer(0, self.checkEnd)
def on_begin(self) -> None: def on_begin(self) -> None:
super().on_begin() super().on_begin()
@ -124,74 +123,97 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self.nodes = [] self.nodes = []
self.flags = [] self.flags = []
self.spawned = [] self.spawned = []
self.setup_standard_time_limit(self._time_limit)
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = bs.newnode('text',
attrs={'text': "Ported by Freaku\nMade by MattZ45986", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely... attrs={ 'text':"Ported by Freaku\nMade by MattZ45986", ## Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
'scale': 0.7, 'scale':0.7,
'position': (0, 0), 'position':(0,0),
'shadow': 0.5, 'shadow':0.5,
'flatness': 1.2, 'flatness':1.2,
'color': (1, 1, 1), 'color':(1, 1, 1),
'h_align': 'center', 'h_align':'center',
'v_attach': 'bottom'}) 'v_attach':'bottom'})
self.makeRound() self.makeRound()
self._textRound.text = 'Round ' + str(self.roundNum) self._textRound.text = 'Round ' + str(self.roundNum)
ba.timer(5, self.checkEnd) bs.timer(3, self.checkEnd)
self.keepcalling = bs.timer(1, self._timeround, True)
def _timeround(self):
if self.round_time == 0 and self.should_die_occur:
self.should_die_occur = False
self.round_time_textnode.opacity = 0
bs.broadcastmessage('Proceeding Round...')
for player in self.spawned:
if not player.done:
try:
player.survived = False
player.actor.handlemessage(bs.StandMessage((0,3,-2)))
bs.timer(0.5,bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(1.5,bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(2.5,bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(3,bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
except: pass
bs.timer(3.5,self.killRound)
bs.timer(3.55,self.makeRound)
self.round_time_textnode.opacity = 0
self.round_time = self.reset_round_time
else:
self.round_time_textnode.text = "Time: " + str(self.round_time)
self.round_time -= 1
def makeRound(self): def makeRound(self):
for player in self.players: for player in self.players:
if player.survived: if player.survived: player.team.score += 1
player.team.score += 1
self.roundNum += 1 self.roundNum += 1
self._textRound.text = 'Round ' + str(self.roundNum) self._textRound.text = 'Round ' + str(self.roundNum)
self.flags = [] self.flags = []
self.spawned = [] self.spawned = []
angle = random.randint(0, 359) self.should_die_occur = True
c = 0 self.round_time = self.reset_round_time
self.round_time_textnode.opacity = 1
angle = random.randint(0,359)
c=0
for player in self.players: for player in self.players:
if player.survived: if player.survived: c+=1
c += 1
spacing = 10 spacing = 10
for player in self.players: for player in self.players:
player.done = False player.done = False
if player.survived: if player.survived:
if not player.is_alive(): if not player.is_alive():
self.spawn_player(player, (.5, 5, -4)) self.spawn_player(player,(.5,5,-4))
self.spawned.append(player) self.spawned.append(player)
try: try: spacing = 360 // (c)
spacing = 360 // (c) except: self.checkEnd()
except: colors = [(1,0,0),(0,1,0),(0,0,1),(1,1,0),(1,0,1),(0,1,1),(0,0,0),(0.5,0.8,0),(0,0.8,0.5),(0.8,0.25,0.7),(0,0.27,0.55),(2,2,0.6),(0.4,3,0.85)]
self.checkEnd()
colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (0, 0, 0), # Add support for more than 13 players
(0.5, 0.8, 0), (0, 0.8, 0.5), (0.8, 0.25, 0.7), (0, 0.27, 0.55), (2, 2, 0.6), (0.4, 3, 0.85)] if c > 12:
for i in range(c-12):
colors.append((random.uniform(0.1, 1), random.uniform(0.1, 1), random.uniform(0.1, 1)))
# Smart Mathematics: # Smart Mathematics:
# All Flags spawn same distance from the players # All Flags spawn same distance from the players
for i in range(c-1): for i in range(c-1):
angle += spacing angle += spacing
angle %= 360 angle %= 360
x = 6 * math.sin(math.degrees(angle)) x=6 * math.sin(math.degrees(angle))
z = 6 * math.cos(math.degrees(angle)) z=6 * math.cos(math.degrees(angle))
flag = Flag(position=(x+.5, 5, z-4), color=colors[i]).autoretain() flag = Flag(position=(x+.5,5,z-4), color=colors[i]).autoretain()
self.flags.append(flag) self.flags.append(flag)
def killRound(self): def killRound(self):
self.numPickedUp = 0 self.numPickedUp = 0
for player in self.players: for player in self.players:
if player.is_alive(): if player.is_alive(): player.actor.handlemessage(bs.DieMessage())
player.actor.handlemessage(ba.DieMessage()) for flag in self.flags: flag.node.delete()
for flag in self.flags: for light in self.nodes: light.delete()
flag.node.delete()
for light in self.nodes:
light.delete()
def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> ba.Actor: def spawn_player(self, player: Player, pos: tuple = (0,0,0)) -> bs.Actor:
spaz = self.spawn_player_spaz(player) spaz = self.spawn_player_spaz(player)
if pos == (0, 0, 0): if pos == (0,0,0):
pos = (-.5+random.random()*2, 3+random.random()*2, -5+random.random()*2) pos = (-.5+random.random()*2,3+random.random()*2,-5+random.random()*2)
spaz.connect_controls_to_player(enable_punch=self.is_punch, spaz.connect_controls_to_player(enable_punch=self.is_punch, enable_bomb=False, enable_run=self.is_run)
enable_bomb=False, enable_run=self.is_run) spaz.handlemessage(bs.StandMessage(pos))
spaz.handlemessage(ba.StandMessage(pos))
return spaz return spaz
def check_respawn(self, player): def check_respawn(self, player):
@ -200,36 +222,37 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.PlayerDiedMessage): if isinstance(msg, bs.PlayerDiedMessage):
super().handlemessage(msg) super().handlemessage(msg)
player = msg.getplayer(Player) player = msg.getplayer(Player)
ba.timer(0.1, ba.Call(self.check_respawn, player)) bs.timer(0.1, bs.Call(self.check_respawn, player))
ba.timer(0.5, self.checkEnd) bs.timer(0.5, self.checkEnd)
elif isinstance(msg, FlagPickedUpMessage): elif isinstance(msg, FlagPickedUpMessage):
self.numPickedUp += 1 self.numPickedUp += 1
msg.node.getdelegate(PlayerSpaz, True).getplayer(Player, True).done = True msg.node.getdelegate(PlayerSpaz, True).getplayer(Player, True).done = True
l = ba.newnode('light', l = bs.newnode('light',
owner=None, owner=None,
attrs={'color': msg.node.color, attrs={'color':msg.node.color,
'position': (msg.node.position_center), 'position':(msg.node.position_center),
'intensity': 1}) 'intensity':1})
self.nodes.append(l) self.nodes.append(l)
msg.flag.handlemessage(ba.DieMessage()) msg.flag.handlemessage(bs.DieMessage())
msg.node.handlemessage(ba.DieMessage()) msg.node.handlemessage(bs.DieMessage())
msg.node.delete() msg.node.delete()
if self.numPickedUp == len(self.flags): if self.numPickedUp == len(self.flags):
self.round_time_textnode.opacity = 0
self.round_time = self.reset_round_time
for player in self.spawned: for player in self.spawned:
if not player.done: if not player.done:
try: try:
player.survived = False player.survived = False
ba.screenmessage("No Flag? "+player.getname()) bs.broadcastmessage("No Flag? "+player.getname())
player.actor.handlemessage(ba.StandMessage((0, 3, -2))) player.actor.handlemessage(bs.StandMessage((0,3,-2)))
ba.timer(0.5, ba.Call(player.actor.handlemessage, ba.FreezeMessage())) bs.timer(0.5,bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
ba.timer(3, ba.Call(player.actor.handlemessage, ba.ShouldShatterMessage())) bs.timer(3,bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
except: except: pass
pass bs.timer(3.5,self.killRound)
ba.timer(3.5, self.killRound) bs.timer(3.55,self.makeRound)
ba.timer(3.55, self.makeRound)
else: else:
return super().handlemessage(msg) return super().handlemessage(msg)
return None return None
@ -238,15 +261,15 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
i = 0 i = 0
for player in self.players: for player in self.players:
if player.survived: if player.survived:
i += 1 i+=1
if i <= 1: if i <= 1:
for player in self.players: for player in self.players:
if player.survived: if player.survived:
player.team.score += 10 player.team.score += 10
ba.timer(2.5, self.end_game) bs.timer(2.5, self.end_game)
def end_game(self) -> None: def end_game(self) -> None:
results = ba.GameResults() results = bs.GameResults()
for team in self.teams: for team in self.teams:
results.set_team_score(team, team.score) results.set_team_score(team, team.score)
self.end(results=results) self.end(results=results)

View file

@ -1,16 +1,22 @@
# Volley Ball (final) # Volley Ball (final)
# Made by your friend: Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
# Join BCS: # Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
# My GitHub: # My GitHub:
# https://github.com/Freaku17/BombSquad-Mods-byFreaku # https://github.com/Freaku17/BombSquad-Mods-byFreaku
# CHANGELOG: # CHANGELOG:
""" """
## 2021 ## 2021
@ -28,30 +34,37 @@
## 2022 ## 2022
- Code cleanup - Code cleanup
- No longer requires a plugin
- More accurate Goal positions - More accurate Goal positions
""" """
# ba_meta require api 7
# ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import babase, random
import ba import bascenev1 as bs
import random from bascenev1lib.actor.playerspaz import PlayerSpaz
from bastd.actor.playerspaz import PlayerSpaz from bascenev1lib.actor.scoreboard import Scoreboard
from bastd.actor.scoreboard import Scoreboard from bascenev1lib.actor.powerupbox import PowerupBoxFactory
from bastd.actor.powerupbox import PowerupBoxFactory from bascenev1lib.actor.bomb import BombFactory
from bastd.actor.bomb import BombFactory from bascenev1lib.gameutils import SharedObjects
from bastd.gameutils import SharedObjects
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union from typing import Any, Sequence, Dict, Type, List, Optional, Union
class PuckDiedMessage: class PuckDiedMessage:
"""Inform something that a puck has died.""" """Inform something that a puck has died."""
@ -59,7 +72,7 @@ class PuckDiedMessage:
self.puck = puck self.puck = puck
class Puck(ba.Actor): class Puck(bs.Actor):
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0)): def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0)):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
@ -72,16 +85,16 @@ class Puck(ba.Actor):
assert activity is not None assert activity is not None
assert isinstance(activity, VolleyBallGame) assert isinstance(activity, VolleyBallGame)
pmats = [shared.object_material, activity.puck_material] pmats = [shared.object_material, activity.puck_material]
self.node = ba.newnode('prop', self.node = bs.newnode('prop',
delegate=self, delegate=self,
attrs={ attrs={
'model': activity.puck_model, 'mesh': activity.puck_mesh,
'color_texture': activity.puck_tex, 'color_texture': activity.puck_tex,
'body': 'sphere', 'body': 'sphere',
'reflection': 'soft', 'reflection': 'soft',
'reflection_scale': [0.2], 'reflection_scale': [0.2],
'shadow_size': 0.6, 'shadow_size': 0.6,
'model_scale': 0.4, 'mesh_scale': 0.4,
'body_scale': 1.07, 'body_scale': 1.07,
'is_area_of_interest': True, 'is_area_of_interest': True,
'position': self._spawn_pos, 'position': self._spawn_pos,
@ -91,11 +104,12 @@ class Puck(ba.Actor):
# Since it rolls on spawn, lets make gravity # Since it rolls on spawn, lets make gravity
# to 0, and when another node (bomb/spaz) # to 0, and when another node (bomb/spaz)
# touches it. It'll act back as our normie puck! # touches it. It'll act back as our normie puck!
ba.animate(self.node, 'gravity_scale', {0: -0.1, 0.2: 1}, False) bs.animate(self.node, 'gravity_scale', {0:-0.1, 0.2:1}, False)
# When other node touches, it realises its new gravity_scale # When other node touches, it realises its new gravity_scale
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.DieMessage): if isinstance(msg, bs.DieMessage):
assert self.node assert self.node
self.node.delete() self.node.delete()
activity = self._activity() activity = self._activity()
@ -103,11 +117,11 @@ class Puck(ba.Actor):
activity.handlemessage(PuckDiedMessage(self)) activity.handlemessage(PuckDiedMessage(self))
# If we go out of bounds, move back to where we started. # If we go out of bounds, move back to where we started.
elif isinstance(msg, ba.OutOfBoundsMessage): elif isinstance(msg, bs.OutOfBoundsMessage):
assert self.node assert self.node
self.node.position = self._spawn_pos self.node.position = self._spawn_pos
elif isinstance(msg, ba.HitMessage): elif isinstance(msg, bs.HitMessage):
assert self.node assert self.node
assert msg.force_direction is not None assert msg.force_direction is not None
self.node.handlemessage( self.node.handlemessage(
@ -128,29 +142,28 @@ class Puck(ba.Actor):
super().handlemessage(msg) super().handlemessage(msg)
class Player(ba.Player['Team']): class Player(bs.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
class Team(ba.Team[Player]): class Team(bs.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
def __init__(self) -> None: def __init__(self) -> None:
self.score = 0 self.score = 0
# ba_meta export game # ba_meta export bascenev1.GameActivity
class VolleyBallGame(ba.TeamGameActivity[Player, Team]): class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
name = 'Volley Ball' name = 'Volley Ball'
description = 'Score some goals.\nby \ue048Freaku' description = 'Score some goals.\nby \ue048Freaku'
available_settings = [ available_settings = [
ba.IntSetting( bs.IntSetting(
'Score to Win', 'Score to Win',
min_value=1, min_value=1,
default=1, default=1,
increment=1, increment=1,
), ),
ba.IntChoiceSetting( bs.IntChoiceSetting(
'Time Limit', 'Time Limit',
choices=[ choices=[
('None', 0), ('None', 0),
@ -162,7 +175,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
], ],
default=0, default=0,
), ),
ba.FloatChoiceSetting( bs.FloatChoiceSetting(
'Respawn Times', 'Respawn Times',
choices=[ choices=[
('Shorter', 0.25), ('Shorter', 0.25),
@ -173,36 +186,36 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
], ],
default=1.0, default=1.0,
), ),
ba.BoolSetting('Epic Mode', True), bs.BoolSetting('Epic Mode', True),
ba.BoolSetting('Night Mode', False), bs.BoolSetting('Night Mode', False),
ba.BoolSetting('Icy Floor', True), bs.BoolSetting('Icy Floor', True),
ba.BoolSetting('Disable Punch', False), bs.BoolSetting('Disable Punch', False),
ba.BoolSetting('Disable Bombs', False), bs.BoolSetting('Disable Bombs', False),
ba.BoolSetting('Enable Bottom Credits', True), bs.BoolSetting('Enable Bottom Credits', True),
] ]
default_music = ba.MusicType.HOCKEY default_music = bs.MusicType.HOCKEY
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return issubclass(sessiontype, ba.DualTeamSession) return issubclass(sessiontype, bs.DualTeamSession)
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return ['Open Field', 'Closed Arena'] return ['Open Field', 'Closed Arena']
def __init__(self, settings: dict): def __init__(self, settings: dict):
super().__init__(settings) super().__init__(settings)
shared = SharedObjects.get() shared = SharedObjects.get()
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
self._cheer_sound = ba.getsound('cheer') self._cheer_sound = bs.getsound('cheer')
self._chant_sound = ba.getsound('crowdChant') self._chant_sound = bs.getsound('crowdChant')
self._foghorn_sound = ba.getsound('foghorn') self._foghorn_sound = bs.getsound('foghorn')
self._swipsound = ba.getsound('swip') self._swipsound = bs.getsound('swip')
self._whistle_sound = ba.getsound('refWhistle') self._whistle_sound = bs.getsound('refWhistle')
self.puck_model = ba.getmodel('shield') self.puck_mesh = bs.getmesh('shield')
self.puck_tex = ba.gettexture('gameCircleIcon') self.puck_tex = bs.gettexture('gameCircleIcon')
self._puck_sound = ba.getsound('metalHit') self._puck_sound = bs.getsound('metalHit')
self.puck_material = ba.Material() self.puck_material = bs.Material()
self.puck_material.add_actions(actions=(('modify_part_collision', self.puck_material.add_actions(actions=(('modify_part_collision',
'friction', 0.5))) 'friction', 0.5)))
self.puck_material.add_actions(conditions=('they_have_material', self.puck_material.add_actions(conditions=('they_have_material',
@ -233,21 +246,22 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
conditions=('they_have_material', conditions=('they_have_material',
PowerupBoxFactory.get().powerup_material), PowerupBoxFactory.get().powerup_material),
actions=(('modify_part_collision', 'physical', False), actions=(('modify_part_collision', 'physical', False),
('message', 'their_node', 'at_connect', ba.DieMessage()))) ('message', 'their_node', 'at_connect', bs.DieMessage())))
self._score_region_material = ba.Material() self._score_region_material = bs.Material()
self._score_region_material.add_actions( self._score_region_material.add_actions(
conditions=('they_have_material', self.puck_material), conditions=('they_have_material', self.puck_material),
actions=(('modify_part_collision', 'collide', actions=(('modify_part_collision', 'collide',
True), ('modify_part_collision', 'physical', False), True), ('modify_part_collision', 'physical', False),
('call', 'at_connect', self._handle_score))) ('call', 'at_connect', self._handle_score)))
self._wall_material = ba.Material()
self._fake_wall_material = ba.Material() self._wall_material=bs.Material()
self._fake_wall_material=bs.Material()
self._wall_material.add_actions( self._wall_material.add_actions(
actions=( actions=(
('modify_part_collision', 'friction', 100000), ('modify_part_collision', 'friction', 100000),
)) ))
self._wall_material.add_actions( self._wall_material.add_actions(
conditions=('they_have_material', shared.pickup_material), conditions=('they_have_material', shared.pickup_material),
actions=( actions=(
@ -256,13 +270,13 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._wall_material.add_actions( self._wall_material.add_actions(
conditions=(('we_are_younger_than', 100), conditions=(('we_are_younger_than', 100),
'and', 'and',
('they_have_material', shared.object_material)), ('they_have_material',shared.object_material)),
actions=( actions=(
('modify_part_collision', 'collide', False), ('modify_part_collision', 'collide', False),
)) ))
self._wall_material.add_actions( self._wall_material.add_actions(
conditions=('they_have_material', shared.footing_material), conditions=('they_have_material',shared.footing_material),
actions=( actions=(
('modify_part_collision', 'friction', 9999.5), ('modify_part_collision', 'friction', 9999.5),
)) ))
@ -280,9 +294,10 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
('modify_part_collision', 'physical', True) ('modify_part_collision', 'physical', True)
)) ))
self.blocks = [] self.blocks=[]
self._net_wall_material = ba.Material()
self._net_wall_material=bs.Material()
self._net_wall_material.add_actions( self._net_wall_material.add_actions(
conditions=('they_have_material', shared.player_material), conditions=('they_have_material', shared.player_material),
actions=( actions=(
@ -306,10 +321,11 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
actions=( actions=(
('modify_part_collision', 'collide', True), ('modify_part_collision', 'collide', True),
)) ))
self.net_blocc = [] self.net_blocc=[]
self._puck_spawn_pos: Optional[Sequence[float]] = None self._puck_spawn_pos: Optional[Sequence[float]] = None
self._score_regions: Optional[List[ba.NodeActor]] = None self._score_regions: Optional[List[bs.NodeActor]] = None
self._puck: Optional[Puck] = None self._puck: Optional[Puck] = None
self._score_to_win = int(settings['Score to Win']) self._score_to_win = int(settings['Score to Win'])
self._punchie_ = bool(settings['Disable Punch']) self._punchie_ = bool(settings['Disable Punch'])
@ -321,8 +337,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._epic_mode = bool(settings['Epic Mode']) self._epic_mode = bool(settings['Epic Mode'])
# Base class overrides. # Base class overrides.
self.slow_motion = self._epic_mode self.slow_motion = self._epic_mode
self.default_music = (ba.MusicType.EPIC if self._epic_mode else self.default_music = (bs.MusicType.EPIC if self._epic_mode else
ba.MusicType.TO_THE_DEATH) bs.MusicType.TO_THE_DEATH)
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
if self._score_to_win == 1: if self._score_to_win == 1:
@ -339,60 +355,58 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self.setup_standard_time_limit(self._time_limit) self.setup_standard_time_limit(self._time_limit)
if self._night_mode: if self._night_mode:
ba.getactivity().globalsnode.tint = (0.5, 0.7, 1) bs.getactivity().globalsnode.tint = (0.5, 0.7, 1)
self._puck_spawn_pos = self.map.get_flag_position(None) self._puck_spawn_pos = self.map.get_flag_position(None)
self._spawn_puck() self._spawn_puck()
# Set up the two score regions. # Set up the two score regions.
self._score_regions = [] self._score_regions = []
self._score_regions.append( self._score_regions.append(
ba.NodeActor( bs.NodeActor(
ba.newnode('region', bs.newnode('region',
attrs={ attrs={
'position': (5.7, 0, -0.065), 'position':(5.7, 0, -0.065),
'scale': (10.7, 0.001, 8), 'scale': (10.7, 0.001, 8),
'type': 'box', 'type': 'box',
'materials': [self._score_region_material] 'materials': [self._score_region_material]
}))) })))
self._score_regions.append( self._score_regions.append(
ba.NodeActor( bs.NodeActor(
ba.newnode('region', bs.newnode('region',
attrs={ attrs={
'position': (-5.7, 0, -0.065), 'position':(-5.7, 0, -0.065),
'scale': (10.7, 0.001, 8), 'scale': (10.7, 0.001, 8),
'type': 'box', 'type': 'box',
'materials': [self._score_region_material] 'materials': [self._score_region_material]
}))) })))
self._update_scoreboard() self._update_scoreboard()
ba.playsound(self._chant_sound) self._chant_sound.play()
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = bs.newnode('text',
attrs={'text': "Created by Freaku\nVolleyBall", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely... attrs={ 'text':"Created by Freaku\nVolleyBall", ## Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
'scale': 0.7, 'scale':0.7,
'position': (0, 0), 'position':(0,0),
'shadow': 0.5, 'shadow':0.5,
'flatness': 1.2, 'flatness':1.2,
'color': (1, 1, 1), 'color':(1, 1, 1),
'h_align': 'center', 'h_align':'center',
'v_attach': 'bottom'}) 'v_attach':'bottom'})
shared = SharedObjects.get() shared = SharedObjects.get()
self.blocks.append(ba.NodeActor(ba.newnode('region', attrs={'position': (0, 2.4, 0), 'scale': ( self.blocks.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,2.4,0),'scale': (0.8,6,20),'type': 'box','materials': (self._fake_wall_material, )})))
0.8, 6, 20), 'type': 'box', 'materials': (self._fake_wall_material, )})))
self.net_blocc.append(ba.NodeActor(ba.newnode('region', attrs={'position': (0, 0, 0), 'scale': ( self.net_blocc.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,0,0),'scale': (0.6,2.4,20),'type': 'box','materials': (self._net_wall_material, )})))
0.6, 2.4, 20), 'type': 'box', 'materials': (self._net_wall_material, )})))
def on_team_join(self, team: Team) -> None: def on_team_join(self, team: Team) -> None:
self._update_scoreboard() self._update_scoreboard()
def _handle_puck_player_collide(self) -> None: def _handle_puck_player_collide(self) -> None:
collision = ba.getcollision() collision = bs.getcollision()
try: try:
puck = collision.sourcenode.getdelegate(Puck, True) puck = collision.sourcenode.getdelegate(Puck, True)
player = collision.opposingnode.getdelegate(PlayerSpaz, player = collision.opposingnode.getdelegate(PlayerSpaz,
True).getplayer( True).getplayer(
Player, True) Player, True)
except ba.NotFoundError: except bs.NotFoundError:
return return
puck.last_players_to_touch[player.team.id] = player puck.last_players_to_touch[player.team.id] = player
@ -409,7 +423,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if self._puck.scored: if self._puck.scored:
return return
region = ba.getcollision().sourcenode region = bs.getcollision().sourcenode
index = 0 index = 0
for index in range(len(self._score_regions)): for index in range(len(self._score_regions)):
if region == self._score_regions[index].node: if region == self._score_regions[index].node:
@ -420,18 +434,21 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
scoring_team = team scoring_team = team
team.score += 1 team.score += 1
# Change puck Spawn # Change puck Spawn
if team.id == 0: # left side scored if team.id == 0: # left side scored
self._puck_spawn_pos = (5, 0.42, 0) self._puck_spawn_pos= (5, 0.42, 0)
elif team.id == 1: # right side scored elif team.id == 1: # right side scored
self._puck_spawn_pos = (-5, 0.42, 0) self._puck_spawn_pos= (-5, 0.42, 0)
else: # normally shouldn't occur else: # normally shouldn't occur
self._puck_spawn_pos = (0, 0.42, 0) self._puck_spawn_pos= (0, 0.42, 0)
# Easy pizzy # Easy pizzy
for player in team.players: for player in team.players:
if player.actor: if player.actor:
player.actor.handlemessage(ba.CelebrateMessage(2.0)) player.actor.handlemessage(bs.CelebrateMessage(2.0))
# If we've got the player from the scoring team that last # If we've got the player from the scoring team that last
# touched us, give them points. # touched us, give them points.
@ -446,28 +463,28 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if team.score >= self._score_to_win: if team.score >= self._score_to_win:
self.end_game() self.end_game()
ba.playsound(self._foghorn_sound) self._foghorn_sound.play()
ba.playsound(self._cheer_sound) self._cheer_sound.play()
self._puck.scored = True self._puck.scored = True
# Kill the puck (it'll respawn itself shortly). # Kill the puck (it'll respawn itself shortly).
ba.emitfx(position=ba.getcollision().position, count=int( bs.emitfx(position= bs.getcollision().position, count=int(6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark') bs.timer(0.7, self._kill_puck)
ba.timer(0.7, self._kill_puck)
ba.cameraflash(duration=7.0)
bs.cameraflash(duration=7.0)
self._update_scoreboard() self._update_scoreboard()
def end_game(self) -> None: def end_game(self) -> None:
results = ba.GameResults() results = bs.GameResults()
for team in self.teams: for team in self.teams:
results.set_team_score(team, team.score) results.set_team_score(team, team.score)
self.end(results=results) self.end(results=results)
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
super().on_transition_in() super().on_transition_in()
activity = ba.getactivity() activity = bs.getactivity()
if self._icy_flooor: if self._icy_flooor:
activity.map.is_hockey = True activity.map.is_hockey = True
@ -477,7 +494,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._scoreboard.set_team_value(team, team.score, winscore) self._scoreboard.set_team_value(team, team.score, winscore)
# overriding the default character spawning.. # overriding the default character spawning..
def spawn_player(self, player: Player) -> ba.Actor: def spawn_player(self, player: Player) -> bs.Actor:
spaz = self.spawn_player_spaz(player) spaz = self.spawn_player_spaz(player)
if self._bombies_: if self._bombies_:
@ -485,6 +502,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
spaz.bomb_count = 0 spaz.bomb_count = 0
# Imagine not being able to swipe those colorful buttons ;( # Imagine not being able to swipe those colorful buttons ;(
if self._punchie_: if self._punchie_:
spaz.connect_controls_to_player(enable_punch=False) spaz.connect_controls_to_player(enable_punch=False)
@ -493,7 +511,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
# Respawn dead players if they're still in the game. # Respawn dead players if they're still in the game.
if isinstance(msg, ba.PlayerDiedMessage): if isinstance(msg, bs.PlayerDiedMessage):
# Augment standard behavior... # Augment standard behavior...
super().handlemessage(msg) super().handlemessage(msg)
self.respawn_player(msg.getplayer(Player)) self.respawn_player(msg.getplayer(Player))
@ -501,44 +519,62 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
# Respawn dead pucks. # Respawn dead pucks.
elif isinstance(msg, PuckDiedMessage): elif isinstance(msg, PuckDiedMessage):
if not self.has_ended(): if not self.has_ended():
ba.timer(2.2, self._spawn_puck) bs.timer(2.2, self._spawn_puck)
else: else:
super().handlemessage(msg) super().handlemessage(msg)
def _flash_puck_spawn(self) -> None: def _flash_puck_spawn(self) -> None:
# Effect >>>>>> Flashly # Effect >>>>>> Flashly
ba.emitfx(position=self._puck_spawn_pos, count=int( bs.emitfx(position= self._puck_spawn_pos, count=int(6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
def _spawn_puck(self) -> None: def _spawn_puck(self) -> None:
ba.playsound(self._swipsound) self._swipsound.play()
ba.playsound(self._whistle_sound) self._whistle_sound.play()
self._flash_puck_spawn() self._flash_puck_spawn()
assert self._puck_spawn_pos is not None assert self._puck_spawn_pos is not None
self._puck = Puck(position=self._puck_spawn_pos) self._puck = Puck(position=self._puck_spawn_pos)
class Pointzz: class Pointzz:
points, boxes = {}, {} points, boxes = {}, {}
points['spawn1'] = (-8.03866, 0.02275, 0.0) + (0.5, 0.05, 4.0) points['spawn1'] = (-8.03866, 0.02275, 0.0) + (0.5, 0.05, 4.0)
points['spawn2'] = (8.82311, 0.01092, 0.0) + (0.5, 0.05, 4.0) points['spawn2'] = (8.82311, 0.01092, 0.0) + (0.5, 0.05, 4.0)
boxes['area_of_interest_bounds'] = (0.0, 1.18575, 0.43262) + \ boxes['area_of_interest_bounds'] = (0.0, 1.18575, 0.43262) + (0, 0, 0) + (29.81803, 11.57249, 18.89134)
(0, 0, 0) + (29.81803, 11.57249, 18.89134)
boxes['map_bounds'] = (0.0, 1.185751251, 0.4326226188) + (0.0, 0.0, 0.0) + ( boxes['map_bounds'] = (0.0, 1.185751251, 0.4326226188) + (0.0, 0.0, 0.0) + (
42.09506485, 22.81173179, 29.76723155) 42.09506485, 22.81173179, 29.76723155)
class PointzzforH: class PointzzforH:
points, boxes = {}, {} points, boxes = {}, {}
boxes['area_of_interest_bounds'] = (0.0, 0.7956858119, 0.0) + \ boxes['area_of_interest_bounds'] = (0.0, 0.7956858119, 0.0) + (0.0, 0.0, 0.0) + (30.80223883, 0.5961646365, 13.88431707)
(0.0, 0.0, 0.0) + (30.80223883, 0.5961646365, 13.88431707)
boxes['map_bounds'] = (0.0, 0.7956858119, -0.4689020853) + (0.0, 0.0, 0.0) + ( boxes['map_bounds'] = (0.0, 0.7956858119, -0.4689020853) + (0.0, 0.0, 0.0) + (
35.16182389, 12.18696164, 21.52869693) 35.16182389, 12.18696164, 21.52869693)
points['spawn1'] = (-6.835352227, 0.02305323209, 0.0) + (1.0, 1.0, 3.0) points['spawn1'] = (-6.835352227, 0.02305323209, 0.0) + (1.0, 1.0, 3.0)
points['spawn2'] = (6.857415055, 0.03938567998, 0.0) + (1.0, 1.0, 3.0) points['spawn2'] = (6.857415055, 0.03938567998, 0.0) + (1.0, 1.0, 3.0)
class VolleyBallMap(ba.Map):
class VolleyBallMap(bs.Map):
defs = Pointzz() defs = Pointzz()
name = "Open Field" name = "Open Field"
@ -553,10 +589,10 @@ class VolleyBallMap(ba.Map):
@classmethod @classmethod
def on_preload(cls) -> Any: def on_preload(cls) -> Any:
data: Dict[str, Any] = { data: Dict[str, Any] = {
'model': ba.getmodel('footballStadium'), 'mesh': bs.getmesh('footballStadium'),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'), 'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('footballStadiumCollide'), 'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
'tex': ba.gettexture('footballStadium') 'tex': bs.gettexture('footballStadium')
} }
return data return data
@ -564,61 +600,61 @@ class VolleyBallMap(ba.Map):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
x = -5 x = -5
while x < 5: while x<5:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, 0, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .25, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .5, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .75, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, 1, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
x = x + 0.5 x = x + 0.5
y = -1 y = -1
while y > -11: while y>-11:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (y, 0.01, 4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (y, 0.01, -4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-y, 0.01, 4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-y, 0.01, -4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
y -= 1 y-=1
z = 0 z = 0
while z < 5: while z<5:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (11, 0.01, z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (11, 0.01, -z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-11, 0.01, z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-11, 0.01, -z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
z += 1 z+=1
self.node = ba.newnode( self.node = bs.newnode(
'terrain', 'terrain',
delegate=self, delegate=self,
attrs={ attrs={
'model': self.preloaddata['model'], 'mesh': self.preloaddata['mesh'],
'collide_model': self.preloaddata['collide_model'], 'collision_mesh': self.preloaddata['collision_mesh'],
'color_texture': self.preloaddata['tex'], 'color_texture': self.preloaddata['tex'],
'materials': [shared.footing_material] 'materials': [shared.footing_material]
}) })
ba.newnode('terrain', bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['vr_fill_model'], 'mesh': self.preloaddata['vr_fill_mesh'],
'lighting': False, 'lighting': False,
'vr_only': True, 'vr_only': True,
'background': True, 'background': True,
'color_texture': self.preloaddata['tex'] 'color_texture': self.preloaddata['tex']
}) })
gnode = ba.getactivity().globalsnode gnode = bs.getactivity().globalsnode
gnode.tint = (1.3, 1.2, 1.0) gnode.tint = (1.3, 1.2, 1.0)
gnode.ambient_color = (1.3, 1.2, 1.0) gnode.ambient_color = (1.3, 1.2, 1.0)
gnode.vignette_outer = (0.57, 0.57, 0.57) gnode.vignette_outer = (0.57, 0.57, 0.57)
@ -627,7 +663,8 @@ class VolleyBallMap(ba.Map):
gnode.vr_near_clip = 0.5 gnode.vr_near_clip = 0.5
class VolleyBallMapH(ba.Map):
class VolleyBallMapH(bs.Map):
defs = PointzzforH() defs = PointzzforH()
name = 'Closed Arena' name = 'Closed Arena'
@ -642,13 +679,13 @@ class VolleyBallMapH(ba.Map):
@classmethod @classmethod
def on_preload(cls) -> Any: def on_preload(cls) -> Any:
data: Dict[str, Any] = { data: Dict[str, Any] = {
'models': (ba.getmodel('hockeyStadiumOuter'), 'meshs': (bs.getmesh('hockeyStadiumOuter'),
ba.getmodel('hockeyStadiumInner')), bs.getmesh('hockeyStadiumInner')),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'), 'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('hockeyStadiumCollide'), 'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
'tex': ba.gettexture('hockeyStadium'), 'tex': bs.gettexture('hockeyStadium'),
} }
mat = ba.Material() mat = bs.Material()
mat.add_actions(actions=('modify_part_collision', 'friction', 0.01)) mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
data['ice_material'] = mat data['ice_material'] = mat
return data return data
@ -657,84 +694,83 @@ class VolleyBallMapH(ba.Map):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
x = -5 x = -5
while x < 5: while x<5:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, 0, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .25, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .5, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, .75, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (0, 1, x), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
x = x + 0.5 x = x + 0.5
y = -1 y = -1
while y > -11: while y>-11:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (y, 0.01, 4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (y, 0.01, -4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-y, 0.01, 4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-y, 0.01, -4), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
y -= 1 y-=1
z = 0 z = 0
while z < 5: while z<5:
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (11, 0.01, z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (11, 0.01, -z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-11, 0.01, z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator', attrs={'shape': 'circle', 'position': (-11, 0.01, -z), self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]}) 'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
z += 1 z+=1
self.node = ba.newnode('terrain', self.node = bs.newnode('terrain',
delegate=self, delegate=self,
attrs={ attrs={
'model': 'mesh':
None, None,
'collide_model': 'collision_mesh':
# we dont want Goalposts... bs.getcollisionmesh('footballStadiumCollide'), # we dont want Goalposts...
ba.getcollidemodel('footballStadiumCollide'),
'color_texture': 'color_texture':
self.preloaddata['tex'], self.preloaddata['tex'],
'materials': [ 'materials': [
shared.footing_material] shared.footing_material]
}) })
ba.newnode('terrain', bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['vr_fill_model'], 'mesh': self.preloaddata['vr_fill_mesh'],
'vr_only': True, 'vr_only': True,
'lighting': False, 'lighting': False,
'background': True, 'background': True,
}) })
mats = [shared.footing_material] mats = [shared.footing_material]
self.floor = ba.newnode('terrain', self.floor = bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['models'][1], 'mesh': self.preloaddata['meshs'][1],
'color_texture': self.preloaddata['tex'], 'color_texture': self.preloaddata['tex'],
'opacity': 0.92, 'opacity': 0.92,
'opacity_in_low_or_medium_quality': 1.0, 'opacity_in_low_or_medium_quality': 1.0,
'materials': mats, 'materials': mats,
'color': (0.4, 0.9, 0) 'color': (0.4,0.9,0)
}) })
self.background = ba.newnode( self.background = bs.newnode(
'terrain', 'terrain',
attrs={ attrs={
'model': ba.getmodel('natureBackground'), 'mesh': bs.getmesh('natureBackground'),
'lighting': False, 'lighting': False,
'background': True, 'background': True,
'color': (0.5, 0.30, 0.4) 'color': (0.5,0.30,0.4)
}) })
gnode = ba.getactivity().globalsnode gnode = bs.getactivity().globalsnode
gnode.floor_reflection = True gnode.floor_reflection = True
gnode.debris_friction = 0.3 gnode.debris_friction = 0.3
gnode.debris_kill_height = -0.3 gnode.debris_kill_height = -0.3
@ -747,5 +783,19 @@ class VolleyBallMapH(ba.Map):
#self.is_hockey = True #self.is_hockey = True
ba._map.register_map(VolleyBallMap)
ba._map.register_map(VolleyBallMapH)
bs._map.register_map(VolleyBallMap)
bs._map.register_map(VolleyBallMapH)
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
# Reason of plugin:
# To register maps.
#
# Then why not include function here?
# On server upon first launch, plugins are not activated,
# (same can be case for user if disabled auto-enable plugins)
pass