bombsquad-plugin-manager/plugins/minigames/hot_bomb.py

1669 lines
56 KiB
Python
Raw Normal View History

2023-04-29 12:04:57 -05:00
# Released under the MIT License. See LICENSE for details.
#
"""Hot Bomb game by SEBASTIAN2059 and zPanxo"""
2023-06-07 22:37:04 -05:00
# ba_meta require api 8
2023-04-29 12:04:57 -05:00
# (see https://ballistica.net/wiki/meta-tag-system)
from __future__ import annotations
from typing import TYPE_CHECKING
import random
2023-06-07 22:37:04 -05:00
from bascenev1lib.actor.playerspaz import PlayerSpaz
from bascenev1lib.actor.scoreboard import Scoreboard
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
from bascenev1lib.gameutils import SharedObjects
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.actor.spaz import PickupMessage, BombDiedMessage
from bascenev1._messages import StandMessage
import bascenev1 as bs
import _bascenev1 as _bs
import _babase
2023-04-29 12:04:57 -05:00
if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
class BallDiedMessage:
"""Inform something that a ball has died."""
def __init__(self, ball: Ball):
self.ball = ball
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
class ExplodeHitMessage:
"""Tell an object it was hit by an explosion."""
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
class Ball(bs.Actor):
2023-04-29 12:04:57 -05:00
"""A lovely bomb mortal"""
2023-06-08 03:40:59 +00:00
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0), timer: int = 5, d_time=0.2, color=(1, 1, 1)):
2023-04-29 12:04:57 -05:00
super().__init__()
shared = SharedObjects.get()
activity = self.getactivity()
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.explosion_material = bs.Material()
2023-04-29 12:04:57 -05:00
self.explosion_material.add_actions(
conditions=(
'they_have_material', shared.object_material
2023-06-08 03:40:59 +00:00
),
2023-04-29 12:04:57 -05:00
actions=(
('modify_part_collision', 'collide', True),
('modify_part_collision', 'physical', False),
('message', 'our_node', 'at_connect', ExplodeHitMessage()),
),
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
bs.getsound('scamper01').play(volume=0.4)
2023-04-29 12:04:57 -05:00
# Spawn just above the provided point.
self._spawn_pos = (position[0], position[1] + 1.0, position[2])
self.last_players_to_touch: Dict[int, Player] = {}
self.scored = False
assert activity is not None
assert isinstance(activity, HotBombGame)
pmats = [shared.object_material, activity.ball_material]
2023-06-07 22:37:04 -05:00
self.node = bs.newnode('prop',
2023-04-29 12:04:57 -05:00
delegate=self,
attrs={
2023-06-07 22:37:04 -05:00
'mesh': activity.ball_mesh,
2023-04-29 12:04:57 -05:00
'color_texture': activity.ball_tex,
'body': activity.ball_body,
'body_scale': 1.0 if activity.ball_body == 'sphere' else 0.8,
2023-06-08 03:40:59 +00:00
'density': 1.0 if activity.ball_body == 'sphere' else 1.2,
2023-04-29 12:04:57 -05:00
'reflection': 'soft',
'reflection_scale': [0.2],
'shadow_size': 0.5,
'is_area_of_interest': True,
'position': self._spawn_pos,
'materials': pmats
2023-06-08 03:40:59 +00:00
}
)
self._animate = None
2023-04-29 12:04:57 -05:00
self.scale = 1.0 if activity.ball_body == 'sphere' else 0.8
2023-06-08 03:40:59 +00:00
self.color_l = (1, 1, 1)
2023-06-07 22:37:04 -05:00
self.light = bs.newnode('light',
2023-06-08 03:40:59 +00:00
owner=self.node,
2023-04-29 12:04:57 -05:00
attrs={
2023-06-08 03:40:59 +00:00
'color': color,
2023-04-29 12:04:57 -05:00
'volume_intensity_scale': 0.4,
2023-06-08 03:40:59 +00:00
'intensity': 0.5,
'radius': 0.10
}
2023-04-29 12:04:57 -05:00
)
2023-06-08 03:40:59 +00:00
self.node.connectattr('position', self.light, 'position')
2023-04-29 12:04:57 -05:00
self.animate_light = None
2023-06-08 03:40:59 +00:00
self._particles = bs.Timer(0.1, call=bs.WeakCall(self.particles), repeat=True)
self._sound_effect = bs.Timer(4, call=bs.WeakCall(self.sound_effect), repeat=True)
2023-04-29 12:04:57 -05:00
self.d_time = d_time
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if timer is not None:
timer = int(timer)
self._timer = timer
2023-06-07 22:37:04 -05:00
self._counter: Optional[bs.Node]
2023-04-29 12:04:57 -05:00
if self._timer is not None:
self._count = self._timer
2023-06-07 22:37:04 -05:00
self._tick_timer = bs.Timer(1.0,
call=bs.WeakCall(self._tick),
2023-04-29 12:04:57 -05:00
repeat=True)
2023-06-08 03:40:59 +00:00
m = bs.newnode('math', owner=self.node, attrs={
'input1': (0, 0.6, 0), 'operation': 'add'})
2023-04-29 12:04:57 -05:00
self.node.connectattr('position', m, 'input2')
2023-06-07 22:37:04 -05:00
self._counter = bs.newnode(
2023-06-08 03:40:59 +00:00
'text',
owner=self.node,
attrs={
'text': str(timer),
'in_world': True,
'shadow': 1.0,
'flatness': 0.7,
'color': (1, 1, 1),
'scale': 0.013,
'h_align': 'center'
}
)
2023-04-29 12:04:57 -05:00
m.connectattr('output', self._counter, 'position')
else:
self._counter = None
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def particles(self):
if self.node:
2023-06-07 22:37:04 -05:00
bs.emitfx(
2023-04-29 12:04:57 -05:00
position=self.node.position,
2023-06-08 03:40:59 +00:00
velocity=(0, 3, 0),
2023-04-29 12:04:57 -05:00
count=9,
scale=2.5,
spread=0.2,
chunk_type='sweat'
2023-06-08 03:40:59 +00:00
)
2023-04-29 12:04:57 -05:00
def sound_effect(self):
if self.node:
2023-06-07 22:37:04 -05:00
bs.getsound('scamper01').play(volume=0.4)
2023-06-08 03:40:59 +00:00
def explode(self, color=(3, 1, 0)) -> None:
sound = random.choice(['explosion01', 'explosion02',
'explosion03', 'explosion04', 'explosion05'])
2023-06-07 22:37:04 -05:00
bs.getsound(sound).play(volume=1)
bs.emitfx(position=self.node.position,
2023-06-08 03:40:59 +00:00
velocity=(0, 10, 0),
count=100,
scale=1.0,
spread=1.0,
chunk_type='spark')
2023-06-07 22:37:04 -05:00
explosion = bs.newnode(
2023-06-08 03:40:59 +00:00
'explosion',
attrs={
'position': self.node.position,
'velocity': (0, 0, 0),
'radius': 2.0,
'big': False,
'color': color
}
)
bs.timer(1.0, explosion.delete)
if color == (5, 1, 0):
color = (1, 0, 0)
2023-04-29 12:04:57 -05:00
self.activity._handle_score(1)
else:
2023-06-08 03:40:59 +00:00
color = (0, 0, 1)
2023-04-29 12:04:57 -05:00
self.activity._handle_score(0)
2023-06-07 22:37:04 -05:00
scorch = bs.newnode(
2023-06-08 03:40:59 +00:00
'scorch',
attrs={
'position': self.node.position,
'size': 1.0,
'big': True,
'color': color,
'presence': 1
}
)
2023-04-29 12:04:57 -05:00
# Set our position a bit lower so we throw more things upward.
rmats = (self.explosion_material,)
2023-06-07 22:37:04 -05:00
self.region = bs.newnode(
2023-06-08 03:40:59 +00:00
'region',
delegate=self,
attrs={
'position': (self.node.position[0], self.node.position[1] - 0.1, self.node.position[2]),
'scale': (2.0, 2.0, 2.0),
'type': 'sphere',
'materials': rmats
},
)
2023-06-07 22:37:04 -05:00
bs.timer(0.05, self.region.delete)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def _tick(self) -> None:
c = self.color_l
2023-06-08 03:40:59 +00:00
c2 = (2.5, 1.5, 0)
2023-04-29 12:04:57 -05:00
if c[2] != 0:
2023-06-08 03:40:59 +00:00
c2 = (0, 2, 3)
2023-04-29 12:04:57 -05:00
if self.node:
2023-06-08 03:40:59 +00:00
if self._count == 1:
2023-04-29 12:04:57 -05:00
pos = self.node.position
2023-06-08 03:40:59 +00:00
color = (5, 1, 0) if pos[0] < 0 else (0, 1, 5)
2023-04-29 12:04:57 -05:00
self.explode(color=color)
return
if self._count > 0:
self._count -= 1
assert self._counter
self._counter.text = str(self._count)
2023-06-07 22:37:04 -05:00
bs.getsound('tick').play()
2023-04-29 12:04:57 -05:00
if self._count == 1:
2023-06-07 22:37:04 -05:00
self._animate = bs.animate(
2023-06-08 03:40:59 +00:00
self.node,
'mesh_scale',
{
0: self.node.mesh_scale,
0.1: 1.5,
0.2: self.scale
},
loop=True
)
2023-06-07 22:37:04 -05:00
self.animate_light = bs.animate_array(
2023-06-08 03:40:59 +00:00
self.light,
'color',
3,
{
0: c,
0.1: c2,
0.2: c
},
loop=True
)
2023-04-29 12:04:57 -05:00
else:
2023-06-07 22:37:04 -05:00
self._animate = bs.animate(
2023-06-08 03:40:59 +00:00
self.node,
'mesh_scale',
{
0: self.node.mesh_scale,
0.5: 1.5,
1.0: self.scale
},
loop=True
)
2023-06-07 22:37:04 -05:00
self.animate_light = bs.animate_array(
2023-06-08 03:40:59 +00:00
self.light,
'color',
3,
{
0: c,
0.2: c2,
0.5: c,
1.0: c
},
loop=True
)
2023-04-29 12:04:57 -05:00
def handlemessage(self, msg: Any) -> Any:
2023-06-07 22:37:04 -05:00
if isinstance(msg, bs.DieMessage):
2023-06-08 03:40:59 +00:00
if not self.node:
return
2023-04-29 12:04:57 -05:00
self.node.delete()
activity = self._activity()
if activity and not msg.immediate:
activity.handlemessage(BallDiedMessage(self))
# If we go out of bounds, move back to where we started.
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.OutOfBoundsMessage):
2023-04-29 12:04:57 -05:00
assert self.node
self.node.position = self._spawn_pos
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.PickedUpMessage):
2023-04-29 12:04:57 -05:00
d = self.d_time
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def damage():
if (msg is not None and msg.node.exists()
and msg.node.getdelegate(PlayerSpaz).hitpoints > 0):
spaz = msg.node.getdelegate(PlayerSpaz)
2023-06-08 03:40:59 +00:00
spaz.node.color = (spaz.node.color[0]-0.1,
spaz.node.color[1]-0.1, spaz.node.color[2]-0.1)
2023-04-29 12:04:57 -05:00
if spaz.node.hold_node != self.node:
2023-06-07 22:37:04 -05:00
self.handlemessage(bs.DroppedMessage(spaz.node))
2023-04-29 12:04:57 -05:00
if spaz.hitpoints > 10000:
2023-06-07 22:37:04 -05:00
bs.getsound('fuse01').play(volume=0.3)
2023-04-29 12:04:57 -05:00
spaz.hitpoints -= 10000
spaz._last_hit_time = None
spaz._num_time_shit = 0
spaz.node.hurt = 1.0 - float(spaz.hitpoints) / spaz.hitpoints_max
else:
2023-06-07 22:37:04 -05:00
spaz.handlemessage(bs.DieMessage())
bs.emitfx(
2023-04-29 12:04:57 -05:00
position=msg.node.position,
velocity=(0, 3, 0),
count=20 if d == 0.2 else 25 if d == 0.1 else 30 if d == 0.05 else 15,
scale=1.0,
spread=0.2,
chunk_type='sweat')
else:
self.damage_timer = None
2023-06-07 22:37:04 -05:00
self.damage_timer = bs.Timer(self.d_time, damage, repeat=True)
2023-04-29 12:04:57 -05:00
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.DroppedMessage):
2023-04-29 12:04:57 -05:00
spaz = msg.node.getdelegate(PlayerSpaz)
self.damage_timer = None
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.HitMessage):
2023-04-29 12:04:57 -05:00
assert self.node
assert msg.force_direction is not None
self.node.handlemessage(
'impulse', msg.pos[0], msg.pos[1], msg.pos[2], msg.velocity[0],
msg.velocity[1], msg.velocity[2], 1.0 * msg.magnitude,
1.0 * msg.velocity_magnitude, msg.radius, 0,
msg.force_direction[0], msg.force_direction[1],
msg.force_direction[2])
# If this hit came from a player, log them as the last to touch us.
s_player = msg.get_source_player(Player)
if s_player is not None:
activity = self._activity()
if activity:
if s_player in activity.players:
self.last_players_to_touch[s_player.team.id] = s_player
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
elif isinstance(msg, ExplodeHitMessage):
2023-06-07 22:37:04 -05:00
node = bs.getcollision().opposingnode
2023-06-08 03:40:59 +00:00
if not self.node:
return
2023-04-29 12:04:57 -05:00
nodepos = self.region.position
mag = 2000.0
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
node.handlemessage(
2023-06-07 22:37:04 -05:00
bs.HitMessage(
2023-06-08 03:40:59 +00:00
pos=nodepos,
velocity=(0, 0, 0),
magnitude=mag,
hit_type='explosion',
hit_subtype='normal',
radius=2.0
)
)
2023-06-07 22:37:04 -05:00
self.handlemessage(bs.DieMessage())
2023-04-29 12:04:57 -05:00
else:
super().handlemessage(msg)
2023-06-08 03:40:59 +00:00
### HUMAN###
2023-04-29 12:04:57 -05:00
class NewPlayerSpaz(PlayerSpaz):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
move_mult = 1.0
reload = True
extra_jump = True
2023-06-08 03:40:59 +00:00
# calls
2023-04-29 12:04:57 -05:00
def impulse(self):
self.reload = False
p = self.node
self.node.handlemessage(
2023-06-08 03:40:59 +00:00
"impulse",
p.position[0], p.position[1]+40, p.position[2],
0, 0, 0,
160, 0, 0, 0,
0, 205, 0)
bs.timer(0.4, self.refresh)
2023-04-29 12:04:57 -05:00
def refresh(self):
self.reload = True
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def drop_bomb(self) -> Optional[Bomb]:
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if (self.land_mine_count <= 0 and self.bomb_count <= 0) or self.frozen:
return None
assert self.node
pos = self.node.position_forward
vel = self.node.velocity
if self.land_mine_count > 0:
dropping_bomb = False
self.set_land_mine_count(self.land_mine_count - 1)
bomb_type = 'land_mine'
else:
dropping_bomb = True
bomb_type = self.bomb_type
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if bomb_type == 'banana':
2023-06-07 22:37:04 -05:00
bs.getsound('penguinHit1').play(volume=0.3)
2023-04-29 12:04:57 -05:00
bomb = NewBomb(position=(pos[0], pos[1] + 0.7, pos[2]),
2023-06-08 03:40:59 +00:00
velocity=(vel[0], vel[1], vel[2]),
bomb_type=bomb_type,
radius=1.0,
source_player=self.source_player,
owner=self.node)
2023-04-29 12:04:57 -05:00
else:
bomb = Bomb(position=(pos[0], pos[1] - 0.0, pos[2]),
velocity=(vel[0], vel[1], vel[2]),
bomb_type=bomb_type,
blast_radius=self.blast_radius,
source_player=self.source_player,
owner=self.node).autoretain()
assert bomb.node
if dropping_bomb:
self.bomb_count -= 1
bomb.node.add_death_action(
2023-06-07 22:37:04 -05:00
bs.WeakCall(self.handlemessage, BombDiedMessage()))
2023-04-29 12:04:57 -05:00
self._pick_up(bomb.node)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
try:
for clb in self._dropped_bomb_callbacks:
clb(self, bomb)
except Exception:
return
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
return bomb
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def on_jump_press(self) -> None:
if not self.node:
return
self.node.jump_pressed = True
self._turbo_filter_add_press('jump')
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if self.reload and self.extra_jump:
self.impulse()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, PickupMessage):
if not self.node:
return None
try:
2023-06-07 22:37:04 -05:00
collision = bs.getcollision()
2023-04-29 12:04:57 -05:00
opposingnode = collision.opposingnode
opposingbody = collision.opposingbody
2023-06-07 22:37:04 -05:00
except bs.NotFoundError:
2023-04-29 12:04:57 -05:00
return True
if opposingnode.getnodetype() == 'spaz':
2023-06-08 03:40:59 +00:00
player = opposingnode.getdelegate(PlayerSpaz, True).getplayer(Player, True)
2023-04-29 12:04:57 -05:00
if player.actor.shield:
return None
super().handlemessage(msg)
return super().handlemessage(msg)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
class Player(bs.Player['Team']):
2023-04-29 12:04:57 -05:00
"""Our player type for this game."""
2023-06-07 22:37:04 -05:00
class Team(bs.Team[Player]):
2023-04-29 12:04:57 -05:00
"""Our team type for this game."""
def __init__(self) -> None:
self.score = 0
2023-06-07 22:37:04 -05:00
lang = bs.app.lang.language
2023-04-29 12:04:57 -05:00
if lang == 'Spanish':
name = 'Hot Bomb'
description = 'Consigue explotar la bomba en\nel equipo enemigo para ganar.'
join_description = 'Deshazte de la bomba cuanto antes.'
join_description_l = 'Deshazte de la bomba cuanto antes.'
view_description = 'Estalla la bomba en el equipo rival'
view_description_l = 'Estalla ${ARG1} veces la bomba en el equipo rival'
bomb_timer = 'Temporizador'
space_wall = 'Espacio Debajo de la Red'
num_bones = 'Huesos Distractores'
2023-06-08 03:40:59 +00:00
b_count = ['Nada', 'Pocos', 'Muchos']
2023-04-29 12:04:57 -05:00
shield = 'Inmortalidad'
bomb = 'Habilitar Bananas'
boxing_gloves = 'Equipar Guantes de Boxeo'
difficulty = 'Dificultad'
2023-06-08 03:40:59 +00:00
difficulty_o = ['Fácil', 'Difícil', 'Chernobyl']
2023-04-29 12:04:57 -05:00
wall_color = 'Color de la Red'
2023-06-08 03:40:59 +00:00
w_c = ['Verde', 'Rojo', 'Naranja', 'Amarillo', 'Celeste', 'Azul', 'Rosa', 'Gris']
2023-04-29 12:04:57 -05:00
ball_body = 'Tipo de Hot Bomb'
2023-06-08 03:40:59 +00:00
body = ['Esfera', 'Cubo']
2023-04-29 12:04:57 -05:00
else:
name = 'Hot Bomb'
description = 'Get the bomb to explode on\nthe enemy team to win.'
join_description = 'Get rid of the bomb as soon as possible.'
join_description_l = 'Get rid of the bomb as soon as possible.'
view_description = 'Explode the bomb in the enemy team'
view_description_l = 'Explode the bomb ${ARG1} times in the enemy team'
bomb_timer = 'Timer'
space_wall = 'Space Under the Mesh'
num_bones = 'Distractor Bones'
2023-06-08 03:40:59 +00:00
b_count = ['None', 'Few', 'Many']
2023-04-29 12:04:57 -05:00
shield = 'Immortality'
bomb = 'Enable Bananas'
difficulty = 'Difficulty'
2023-06-08 03:40:59 +00:00
difficulty_o = ['Easy', 'Hard', 'Chernobyl']
2023-04-29 12:04:57 -05:00
wall_color = 'Mesh Color'
2023-06-08 03:40:59 +00:00
w_c = ['Green', 'Red', 'Orange', 'Yellow', 'Light blue', 'Blue', 'Ping', 'Gray']
2023-04-29 12:04:57 -05:00
ball_body = 'Type of Hot Bomb'
2023-06-08 03:40:59 +00:00
body = ['Sphere', 'Box']
2023-04-29 12:04:57 -05:00
2023-06-07 22:37:04 -05:00
# ba_meta export bascenev1.GameActivity
class HotBombGame(bs.TeamGameActivity[Player, Team]):
2023-04-29 12:04:57 -05:00
"""New game."""
name = name
description = description
available_settings = [
2023-06-07 22:37:04 -05:00
bs.IntSetting(
2023-04-29 12:04:57 -05:00
'Score to Win',
min_value=1,
default=5,
increment=1,
),
2023-06-07 22:37:04 -05:00
bs.IntChoiceSetting(
2023-04-29 12:04:57 -05:00
'Time Limit',
choices=[
('None', 0),
('1 Minute', 60),
('2 Minutes', 120),
('5 Minutes', 300),
('10 Minutes', 600),
('20 Minutes', 1200),
],
default=0,
),
2023-06-07 22:37:04 -05:00
bs.FloatChoiceSetting(
2023-04-29 12:04:57 -05:00
'Respawn Times',
choices=[
('Shorter', 0.25),
('Short', 0.5),
('Normal', 1.0),
('Long', 2.0),
('Longer', 3.0),
],
default=0.5,
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
),
2023-06-07 22:37:04 -05:00
bs.FloatChoiceSetting(
2023-04-29 12:04:57 -05:00
difficulty,
choices=[
(difficulty_o[0], 0.15),
(difficulty_o[1], 0.04),
(difficulty_o[2], 0.01),
],
default=0.15,
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
),
2023-06-07 22:37:04 -05:00
bs.IntChoiceSetting(
2023-04-29 12:04:57 -05:00
bomb_timer,
2023-06-08 03:40:59 +00:00
choices=[(str(choice)+'s', choice) for choice in range(2, 11)],
2023-04-29 12:04:57 -05:00
default=5,
2023-06-08 03:40:59 +00:00
),
2023-06-07 22:37:04 -05:00
bs.IntChoiceSetting(
2023-04-29 12:04:57 -05:00
num_bones,
choices=[
(b_count[0], 0),
(b_count[1], 2),
(b_count[2], 5),
],
default=2,
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
),
2023-06-07 22:37:04 -05:00
bs.IntChoiceSetting(
2023-04-29 12:04:57 -05:00
ball_body,
choices=[(b, body.index(b)) for b in body],
default=0,
),
2023-06-07 22:37:04 -05:00
bs.IntChoiceSetting(
2023-04-29 12:04:57 -05:00
wall_color,
2023-06-08 03:40:59 +00:00
choices=[(color, w_c.index(color)) for color in w_c],
2023-04-29 12:04:57 -05:00
default=0,
),
2023-06-07 22:37:04 -05:00
bs.BoolSetting('Epic Mode', default=False),
bs.BoolSetting(space_wall, default=True),
bs.BoolSetting(bomb, default=True),
bs.BoolSetting(shield, default=False),
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
]
2023-06-07 22:37:04 -05:00
default_music = bs.MusicType.HOCKEY
2023-04-29 12:04:57 -05:00
@classmethod
2023-06-07 22:37:04 -05:00
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return issubclass(sessiontype, bs.DualTeamSession)
2023-04-29 12:04:57 -05:00
@classmethod
2023-06-07 22:37:04 -05:00
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
2023-04-29 12:04:57 -05:00
return ['Football Stadium']
def __init__(self, settings: dict):
super().__init__(settings)
self._bomb_timer = int(settings[bomb_timer])
2023-06-08 03:40:59 +00:00
self._space_under_wall = bool(settings[space_wall])
2023-04-29 12:04:57 -05:00
self._num_bones = int(settings[num_bones])
self._shield = bool(settings[shield])
self._bomb = bool(settings[bomb])
self.damage_time = float(settings[difficulty])
self._epic_mode = bool(settings['Epic Mode'])
self._wall_color = int(settings[wall_color])
self._ball_body = int(settings[ball_body])
2023-06-08 03:40:59 +00:00
self.bodys = ['sphere', 'crate']
self.meshs = ['bombSticky', 'powerupSimple']
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
self._scoreboard = Scoreboard()
2023-06-07 22:37:04 -05:00
self._cheer_sound = bs.getsound('cheer')
self._chant_sound = bs.getsound('crowdChant')
self._foghorn_sound = bs.getsound('foghorn')
self._swipsound = bs.getsound('swip')
self._whistle_sound = bs.getsound('refWhistle')
self.ball_mesh = bs.getmesh(self.meshs[self._ball_body])
2023-04-29 12:04:57 -05:00
self.ball_body = self.bodys[self._ball_body]
2023-06-07 22:37:04 -05:00
self.ball_tex = bs.gettexture('powerupCurse')
self._ball_sound = bs.getsound('splatter')
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self.last_point = None
2023-06-08 03:40:59 +00:00
self.colors = [(0.25, 0.5, 0.25), (1, 0.15, 0.15), (1, 0.5, 0), (1, 1, 0),
(0.2, 1, 1), (0.1, 0.1, 1), (1, 0.3, 0.5), (0.5, 0.5, 0.5)]
2023-04-29 12:04:57 -05:00
#
self.slow_motion = self._epic_mode
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.ball_material = bs.Material()
2023-04-29 12:04:57 -05:00
self.ball_material.add_actions(actions=(('modify_part_collision',
'friction', 0.5)))
self.ball_material.add_actions(conditions=('they_have_material',
shared.pickup_material),
actions=('modify_part_collision',
'collide', True))
self.ball_material.add_actions(
conditions=(
('we_are_younger_than', 100),
'and',
('they_have_material', shared.object_material),
),
actions=('modify_node_collision', 'collide', False),
)
self.ball_material.add_actions(
conditions=(
2023-06-08 03:40:59 +00:00
'they_have_material', shared.footing_material
2023-04-29 12:04:57 -05:00
),
actions=(
2023-06-08 03:40:59 +00:00
'impact_sound', self._ball_sound, 0.2, 4
2023-04-29 12:04:57 -05:00
)
)
# Keep track of which player last touched the ball
self.ball_material.add_actions(
conditions=(
'they_have_material', shared.player_material
),
actions=(
2023-06-08 03:40:59 +00:00
('call', 'at_connect', self._handle_ball_player_collide),
2023-04-29 12:04:57 -05:00
)
)
# We want the ball to kill powerups; not get stopped by them
self.ball_material.add_actions(
conditions=(
2023-06-08 03:40:59 +00:00
'they_have_material', PowerupBoxFactory.get().powerup_material),
2023-04-29 12:04:57 -05:00
actions=(
('modify_part_collision', 'physical', False),
2023-06-07 22:37:04 -05:00
('message', 'their_node', 'at_connect', bs.DieMessage())
2023-04-29 12:04:57 -05:00
)
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self._score_region_material = bs.Material()
2023-04-29 12:04:57 -05:00
self._score_region_material.add_actions(
conditions=(
'they_have_material', self.ball_material
),
actions=(
2023-06-08 03:40:59 +00:00
('modify_part_collision', 'collide', True),
2023-04-29 12:04:57 -05:00
('modify_part_collision', 'physical', False),
('call', 'at_connect', self._handle_score)
)
)
#####
2023-06-07 22:37:04 -05:00
self._check_region_material = bs.Material()
2023-04-29 12:04:57 -05:00
self._check_region_material.add_actions(
conditions=(
'they_have_material', self.ball_material
),
actions=(
2023-06-08 03:40:59 +00:00
('modify_part_collision', 'collide', True),
2023-04-29 12:04:57 -05:00
('modify_part_collision', 'physical', False),
('call', 'at_connect', self._reset_count)
)
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self._reaction_material = bs.Material()
2023-04-29 12:04:57 -05:00
self._reaction_material.add_actions(
conditions=(
'they_have_material', shared.player_material
),
actions=(
2023-06-08 03:40:59 +00:00
('modify_part_collision', 'collide', True),
2023-04-29 12:04:57 -05:00
('modify_part_collision', 'physical', False),
('call', 'at_connect', self._reaction)
)
)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self._reaction_material.add_actions(
conditions=(
'they_have_material', HealthFactory.get().health_material
),
actions=(
2023-06-08 03:40:59 +00:00
('modify_part_collision', 'collide', True),
2023-04-29 12:04:57 -05:00
('modify_part_collision', 'physical', True)
)
)
2023-06-08 03:40:59 +00:00
self._collide = bs.Material()
2023-04-29 12:04:57 -05:00
self._collide.add_actions(
conditions=(
('they_are_different_node_than_us', ),
'and',
('they_have_material', shared.player_material),
),
actions=(
('modify_part_collision', 'collide', True)
)
)
2023-06-08 03:40:59 +00:00
self._wall_material = bs.Material()
2023-04-29 12:04:57 -05:00
self._wall_material.add_actions(
conditions=(
'we_are_older_than', 1
2023-06-08 03:40:59 +00:00
),
2023-04-29 12:04:57 -05:00
actions=(
('modify_part_collision', 'collide', True)
)
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.ice_material = bs.Material()
2023-04-29 12:04:57 -05:00
self.ice_material.add_actions(
actions=(
2023-06-08 03:40:59 +00:00
'modify_part_collision', 'friction', 0.05
2023-04-29 12:04:57 -05:00
)
)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self._ball_spawn_pos: Optional[Sequence[float]] = None
self._ball: Optional[Ball] = None
self._score_to_win = int(settings['Score to Win'])
self._time_limit = float(settings['Time Limit'])
def get_instance_description(self) -> Union[str, Sequence]:
if self._score_to_win == 1:
return join_description
return join_description_l, self._score_to_win
def get_instance_description_short(self) -> Union[str, Sequence]:
if self._score_to_win == 1:
return view_description
return view_description_l, self._score_to_win
def on_begin(self) -> None:
super().on_begin()
self.setup_standard_time_limit(self._time_limit)
2023-06-08 03:40:59 +00:00
self._ball_spawn_pos = (random.choice([-5, 5]), 4, 0)
bs.timer(5, self._spawn_ball)
bs.timer(0.1, self.update_ball, repeat=True)
2023-04-29 12:04:57 -05:00
self.add_game_complements()
self.add_map_complements()
self._update_scoreboard()
2023-06-07 22:37:04 -05:00
self._chant_sound.play()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def _reaction(self):
2023-06-07 22:37:04 -05:00
node: bs.Node = bs.getcollision().opposingnode
bs.getsound('hiss').play(volume=0.75)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
node.handlemessage(
"impulse",
2023-06-08 03:40:59 +00:00
node.position[0], node.position[1], node.position[2],
-node.velocity[0]*2, -node.velocity[1], -node.velocity[2],
100, 100, 0, 0,
-node.velocity[0], -node.velocity[1], -node.velocity[2]
2023-04-29 12:04:57 -05:00
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
bs.emitfx(
2023-04-29 12:04:57 -05:00
position=node.position,
count=20,
scale=1.5,
spread=0.5,
chunk_type='sweat'
)
def add_game_complements(self):
HealthBox(
2023-06-08 03:40:59 +00:00
position=(-1, 3.5, -5+random.random()*10)
2023-04-29 12:04:57 -05:00
)
HealthBox(
2023-06-08 03:40:59 +00:00
position=(1, 3.5, -5+random.random()*10)
2023-04-29 12:04:57 -05:00
)
###
g = 0
while g < self._num_bones:
b = 0
Torso(
2023-06-08 03:40:59 +00:00
position=(-6+random.random()*12, 3.5, -5+random.random()*10)
2023-04-29 12:04:57 -05:00
)
while b < 6:
Bone(
2023-06-08 03:40:59 +00:00
position=(-6+random.random()*12, 2, -5+random.random()*10),
2023-04-29 12:04:57 -05:00
style=b
)
b += 1
g += 1
########################
self.wall_color = self.colors[self._wall_color]
2023-06-07 22:37:04 -05:00
part_of_wall = bs.newnode(
2023-04-29 17:16:42 +00:00
'locator',
attrs={
2023-06-08 03:40:59 +00:00
'shape': 'box',
'position': (-7.169, 0.5, 0.5),
'color': self.wall_color,
'opacity': 1,
'drawShadow': False,
'draw_beauty': True,
'additive': False,
'size': [14.7, 2, 16]
2023-04-29 17:16:42 +00:00
}
)
2023-06-07 22:37:04 -05:00
part_of_wall2 = bs.newnode(
2023-06-08 03:40:59 +00:00
'locator',
attrs={
'shape': 'box',
'position': (0, -13.51, 0.5) if self._space_under_wall else (0, -35.540, 0.5),
'color': self.wall_color,
'opacity': 1,
'drawShadow': False,
'draw_beauty': True,
'additive': False,
'size': [0.3, 30, 13] if self._space_under_wall else [0.3, 75, 13]
}
)
2023-06-07 22:37:04 -05:00
wall = bs.newnode(
2023-04-29 12:04:57 -05:00
'region',
attrs={
2023-06-08 03:40:59 +00:00
'position': (0, 1.11, 0.5) if self._space_under_wall else (0, 0.75, 0.5),
'scale': (0.3, 0.75, 13) if self._space_under_wall else (0.3, 1.5, 13),
2023-04-29 12:04:57 -05:00
'type': 'box',
2023-06-08 03:40:59 +00:00
'materials': (self._wall_material, self._reaction_material)
2023-04-29 12:04:57 -05:00
}
)
# RESET REGION
2023-06-08 03:40:59 +00:00
pos = (0, 5.3, 0)
2023-06-07 22:37:04 -05:00
bs.newnode(
2023-04-29 12:04:57 -05:00
'region',
attrs={
'position': pos,
2023-06-08 03:40:59 +00:00
'scale': (0.001, 15, 12),
2023-04-29 12:04:57 -05:00
'type': 'box',
2023-06-08 03:40:59 +00:00
'materials': [self._check_region_material, self._reaction_material]
2023-04-29 12:04:57 -05:00
}
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
bs.newnode(
2023-04-29 12:04:57 -05:00
'region',
attrs={
'position': pos,
2023-06-08 03:40:59 +00:00
'scale': (0.3, 15, 12),
2023-04-29 12:04:57 -05:00
'type': 'box',
'materials': [self._collide]
}
)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def add_map_complements(self):
2023-06-08 03:40:59 +00:00
# TEXT
2023-06-07 22:37:04 -05:00
text = bs.newnode('text',
2023-06-08 03:40:59 +00:00
attrs={'position': (0, 2.5, -6),
'text': 'Hot Bomb by\nSEBASTIAN2059 and zPanxo',
'in_world': True,
'shadow': 1.0,
'flatness': 0.7,
'color': (1.91, 1.31, 0.59),
'opacity': 0.25-0.15,
'scale': 0.013+0.007,
'h_align': 'center'})
2023-04-29 12:04:57 -05:00
walls_data = {
2023-06-08 03:40:59 +00:00
'w1': [
(11, 5.5, 0),
(4.5, 11, 13)
2023-04-29 12:04:57 -05:00
],
2023-06-08 03:40:59 +00:00
'w2': [
(-11, 5.5, 0),
(4.5, 11, 13)
2023-04-29 17:16:42 +00:00
],
2023-06-08 03:40:59 +00:00
'w3': [
(0, 5.5, -6.1),
(19, 11, 1)
],
'w4': [
(0, 5.5, 6.5),
(19, 11, 1)
2023-04-29 12:04:57 -05:00
],
}
for i in walls_data:
2023-06-07 22:37:04 -05:00
w = bs.newnode(
2023-04-29 12:04:57 -05:00
'region',
attrs={
'position': walls_data[i][0],
'scale': walls_data[i][1],
'type': 'box',
'materials': (self._wall_material,)
}
)
2023-06-08 03:40:59 +00:00
for i in [-5, -2.5, 0, 2.5, 5]:
pos = (11, 6.5, 0)
2023-04-29 12:04:57 -05:00
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]-0.5, pos[1]-5.5, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupPunch'
)
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]-0.5, pos[1]-3, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupPunch'
)
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]-0.5, pos[1]-0.5, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupPunch'
)
2023-06-08 03:40:59 +00:00
pos = (-11, 6.5, 0)
2023-04-29 12:04:57 -05:00
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]+0.5, pos[1]-5.5, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupIceBombs'
)
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]+0.5, pos[1]-3, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupIceBombs'
)
Box(
2023-06-08 03:40:59 +00:00
position=(pos[0]+0.5, pos[1]-0.5, pos[2]+i),
2023-04-29 12:04:57 -05:00
texture='powerupIceBombs'
)
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
def spawn_player(self, player: Player) -> bs.Actor:
2023-04-29 12:04:57 -05:00
position = self.get_position(player)
name = player.getname()
2023-06-07 22:37:04 -05:00
display_color = _babase.safecolor(player.color, target_intensity=0.75)
2023-04-29 12:04:57 -05:00
actor = NewPlayerSpaz(
2023-06-08 03:40:59 +00:00
color=player.color,
highlight=player.highlight,
character=player.character,
player=player
)
2023-04-29 12:04:57 -05:00
player.actor = actor
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
player.actor.node.name = name
player.actor.node.name_color = display_color
player.actor.bomb_type_default = 'banana'
player.actor.bomb_type = 'banana'
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
actor.connect_controls_to_player(enable_punch=True,
2023-06-08 03:40:59 +00:00
enable_bomb=self._bomb,
enable_pickup=True)
2023-04-29 12:04:57 -05:00
actor.node.hockey = True
actor.hitpoints_max = 100000
actor.hitpoints = 100000
actor.equip_boxing_gloves()
if self._shield:
actor.equip_shields()
2023-06-08 03:40:59 +00:00
actor.shield.color = (0, 0, 0)
2023-04-29 12:04:57 -05:00
actor.shield.radius = 0.1
actor.shield_hitpoints = actor.shield_hitpoints_max = 100000
2023-06-08 03:40:59 +00:00
# Move to the stand position and add a flash of light.
2023-04-29 12:04:57 -05:00
actor.handlemessage(
StandMessage(
position,
random.uniform(0, 360)))
2023-06-07 22:37:04 -05:00
bs.getsound('spawn').play(volume=0.6)
2023-04-29 12:04:57 -05:00
return actor
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def on_team_join(self, team: Team) -> None:
self._update_scoreboard()
def _handle_ball_player_collide(self) -> None:
2023-06-07 22:37:04 -05:00
collision = bs.getcollision()
2023-04-29 12:04:57 -05:00
try:
ball = collision.sourcenode.getdelegate(Ball, True)
2023-06-08 03:40:59 +00:00
player = collision.opposingnode.getdelegate(PlayerSpaz, True).getplayer(Player, True)
2023-06-07 22:37:04 -05:00
except bs.NotFoundError:
2023-04-29 12:04:57 -05:00
return
ball.last_players_to_touch[player.team.id] = player
def _kill_ball(self) -> None:
self._ball = None
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def _reset_count(self) -> None:
"""reset counter of ball."""
assert self._ball is not None
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if self._ball.scored:
return
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
bs.getsound('laser').play()
2023-04-29 12:04:57 -05:00
self._ball._count = self._bomb_timer
self._ball._counter.text = str(self._bomb_timer)
2023-06-07 22:37:04 -05:00
self._ball._tick_timer = bs.Timer(
2023-04-29 12:04:57 -05:00
1.0,
2023-06-07 22:37:04 -05:00
call=bs.WeakCall(self._ball._tick),
2023-04-29 12:04:57 -05:00
repeat=True
)
2023-06-07 22:37:04 -05:00
self._ball._animate = bs.animate(
2023-06-08 03:40:59 +00:00
self._ball.node,
'mesh_scale',
{
0: self._ball.node.mesh_scale,
0.1: self._ball.scale
}
)
2023-04-29 12:04:57 -05:00
if self._ball.light.color[0] == 0:
2023-06-08 03:40:59 +00:00
self._ball.light.color = (2, 0, 0)
2023-04-29 12:04:57 -05:00
else:
2023-06-08 03:40:59 +00:00
self._ball.light.color = (0, 0, 3)
2023-04-29 12:04:57 -05:00
def update_ball(self):
2023-06-08 03:40:59 +00:00
if not self._ball:
return
if not self._ball.node:
return
2023-06-07 22:37:04 -05:00
gnode = bs.getactivity().globalsnode
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if self._ball.node.position[0] > 0:
2023-06-07 22:37:04 -05:00
self._ball.node.color_texture = bs.gettexture('powerupIceBombs')
2023-06-08 03:40:59 +00:00
bs.animate_array(gnode, 'vignette_outer', 3, {1.0: (0.4, 0.4, 0.9)})
self._ball.color_l = (0, 0, 3.5)
self._ball._counter.color = (0, 0, 5)
2023-04-29 12:04:57 -05:00
else:
2023-06-07 22:37:04 -05:00
self._ball.node.color_texture = bs.gettexture('powerupPunch')
2023-06-08 03:40:59 +00:00
bs.animate_array(gnode, 'vignette_outer', 3, {1.0: (0.6, 0.45, 0.45)})
self._ball.color_l = (2.5, 0, 0)
self._ball._counter.color = (1.2, 0, 0)
2023-04-29 12:04:57 -05:00
2023-06-08 03:40:59 +00:00
def _handle_score(self, index=0) -> None:
2023-04-29 12:04:57 -05:00
"""A point has been scored."""
assert self._ball is not None
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
for team in self.teams:
if team.id == index:
scoring_team = team
team.score += 1
if index == 0:
self.last_point = 0
else:
self.last_point = 1
# Tell all players to celebrate.
for player in team.players:
if player.actor:
2023-06-07 22:37:04 -05:00
player.actor.handlemessage(bs.CelebrateMessage(2.0))
2023-04-29 12:04:57 -05:00
# If we've got the player from the scoring team that last
# touched us, give them points.
if (scoring_team.id in self._ball.last_players_to_touch
and self._ball.last_players_to_touch[scoring_team.id]):
self.stats.player_scored(
self._ball.last_players_to_touch[scoring_team.id],
100,
big_message=True)
# End game if we won.
if team.score >= self._score_to_win:
self.end_game()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
elif team.id != index:
# Tell all players to celebrate.
for player in team.players:
if player.actor:
2023-06-07 22:37:04 -05:00
player.actor.handlemessage(bs.DieMessage())
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self._foghorn_sound.play()
self._cheer_sound.play()
2023-04-29 12:04:57 -05:00
2023-06-07 22:37:04 -05:00
bs.cameraflash(duration=10.0)
2023-04-29 12:04:57 -05:00
self._update_scoreboard()
def end_game(self) -> None:
2023-06-07 22:37:04 -05:00
results = bs.GameResults()
2023-04-29 12:04:57 -05:00
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)
def _update_scoreboard(self) -> None:
winscore = self._score_to_win
for team in self.teams:
self._scoreboard.set_team_value(team, team.score, winscore)
def handlemessage(self, msg: Any) -> Any:
# Respawn dead players if they're still in the game.
2023-06-07 22:37:04 -05:00
if isinstance(msg, bs.PlayerDiedMessage):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
player = msg.getplayer(Player)
spaz = player.actor
2023-06-08 03:40:59 +00:00
spaz.node.color = (-1, -1, -1)
2023-06-07 22:37:04 -05:00
spaz.node.color_mask_texture = bs.gettexture('bonesColorMask')
spaz.node.color_texture = bs.gettexture('bonesColor')
spaz.node.head_mesh = bs.getmesh('bonesHead')
spaz.node.hand_mesh = bs.getmesh('bonesHand')
spaz.node.torso_mesh = bs.getmesh('bonesTorso')
spaz.node.pelvis_mesh = bs.getmesh('bonesPelvis')
spaz.node.upper_arm_mesh = bs.getmesh('bonesUpperArm')
spaz.node.forearm_mesh = bs.getmesh('bonesForeArm')
spaz.node.upper_leg_mesh = bs.getmesh('bonesUpperLeg')
spaz.node.lower_leg_mesh = bs.getmesh('bonesLowerLeg')
spaz.node.toes_mesh = bs.getmesh('bonesToes')
2023-04-29 12:04:57 -05:00
spaz.node.style = 'bones'
# Augment standard behavior...
super().handlemessage(msg)
self.respawn_player(msg.getplayer(Player))
# Respawn dead balls.
elif isinstance(msg, BallDiedMessage):
if not self.has_ended():
try:
if self._ball._count == 1:
2023-06-07 22:37:04 -05:00
bs.timer(3.0, self._spawn_ball)
2023-04-29 12:04:57 -05:00
except Exception:
return
else:
super().handlemessage(msg)
2023-06-08 03:40:59 +00:00
def _flash_ball_spawn(self, pos, color=(1, 0, 0)) -> None:
2023-06-07 22:37:04 -05:00
light = bs.newnode('light',
2023-04-29 12:04:57 -05:00
attrs={
'position': pos,
'height_attenuated': False,
'color': color
})
2023-06-07 22:37:04 -05:00
bs.animate(light, 'intensity', {0.0: 0, 0.25: 0.2, 0.5: 0}, loop=True)
bs.timer(1.0, light.delete)
2023-04-29 12:04:57 -05:00
def _spawn_ball(self) -> None:
timer = self._bomb_timer
2023-06-07 22:37:04 -05:00
self._swipsound.play()
self._whistle_sound.play()
2023-06-08 03:40:59 +00:00
pos = (random.choice([5, -5]), 2, 0)
2023-04-29 12:04:57 -05:00
if self.last_point != None:
if self.last_point == 0:
2023-06-08 03:40:59 +00:00
pos = (-5, 2, 0)
2023-04-29 12:04:57 -05:00
else:
2023-06-08 03:40:59 +00:00
pos = (5, 2, 0)
color = (0, 0, 1*2) if pos[0] == 5 else (1*1.5, 0, 0)
2023-04-29 12:04:57 -05:00
texture = 'powerupPunch' if pos[0] == -5 else 'powerupIceBombs'
2023-06-08 03:40:59 +00:00
counter_color = (1, 0, 0) if pos[0] == -5 else (0, 0, 5)
# self._flash_ball_spawn(pos,color)
self._ball = Ball(position=pos, timer=timer, d_time=self.damage_time, color=color)
2023-06-07 22:37:04 -05:00
self._ball.node.color_texture = bs.gettexture(texture)
2023-04-29 12:04:57 -05:00
self._ball._counter.color = counter_color
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
def get_position(self, player: Player) -> bs.Actor:
2023-06-08 03:40:59 +00:00
position = (0, 1, 0)
2023-04-29 12:04:57 -05:00
team = player.team.id
if team == 0:
2023-06-08 03:40:59 +00:00
position = (random.randint(-7, -3), 0.25, random.randint(-5, 5))
2023-04-29 12:04:57 -05:00
angle = 90
else:
2023-06-08 03:40:59 +00:00
position = (random.randint(3, 7), 0.25, random.randint(-5, 5))
2023-04-29 12:04:57 -05:00
angle = 270
return position
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def respawn_player(self,
player: PlayerType,
respawn_time: Optional[float] = None) -> None:
2023-06-07 22:37:04 -05:00
from babase._general import WeakCall
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
assert player
if respawn_time is None:
respawn_time = 3.0
# If this standard setting is present, factor it in.
if 'Respawn Times' in self.settings_raw:
respawn_time *= self.settings_raw['Respawn Times']
# We want whole seconds.
assert respawn_time is not None
respawn_time = round(max(1.0, respawn_time), 0)
if player.actor and not self.has_ended():
2023-06-07 22:37:04 -05:00
from bascenev1lib.actor.respawnicon import RespawnIcon
player.customdata['respawn_timer'] = _bs.Timer(
2023-04-29 12:04:57 -05:00
respawn_time, WeakCall(self.spawn_player_if_exists, player))
player.customdata['respawn_icon'] = RespawnIcon(
player, respawn_time)
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def spawn_player_if_exists(self, player: PlayerType) -> None:
"""
A utility method which calls self.spawn_player() *only* if the
2023-06-07 22:37:04 -05:00
bs.Player provided still exists; handy for use in timers and whatnot.
2023-04-29 12:04:57 -05:00
There is no need to override this; just override spawn_player().
"""
if player:
self.spawn_player(player)
def spawn_player_spaz(self, player: PlayerType) -> None:
2023-06-08 03:40:59 +00:00
position = (0, 1, 0)
2023-04-29 12:04:57 -05:00
angle = None
team = player.team.id
if team == 0:
2023-06-08 03:40:59 +00:00
position = (random.randint(-7, -3), 0.25, random.randint(-5, 5))
2023-04-29 12:04:57 -05:00
angle = 90
else:
2023-06-08 03:40:59 +00:00
position = (random.randint(3, 7), 0.25, random.randint(-5, 5))
2023-04-29 12:04:57 -05:00
angle = 270
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
return super().spawn_player_spaz(player, position, angle)
2023-06-08 03:40:59 +00:00
##### New-Bomb#####
2023-04-29 12:04:57 -05:00
class ExplodeMessage:
"""Tells an object to explode."""
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
class ImpactMessage:
"""Tell an object it touched something."""
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
class NewBomb(bs.Actor):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self, position: Sequence[float] = (0, 1, 0),
velocity: Sequence[float] = (0, 0, 0),
bomb_type: str = '',
radius: float = 2.0,
2023-06-07 22:37:04 -05:00
source_player: bs.Player = None,
owner: bs.Node = None):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
super().__init__()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
# Material for powerups.
2023-06-07 22:37:04 -05:00
self.bomb_material = bs.Material()
self.explode_material = bs.Material()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self.bomb_material.add_actions(
conditions=(
('we_are_older_than', 200),
'and',
('they_are_older_than', 200),
'and',
('eval_colliding', ),
'and',
(
('they_have_material', shared.footing_material),
'or',
('they_have_material', shared.object_material),
),
),
actions=('message', 'our_node', 'at_connect', ImpactMessage()))
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self.explode_material.add_actions(
conditions=('they_have_material',
shared.player_material),
2023-06-08 03:40:59 +00:00
actions=(('modify_part_collision', 'collide', True),
2023-04-29 12:04:57 -05:00
('modify_part_collision', 'physical', False),
('call', 'at_connect', self._touch_player)))
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
self._source_player = source_player
self.owner = owner
self.bomb_type = bomb_type
self.radius = radius
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
owner_color = self.owner.source_player._team.color
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if self.bomb_type == 'banana':
2023-06-07 22:37:04 -05:00
self.node: bs.Node = bs.newnode('prop', delegate=self, attrs={
2023-04-29 12:04:57 -05:00
'position': position,
'velocity': velocity,
2023-06-07 22:37:04 -05:00
'color_texture': bs.gettexture('powerupBomb'),
'mesh': bs.getmesh('penguinTorso'),
2023-06-08 03:40:59 +00:00
'mesh_scale': 0.7,
'body_scale': 0.7,
'density': 3,
2023-04-29 12:04:57 -05:00
'reflection': 'soft',
'reflection_scale': [1.0],
'shadow_size': 0.3,
'body': 'sphere',
'owner': owner,
2023-06-08 03:40:59 +00:00
'materials': (shared.object_material, self.bomb_material)})
bs.animate(self.node, 'mesh_scale', {0: 0, 0.2: 1, 0.26: 0.7})
2023-06-07 22:37:04 -05:00
self.light = bs.newnode('light', owner=self.node, attrs={
2023-06-08 03:40:59 +00:00
'color': owner_color,
'volume_intensity_scale': 2.0,
'intensity': 1,
'radius': 0.1})
self.node.connectattr('position', self.light, 'position')
2023-06-07 22:37:04 -05:00
self.spawn: bs.Timer = bs.Timer(
2023-06-08 03:40:59 +00:00
10.0, self._check, repeat=True)
2023-04-29 12:04:57 -05:00
def _impact(self) -> None:
2023-06-07 22:37:04 -05:00
node = bs.getcollision().opposingnode
2023-04-29 12:04:57 -05:00
node_delegate = node.getdelegate(object)
if node:
if (node is self.owner):
return
self.handlemessage(ExplodeMessage())
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def _explode(self):
if self.node:
# Set our position a bit lower so we throw more things upward.
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
pos = self.node.position
rmats = (self.explode_material,)
2023-06-07 22:37:04 -05:00
self.explode_region = bs.newnode(
2023-04-29 12:04:57 -05:00
'region',
delegate=self,
attrs={
'position': (pos[0], pos[1] - 0.1, pos[2]),
'scale': (self.radius, self.radius, self.radius),
'type': 'sphere',
'materials': rmats
},
)
if self.bomb_type == 'banana':
2023-06-07 22:37:04 -05:00
bs.getsound('stickyImpact').play(volume=0.35)
a = bs.emitfx(position=self.node.position,
2023-06-08 03:40:59 +00:00
velocity=(0, 1, 0),
count=15,
scale=1.0,
spread=0.1,
chunk_type='spark')
2023-06-07 22:37:04 -05:00
scorch = bs.newnode('scorch',
2023-06-08 03:40:59 +00:00
attrs={
'position': self.node.position,
'size': 1.0,
'big': False,
'color': (1, 1, 0)
})
bs.animate(scorch, 'size', {0: 1.0, 5: 0})
bs.timer(5, scorch.delete)
2023-06-07 22:37:04 -05:00
bs.timer(0.05, self.explode_region.delete)
bs.timer(0.001, bs.WeakCall(self.handlemessage, bs.DieMessage()))
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def _touch_player(self):
2023-06-07 22:37:04 -05:00
node = bs.getcollision().opposingnode
collision = bs.getcollision()
2023-04-29 12:04:57 -05:00
try:
player = collision.opposingnode.getdelegate(PlayerSpaz,
True).getplayer(
Player, True)
2023-06-07 22:37:04 -05:00
except bs.NotFoundError:
2023-04-29 12:04:57 -05:00
return
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
if self.bomb_type == 'banana':
color = player.team.color
owner_team = self.owner.source_player._team
if (node is self.owner):
return
if player.team == owner_team:
return
player.actor.node.handlemessage('knockout', 500.0)
2023-06-08 03:40:59 +00:00
bs.animate_array(player.actor.node, 'color', 3, {
0: color, 0.1: (1.5, 1, 0), 0.5: (1.5, 1, 0), 0.6: color})
2023-04-29 12:04:57 -05:00
def _check(self) -> None:
"""Prevent the cube from annihilating."""
def handlemessage(self, msg):
if isinstance(msg, ExplodeMessage):
self._explode()
elif isinstance(msg, ImpactMessage):
self._impact()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.DieMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.OutOfBoundsMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-08 03:40:59 +00:00
###### Object#####
2023-04-29 12:04:57 -05:00
class HealthFactory:
2023-06-07 22:37:04 -05:00
"""Wraps up media and other resources used by bs.Bombs.
2023-04-29 12:04:57 -05:00
category: Gameplay Classes
A single instance of this is shared between all bombs
and can be retrieved via bastd.actor.bomb.get_factory().
Attributes:
2023-06-07 22:37:04 -05:00
health_mesh
The bs.mesh of a standard health.
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
health_tex
2023-06-07 22:37:04 -05:00
The bs.Texture for health.
2023-04-29 12:04:57 -05:00
activate_sound
2023-06-07 22:37:04 -05:00
A bs.Sound for an activating ??.
2023-04-29 12:04:57 -05:00
health_material
2023-06-07 22:37:04 -05:00
A bs.Material applied to health.
2023-04-29 12:04:57 -05:00
"""
2023-06-07 22:37:04 -05:00
_STORENAME = bs.storagename()
2023-04-29 12:04:57 -05:00
@classmethod
def get(cls) -> HealthFactory:
"""Get/create a shared EggFactory object."""
2023-06-07 22:37:04 -05:00
activity = bs.getactivity()
2023-04-29 12:04:57 -05:00
factory = activity.customdata.get(cls._STORENAME)
if factory is None:
factory = HealthFactory()
activity.customdata[cls._STORENAME] = factory
assert isinstance(factory, HealthFactory)
return factory
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self) -> None:
"""Instantiate a BombFactory.
You shouldn't need to do this; call get_factory()
to get a shared instance.
"""
shared = SharedObjects.get()
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.health_mesh = bs.getmesh('egg')
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.health_tex = bs.gettexture('eggTex1')
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.health_sound = bs.getsound('activateBeep')
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
# Set up our material so new bombs don't collide with objects
# that they are initially overlapping.
2023-06-07 22:37:04 -05:00
self.health_material = bs.Material()
2023-04-29 12:04:57 -05:00
self.health_material.add_actions(
conditions=(
(
('we_are_younger_than', 100),
'or',
('they_are_younger_than', 100),
),
'and',
('they_have_material', shared.object_material),
),
actions=('modify_node_collision', 'collide', False),
)
# We want pickup materials to always hit us even if we're currently
# not colliding with their node. (generally due to the above rule)
self.health_material.add_actions(
conditions=('they_have_material', shared.pickup_material),
actions=('modify_part_collision', 'use_node_collide', False),
)
self.health_material.add_actions(actions=('modify_part_collision',
2023-06-08 03:40:59 +00:00
'friction', 0.3))
2023-04-29 17:16:42 +00:00
2023-06-07 22:37:04 -05:00
class HealthBox(bs.Actor):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self, position: Sequence[float] = (0, 1, 0),
velocity: Sequence[float] = (0, 0, 0),
texture: str = 'powerupHealth'):
super().__init__()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
factory = HealthFactory.get()
2023-06-07 22:37:04 -05:00
self.healthbox_material = bs.Material()
2023-04-29 12:04:57 -05:00
self.healthbox_material.add_actions(
conditions=(
2023-06-08 03:40:59 +00:00
'they_are_different_node_than_us',
2023-04-29 12:04:57 -05:00
),
actions=(
('modify_part_collision', 'collide', True)
)
)
2023-06-07 22:37:04 -05:00
self.node: bs.Node = bs.newnode('prop', delegate=self, attrs={
2023-04-29 12:04:57 -05:00
'position': position,
'velocity': velocity,
2023-06-07 22:37:04 -05:00
'color_texture': bs.gettexture(texture),
'mesh': bs.getmesh('powerup'),
2023-06-08 03:40:59 +00:00
'light_mesh': bs.getmesh('powerupSimple'),
'mesh_scale': 1,
2023-04-29 12:04:57 -05:00
'body': 'crate',
2023-06-08 03:40:59 +00:00
'body_scale': 1,
'density': 1,
'damping': 0,
'gravity_scale': 1,
2023-04-29 12:04:57 -05:00
'reflection': 'powerup',
'reflection_scale': [0.5],
'shadow_size': 0.0,
2023-06-08 03:40:59 +00:00
'materials': (shared.object_material, self.healthbox_material, factory.health_material)})
2023-06-07 22:37:04 -05:00
self.light = bs.newnode('light', owner=self.node, attrs={
2023-06-08 03:40:59 +00:00
'color': (1, 1, 1),
'volume_intensity_scale': 0.4,
'intensity': 0.7,
'radius': 0.0})
self.node.connectattr('position', self.light, 'position')
2023-06-07 22:37:04 -05:00
self.spawn: bs.Timer = bs.Timer(
2023-06-08 03:40:59 +00:00
10.0, self._check, repeat=True)
2023-04-29 12:04:57 -05:00
def _check(self) -> None:
"""Prevent the cube from annihilating."""
def handlemessage(self, msg):
2023-06-07 22:37:04 -05:00
if isinstance(msg, bs.DieMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.OutOfBoundsMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.HitMessage):
2023-04-29 12:04:57 -05:00
try:
spaz = msg._source_player
2023-06-07 22:37:04 -05:00
spaz.actor.node.handlemessage(bs.PowerupMessage(poweruptype='health'))
2023-04-29 12:04:57 -05:00
t_color = spaz.team.color
spaz.actor.node.color = t_color
2023-06-07 22:37:04 -05:00
bs.getsound('healthPowerup').play(volume=0.5)
2023-06-08 03:40:59 +00:00
bs.animate(self.light, 'radius', {0: 0.0, 0.1: 0.2, 0.7: 0})
2023-04-29 12:04:57 -05:00
except:
pass
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.DroppedMessage):
2023-04-29 12:04:57 -05:00
spaz = msg.node.getdelegate(PlayerSpaz)
self.regen_timer = None
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
class Torso(bs.Actor):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self, position: Sequence[float] = (0, 1, 0),
velocity: Sequence[float] = (0, 0, 0),
texture: str = 'bonesColor'):
super().__init__()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
2023-06-07 22:37:04 -05:00
self.node: bs.Node = bs.newnode('prop', delegate=self, attrs={
2023-04-29 12:04:57 -05:00
'position': position,
'velocity': velocity,
2023-06-07 22:37:04 -05:00
'color_texture': bs.gettexture(texture),
'mesh': bs.getmesh('bonesTorso'),
2023-06-08 03:40:59 +00:00
'mesh_scale': 1,
2023-04-29 12:04:57 -05:00
'body': 'sphere',
2023-06-08 03:40:59 +00:00
'body_scale': 0.5,
'density': 6,
'damping': 0,
'gravity_scale': 1,
2023-04-29 12:04:57 -05:00
'reflection': 'soft',
'reflection_scale': [0],
'shadow_size': 0.0,
'materials': (shared.object_material,)})
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.spawn: bs.Timer = bs.Timer(
2023-06-08 03:40:59 +00:00
10.0, self._check, repeat=True)
2023-04-29 12:04:57 -05:00
def _check(self) -> None:
"""Prevent the cube from annihilating."""
def handlemessage(self, msg):
2023-06-07 22:37:04 -05:00
if isinstance(msg, bs.DieMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.OutOfBoundsMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
class Bone(bs.Actor):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self, position: Sequence[float] = (0, 1, 0),
velocity: Sequence[float] = (0, 0, 0),
texture: str = 'bonesColor',
style: int = 0):
super().__init__()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
2023-06-08 03:40:59 +00:00
meshs = ['bonesUpperArm', 'bonesUpperLeg', 'bonesForeArm',
'bonesPelvis', 'bonesToes', 'bonesHand']
2023-04-29 12:04:57 -05:00
bone = None
2023-06-07 22:37:04 -05:00
mesh = 0
for i in meshs:
if mesh == style:
bone = meshs[mesh]
2023-04-29 12:04:57 -05:00
else:
2023-06-07 22:37:04 -05:00
mesh += 1
self.node: bs.Node = bs.newnode('prop', delegate=self, attrs={
2023-04-29 12:04:57 -05:00
'position': position,
'velocity': velocity,
2023-06-07 22:37:04 -05:00
'color_texture': bs.gettexture(texture),
'mesh': bs.getmesh(bone),
2023-06-08 03:40:59 +00:00
'mesh_scale': 1.5,
2023-04-29 12:04:57 -05:00
'body': 'crate',
2023-06-08 03:40:59 +00:00
'body_scale': 0.6,
'density': 2,
'damping': 0,
'gravity_scale': 1,
2023-04-29 12:04:57 -05:00
'reflection': 'soft',
'reflection_scale': [0],
'shadow_size': 0.0,
'materials': (shared.object_material,)})
2023-06-08 03:40:59 +00:00
2023-06-07 22:37:04 -05:00
self.spawn: bs.Timer = bs.Timer(
2023-06-08 03:40:59 +00:00
10.0, self._check, repeat=True)
2023-04-29 12:04:57 -05:00
def _check(self) -> None:
"""Prevent the cube from annihilating."""
def handlemessage(self, msg):
2023-06-07 22:37:04 -05:00
if isinstance(msg, bs.DieMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-07 22:37:04 -05:00
elif isinstance(msg, bs.OutOfBoundsMessage):
2023-04-29 12:04:57 -05:00
if self.node:
self.node.delete()
2023-06-08 03:40:59 +00:00
###### Object#####
2023-06-07 22:37:04 -05:00
class Box(bs.Actor):
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
def __init__(self, position: Sequence[float] = (0, 1, 0),
velocity: Sequence[float] = (0, 0, 0),
texture: str = 'powerupCurse'):
super().__init__()
2023-06-08 03:40:59 +00:00
2023-04-29 12:04:57 -05:00
shared = SharedObjects.get()
2023-06-08 03:40:59 +00:00
self.dont_collide = bs.Material()
2023-04-29 12:04:57 -05:00
self.dont_collide.add_actions(
conditions=(
2023-06-08 03:40:59 +00:00
'they_are_different_node_than_us',
2023-04-29 12:04:57 -05:00
),
actions=(
('modify_part_collision', 'collide', False)
)
)
2023-06-07 22:37:04 -05:00
self.node: bs.Node = bs.newnode('prop', delegate=self, attrs={
2023-04-29 12:04:57 -05:00
'position': position,
'velocity': velocity,
2023-06-07 22:37:04 -05:00
'color_texture': bs.gettexture(texture),
'mesh': bs.getmesh('powerup'),
'light_mesh': bs.getmesh('powerupSimple'),
2023-06-08 03:40:59 +00:00
'mesh_scale': 4,
2023-04-29 12:04:57 -05:00
'body': 'box',
2023-06-08 03:40:59 +00:00
'body_scale': 3,
'density': 9999,
'damping': 9999,
'gravity_scale': 0,
2023-04-29 12:04:57 -05:00
'reflection': 'soft',
'reflection_scale': [0.25],
'shadow_size': 0.0,
2023-06-08 03:40:59 +00:00
'materials': [self.dont_collide,]})