mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
Needs some testing
This commit is contained in:
parent
1bce1d7d76
commit
4719c3e718
23 changed files with 2124 additions and 1626 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport)
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""
|
||||
|
|
@ -8,24 +9,24 @@ Youtube: https://www.youtube.com/c/HeySmoothy
|
|||
Website: https://bombsquad-community.web.app
|
||||
Github: https://github.com/bombsquad-community
|
||||
"""
|
||||
# ba_meta require api 7
|
||||
# ba_meta require api 8
|
||||
# (see https://ballistica.net/wiki/meta-tag-system)
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import ba
|
||||
import _ba
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
from bastd.gameutils import SharedObjects
|
||||
from bastd.actor.playerspaz import PlayerSpaz
|
||||
from bastd.game.keepaway import KeepAwayGame, FlagState, Player
|
||||
from bastd.actor import spaz
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.game.keepaway import KeepAwayGame, FlagState, Player
|
||||
from bascenev1lib.actor import spaz
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Dict, Type, List, Optional, Union
|
||||
|
||||
# ba_meta export game
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
||||
class ChooseQueen(KeepAwayGame):
|
||||
|
|
@ -33,11 +34,11 @@ class ChooseQueen(KeepAwayGame):
|
|||
description = 'Carry the queen for a set length of time'
|
||||
|
||||
@classmethod
|
||||
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
|
||||
return issubclass(sessiontype, ba.DualTeamSession)
|
||||
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
|
||||
return issubclass(sessiontype, bs.DualTeamSession)
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
|
||||
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
|
||||
return ['Creative Thoughts']
|
||||
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
|
|
@ -50,13 +51,13 @@ class ChooseQueen(KeepAwayGame):
|
|||
super().__init__(settings)
|
||||
shared = SharedObjects.get()
|
||||
self.lifts = {}
|
||||
self._room_wall_material = ba.Material()
|
||||
self._room_wall_material = bs.Material()
|
||||
self._room_wall_material.add_actions(
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', False),
|
||||
('modify_part_collision', 'physical', False)
|
||||
))
|
||||
self._queen_material = ba.Material()
|
||||
self._queen_material = bs.Material()
|
||||
self._queen_material.add_actions(
|
||||
conditions=('they_have_material', self._room_wall_material),
|
||||
actions=(
|
||||
|
|
@ -74,7 +75,7 @@ class ChooseQueen(KeepAwayGame):
|
|||
('modify_part_collision', 'collide', True),
|
||||
('modify_part_collision', 'physical', True)
|
||||
))
|
||||
self._real_wall_material = ba.Material()
|
||||
self._real_wall_material = bs.Material()
|
||||
self._real_wall_material.add_actions(
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', True),
|
||||
|
|
@ -90,17 +91,17 @@ class ChooseQueen(KeepAwayGame):
|
|||
))
|
||||
|
||||
def on_begin(self):
|
||||
ba.getactivity().globalsnode.happy_thoughts_mode = True
|
||||
bs.getactivity().globalsnode.happy_thoughts_mode = True
|
||||
super().on_begin()
|
||||
self.make_map()
|
||||
|
||||
def _spawn_flag(self) -> None:
|
||||
ba.playsound(self._swipsound)
|
||||
self._swipsound.play()
|
||||
self._flash_flag_spawn()
|
||||
assert self._flag_spawn_pos is not None
|
||||
shared = SharedObjects.get()
|
||||
self._flag = spaz.Spaz((0, 0, 0), character="Pixel").autoretain()
|
||||
self._flag.handlemessage(ba.StandMessage((0, 14.63, -5.52), 93))
|
||||
self._flag.handlemessage(bs.StandMessage((0, 14.63, -5.52), 93))
|
||||
self._flag.node.hold_position_pressed = True
|
||||
self._flag.node.materials = (self._queen_material, shared.object_material)
|
||||
# self._flag.node.extras_material= tuple(list(self._flag.node.extras_material).append(self._queen_materia))
|
||||
|
|
@ -108,7 +109,7 @@ class ChooseQueen(KeepAwayGame):
|
|||
self._flag.hitpoints_max = 5000
|
||||
|
||||
self._flag_state = FlagState.NEW
|
||||
self._flag_light = ba.newnode(
|
||||
self._flag_light = bs.newnode(
|
||||
'light',
|
||||
owner=self._flag.node,
|
||||
attrs={'intensity': 0.2, 'radius': 0.3, 'color': (0.2, 0.2, 0.2)},
|
||||
|
|
@ -136,7 +137,7 @@ class ChooseQueen(KeepAwayGame):
|
|||
player.actor.node.hold_node == self._flag.node
|
||||
)
|
||||
except Exception:
|
||||
ba.print_exception('Error checking hold flag.')
|
||||
babase.print_exception('Error checking hold flag.')
|
||||
if holdingflag:
|
||||
self._holding_players.append(player)
|
||||
player.team.holdingflag = True
|
||||
|
|
@ -158,43 +159,43 @@ class ChooseQueen(KeepAwayGame):
|
|||
self._scoring_team = None
|
||||
|
||||
if self._flag_state != prevstate:
|
||||
ba.playsound(self._swipsound)
|
||||
self._swipsound.play()
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
if isinstance(msg, ba.PlayerDiedMessage):
|
||||
if isinstance(msg, bs.PlayerDiedMessage):
|
||||
# Augment standard behavior.
|
||||
super().handlemessage(msg)
|
||||
self.respawn_player(msg.getplayer(Player))
|
||||
elif isinstance(msg, (ba.PickedUpMessage, ba.DroppedMessage)):
|
||||
elif isinstance(msg, (bs.PickedUpMessage, bs.DroppedMessage)):
|
||||
self._update_flag_state()
|
||||
else:
|
||||
super().handlemessage(msg)
|
||||
|
||||
def make_map(self):
|
||||
shared = SharedObjects.get()
|
||||
_ba.get_foreground_host_activity()._map.leftwall.materials = [
|
||||
bs.get_foreground_host_activity()._map.leftwall.materials = [
|
||||
shared.footing_material, self._real_wall_material]
|
||||
|
||||
_ba.get_foreground_host_activity()._map.rightwall.materials = [
|
||||
bs.get_foreground_host_activity()._map.rightwall.materials = [
|
||||
shared.footing_material, self._real_wall_material]
|
||||
|
||||
_ba.get_foreground_host_activity()._map.topwall.materials = [
|
||||
bs.get_foreground_host_activity()._map.topwall.materials = [
|
||||
shared.footing_material, self._real_wall_material]
|
||||
|
||||
self.floorwall1 = ba.newnode('region', attrs={'position': (-10, 5, -5.52), 'scale':
|
||||
self.floorwall1 = bs.newnode('region', attrs={'position': (-10, 5, -5.52), 'scale':
|
||||
(15, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
self.floorwall2 = ba.newnode('region', attrs={'position': (10, 5, -5.52), 'scale': (
|
||||
self.floorwall2 = bs.newnode('region', attrs={'position': (10, 5, -5.52), 'scale': (
|
||||
15, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
|
||||
self.wall1 = ba.newnode('region', attrs={'position': (0, 11, -6.90), 'scale': (
|
||||
self.wall1 = bs.newnode('region', attrs={'position': (0, 11, -6.90), 'scale': (
|
||||
35.4, 20, 1), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
self.wall2 = ba.newnode('region', attrs={'position': (0, 11, -4.14), 'scale': (
|
||||
self.wall2 = bs.newnode('region', attrs={'position': (0, 11, -4.14), 'scale': (
|
||||
35.4, 20, 1), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (-10, 5, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (-10, 5, -5.52), 'color': (
|
||||
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (15, 0.2, 2)})
|
||||
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (10, 5, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (10, 5, -5.52), 'color': (
|
||||
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (15, 0.2, 2)})
|
||||
|
||||
self.create_static_step(0, 14.29)
|
||||
|
|
@ -219,25 +220,25 @@ class ChooseQueen(KeepAwayGame):
|
|||
self.create_static_step(-3, 10)
|
||||
|
||||
# create queen personal room
|
||||
self.room_wall_left = ba.newnode('region', attrs={'position': (-3.633, 16.63, -5.52), 'scale':
|
||||
self.room_wall_left = bs.newnode('region', attrs={'position': (-3.633, 16.63, -5.52), 'scale':
|
||||
(2, 4, 5), 'type': 'box', 'materials': [shared.footing_material, self._room_wall_material]})
|
||||
self.room_wall_right = ba.newnode('region', attrs={'position': (3.533, 16.63, -5.52), 'scale':
|
||||
self.room_wall_right = bs.newnode('region', attrs={'position': (3.533, 16.63, -5.52), 'scale':
|
||||
(2, 4, 5), 'type': 'box', 'materials': [shared.footing_material, self._room_wall_material]})
|
||||
|
||||
def create_static_step(self, x, y):
|
||||
shared = SharedObjects.get()
|
||||
ba.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (5.5, 0.1, 6),
|
||||
bs.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (5.5, 0.1, 6),
|
||||
'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (x, y, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (x, y, -5.52), 'color': (
|
||||
1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (5.5, 0.1, 2)})
|
||||
|
||||
def create_slope(self, x, y, backslash):
|
||||
shared = SharedObjects.get()
|
||||
|
||||
for _ in range(0, 21):
|
||||
ba.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (0.2, 0.1, 6),
|
||||
bs.newnode('region', attrs={'position': (x, y, -5.52), 'scale': (0.2, 0.1, 6),
|
||||
'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (x, y, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (x, y, -5.52), 'color': (
|
||||
1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.2, 0.1, 2)})
|
||||
if backslash:
|
||||
x = x + 0.1
|
||||
|
|
@ -291,7 +292,7 @@ class mapdefs:
|
|||
0.5245740665, 0.5245740665, 0.01941146064)
|
||||
|
||||
|
||||
class CreativeThoughts(ba.Map):
|
||||
class CreativeThoughts(bs.Map):
|
||||
"""Freaking map by smoothy."""
|
||||
|
||||
defs = mapdefs
|
||||
|
|
@ -312,26 +313,26 @@ class CreativeThoughts(ba.Map):
|
|||
@classmethod
|
||||
def on_preload(cls) -> Any:
|
||||
data: Dict[str, Any] = {
|
||||
'model': ba.getmodel('alwaysLandLevel'),
|
||||
'bottom_model': ba.getmodel('alwaysLandLevelBottom'),
|
||||
'bgmodel': ba.getmodel('alwaysLandBG'),
|
||||
'collide_model': ba.getcollidemodel('alwaysLandLevelCollide'),
|
||||
'tex': ba.gettexture('alwaysLandLevelColor'),
|
||||
'bgtex': ba.gettexture('alwaysLandBGColor'),
|
||||
'vr_fill_mound_model': ba.getmodel('alwaysLandVRFillMound'),
|
||||
'vr_fill_mound_tex': ba.gettexture('vrFillMound')
|
||||
'mesh': bs.getmesh('alwaysLandLevel'),
|
||||
'bottom_mesh': bs.getmesh('alwaysLandLevelBottom'),
|
||||
'bgmesh': bs.getmesh('alwaysLandBG'),
|
||||
'collision_mesh': bs.getcollisionmesh('alwaysLandLevelCollide'),
|
||||
'tex': bs.gettexture('alwaysLandLevelColor'),
|
||||
'bgtex': bs.gettexture('alwaysLandBGColor'),
|
||||
'vr_fill_mound_mesh': bs.getmesh('alwaysLandVRFillMound'),
|
||||
'vr_fill_mound_tex': bs.gettexture('vrFillMound')
|
||||
}
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def get_music_type(cls) -> ba.MusicType:
|
||||
return ba.MusicType.FLYING
|
||||
def get_music_type(cls) -> bs.MusicType:
|
||||
return bs.MusicType.FLYING
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(vr_overlay_offset=(0, -3.7, 2.5))
|
||||
shared = SharedObjects.get()
|
||||
self._fake_wall_material = ba.Material()
|
||||
self._real_wall_material = ba.Material()
|
||||
self._fake_wall_material = bs.Material()
|
||||
self._real_wall_material = bs.Material()
|
||||
self._fake_wall_material.add_actions(
|
||||
conditions=(('they_are_younger_than', 9000), 'and',
|
||||
('they_have_material', shared.player_material)),
|
||||
|
|
@ -347,29 +348,29 @@ class CreativeThoughts(ba.Map):
|
|||
('modify_part_collision', 'physical', True)
|
||||
|
||||
))
|
||||
self.background = ba.newnode(
|
||||
self.background = bs.newnode(
|
||||
'terrain',
|
||||
attrs={
|
||||
'model': self.preloaddata['bgmodel'],
|
||||
'mesh': self.preloaddata['bgmesh'],
|
||||
'lighting': False,
|
||||
'background': True,
|
||||
'color_texture': ba.gettexture("rampageBGColor")
|
||||
'color_texture': bs.gettexture("rampageBGColor")
|
||||
})
|
||||
|
||||
self.leftwall = ba.newnode('region', attrs={'position': (-17.75152479, 13, -5.52), 'scale': (
|
||||
self.leftwall = bs.newnode('region', attrs={'position': (-17.75152479, 13, -5.52), 'scale': (
|
||||
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
self.rightwall = ba.newnode('region', attrs={'position': (17.75, 13, -5.52), 'scale': (
|
||||
self.rightwall = bs.newnode('region', attrs={'position': (17.75, 13, -5.52), 'scale': (
|
||||
0.1, 15.5, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
self.topwall = ba.newnode('region', attrs={'position': (0, 21.0, -5.52), 'scale': (
|
||||
self.topwall = bs.newnode('region', attrs={'position': (0, 21.0, -5.52), 'scale': (
|
||||
35.4, 0.2, 2), 'type': 'box', 'materials': [shared.footing_material, self._real_wall_material]})
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (-17.75152479, 13, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (-17.75152479, 13, -5.52), 'color': (
|
||||
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (17.75, 13, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (17.75, 13, -5.52), 'color': (
|
||||
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (0.1, 15.5, 2)})
|
||||
ba.newnode('locator', attrs={'shape': 'box', 'position': (0, 21.0, -5.52), 'color': (
|
||||
bs.newnode('locator', attrs={'shape': 'box', 'position': (0, 21.0, -5.52), 'color': (
|
||||
0, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': (35.4, 0.2, 2)})
|
||||
|
||||
gnode = ba.getactivity().globalsnode
|
||||
gnode = bs.getactivity().globalsnode
|
||||
gnode.happy_thoughts_mode = True
|
||||
gnode.shadow_offset = (0.0, 8.0, 5.0)
|
||||
gnode.tint = (1.3, 1.23, 1.0)
|
||||
|
|
@ -380,9 +381,9 @@ class CreativeThoughts(ba.Map):
|
|||
self.is_flying = True
|
||||
|
||||
# throw out some tips on flying
|
||||
txt = ba.newnode('text',
|
||||
txt = bs.newnode('text',
|
||||
attrs={
|
||||
'text': ba.Lstr(resource='pressJumpToFlyText'),
|
||||
'text': babase.Lstr(resource='pressJumpToFlyText'),
|
||||
'scale': 1.2,
|
||||
'maxwidth': 800,
|
||||
'position': (0, 200),
|
||||
|
|
@ -391,7 +392,7 @@ class CreativeThoughts(ba.Map):
|
|||
'h_align': 'center',
|
||||
'v_attach': 'bottom'
|
||||
})
|
||||
cmb = ba.newnode('combine',
|
||||
cmb = bs.newnode('combine',
|
||||
owner=txt,
|
||||
attrs={
|
||||
'size': 4,
|
||||
|
|
@ -399,12 +400,12 @@ class CreativeThoughts(ba.Map):
|
|||
'input1': 0.9,
|
||||
'input2': 0.0
|
||||
})
|
||||
ba.animate(cmb, 'input3', {3.0: 0, 4.0: 1, 9.0: 1, 10.0: 0})
|
||||
bs.animate(cmb, 'input3', {3.0: 0, 4.0: 1, 9.0: 1, 10.0: 0})
|
||||
cmb.connectattr('output', txt, 'color')
|
||||
ba.timer(10.0, txt.delete)
|
||||
bs.timer(10.0, txt.delete)
|
||||
|
||||
|
||||
try:
|
||||
ba._map.register_map(CreativeThoughts)
|
||||
bs._map.register_map(CreativeThoughts)
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue