mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-07 17:36:15 +00:00
code refactoring , mod update fix
This commit is contained in:
parent
7d5eb76ea7
commit
5e1ab245a9
93 changed files with 193555 additions and 26399 deletions
0
dist/ba_root/mods/__init__.py
vendored
Normal file
0
dist/ba_root/mods/__init__.py
vendored
Normal file
|
|
@ -1,8 +1,7 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
from playersData import pdata
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
|
||||
import bascenev1 as bs
|
||||
|
||||
|
||||
|
|
@ -42,7 +41,8 @@ def check_permissions(accountid, command):
|
|||
if accountid in roles[role]["ids"] and "ALL" in roles[role]["commands"]:
|
||||
return True
|
||||
|
||||
elif accountid in roles[role]["ids"] and command in roles[role]["commands"]:
|
||||
elif accountid in roles[role]["ids"] and command in roles[role][
|
||||
"commands"]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
from .Handlers import handlemsg, handlemsg_all, clientid_to_myself
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from .handlers import handlemsg, handlemsg_all, clientid_to_myself
|
||||
|
||||
|
||||
Commands = ['kill', 'heal', 'curse', 'sleep', 'superpunch', 'gloves', 'shield', 'freeze', 'unfreeze', 'godmode']
|
||||
CommandAliases = ['die', 'heath', 'cur', 'sp', 'punch', 'protect', 'ice', 'thaw', 'gm']
|
||||
|
||||
|
||||
|
||||
Commands = ['kill', 'heal', 'curse', 'sleep', 'superpunch', 'gloves', 'shield',
|
||||
'freeze', 'unfreeze', 'godmode']
|
||||
CommandAliases = ['die', 'heath', 'cur', 'sp', 'punch', 'protect', 'ice',
|
||||
'thaw', 'gm']
|
||||
|
||||
|
||||
def ExcelCommand(command, arguments, clientid, accountid):
|
||||
|
|
@ -56,10 +53,7 @@ def ExcelCommand(command, arguments, clientid, accountid):
|
|||
god_mode(arguments, clientid)
|
||||
|
||||
|
||||
|
||||
|
||||
def kill(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, bs.DieMessage())
|
||||
|
|
@ -75,11 +69,7 @@ def kill(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def heal(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.PowerupMessage(poweruptype='health'))
|
||||
|
|
@ -95,11 +85,7 @@ def heal(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def curse(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.PowerupMessage(poweruptype='curse'))
|
||||
|
|
@ -115,11 +101,7 @@ def curse(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def sleep(arguments, clientid):
|
||||
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
|
|
@ -132,16 +114,13 @@ def sleep(arguments, clientid):
|
|||
else:
|
||||
try:
|
||||
req_player = int(arguments[0])
|
||||
activity.players[req_player].actor.node.handlemessage('knockout', 8000)
|
||||
activity.players[req_player].actor.node.handlemessage('knockout',
|
||||
8000)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def super_punch(arguments, clientid):
|
||||
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
|
|
@ -182,11 +161,7 @@ def super_punch(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def gloves(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.PowerupMessage(poweruptype='punch'))
|
||||
|
|
@ -202,11 +177,7 @@ def gloves(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def shield(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.PowerupMessage(poweruptype='shield'))
|
||||
|
|
@ -222,11 +193,7 @@ def shield(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def freeze(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.FreezeMessage())
|
||||
|
|
@ -242,11 +209,7 @@ def freeze(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def un_freeze(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
handlemsg(myself, babase.ThawMessage())
|
||||
|
|
@ -262,11 +225,7 @@ def un_freeze(arguments, clientid):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def god_mode(arguments, clientid):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
myself = clientid_to_myself(clientid)
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
from .Handlers import handlemsg, handlemsg_all
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from tools import corelib
|
||||
from .handlers import handlemsg, handlemsg_all
|
||||
|
||||
Commands = ['fly', 'invisible', 'headless', 'creepy', 'celebrate', 'spaz', 'speed', 'floater']
|
||||
Commands = ['fly', 'invisible', 'headless', 'creepy', 'celebrate', 'spaz',
|
||||
'speed', 'floater']
|
||||
CommandAliases = ['inv', 'hl', 'creep', 'celeb', 'flo']
|
||||
|
||||
|
||||
|
||||
|
||||
def ExcelCommand(command, arguments, clientid, accountid):
|
||||
"""
|
||||
Checks The Command And Run Function
|
||||
|
|
@ -59,6 +57,7 @@ def floater(arguments,clientid):
|
|||
except:
|
||||
pass
|
||||
|
||||
|
||||
def speed(arguments):
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
|
@ -67,7 +66,6 @@ def speed(arguments):
|
|||
|
||||
|
||||
def fly(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -97,10 +95,7 @@ def fly(arguments):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
def invi(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -141,10 +136,7 @@ def invi(arguments):
|
|||
body.style = 'cyborg'
|
||||
|
||||
|
||||
|
||||
|
||||
def headless(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -173,9 +165,7 @@ def headless(arguments):
|
|||
return
|
||||
|
||||
|
||||
|
||||
def creep(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -206,9 +196,7 @@ def creep(arguments):
|
|||
return
|
||||
|
||||
|
||||
|
||||
def celeb(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -223,11 +211,7 @@ def celeb(arguments):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def spaz(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ import _babase
|
|||
|
||||
import bascenev1 as bs
|
||||
|
||||
|
||||
def send(msg, clientid):
|
||||
"""Shortcut To Send Private Msg To Client"""
|
||||
for m in msg.split("\n"):
|
||||
bs.chatmessage(str(m), clients=[clientid])
|
||||
bs.broadcastmessage(str(msg), transient=True, clients=[clientid])
|
||||
|
||||
|
||||
def clientid_to_myself(clientid):
|
||||
"""Return Player Index Of Self Player"""
|
||||
|
||||
|
|
@ -16,18 +18,17 @@ def clientid_to_myself(clientid):
|
|||
if player.sessionplayer.inputdevice.client_id == clientid:
|
||||
return i
|
||||
|
||||
|
||||
def handlemsg(client, msg):
|
||||
"""Handles Spaz Msg For Single Player"""
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
activity = bs.get_foreground_host_activity()
|
||||
activity.players[client].actor.node.handlemessage(msg)
|
||||
|
||||
|
||||
def handlemsg_all(msg):
|
||||
"""Handle Spaz message for all players in activity"""
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
for i in activity.players:
|
||||
i.actor.node.handlemessage(msg)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,30 @@
|
|||
from .Handlers import handlemsg, handlemsg_all, send
|
||||
import random
|
||||
|
||||
import _babase
|
||||
import _bascenev1
|
||||
import setting
|
||||
from playersData import pdata
|
||||
# from tools.whitelist import add_to_white_list, add_commit_to_logs
|
||||
from serverData import serverdata
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import time
|
||||
import setting
|
||||
import _thread
|
||||
import random
|
||||
from tools import playlist
|
||||
from tools import logger
|
||||
Commands = ['recents', 'info', 'createteam', 'showid', 'hideid', 'lm', 'gp', 'party', 'quit', 'kickvote', 'maxplayers', 'playlist', 'ban', 'kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause',
|
||||
'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand', 'getroles', 'removecmd', 'changetag', 'customtag', 'customeffect', 'removeeffect', 'removetag' 'add', 'spectators', 'lobbytime']
|
||||
CommandAliases = ['max', 'rm', 'next', 'restart', 'mutechat', 'unmutechat', 'sm',
|
||||
'slow', 'night', 'day', 'pausegame', 'camera_mode', 'rotate_camera', 'effect']
|
||||
from tools import playlist
|
||||
from .handlers import send
|
||||
|
||||
Commands = ['recents', 'info', 'createteam', 'showid', 'hideid', 'lm', 'gp',
|
||||
'party', 'quit', 'kickvote', 'maxplayers', 'playlist', 'ban',
|
||||
'kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv',
|
||||
'dv', 'pause',
|
||||
'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand',
|
||||
'addcmd', 'removecommand', 'getroles', 'removecmd', 'changetag',
|
||||
'customtag', 'customeffect', 'removeeffect', 'removetag' 'add',
|
||||
'spectators', 'lobbytime']
|
||||
CommandAliases = ['max', 'rm', 'next', 'restart', 'mutechat', 'unmutechat',
|
||||
'sm',
|
||||
'slow', 'night', 'day', 'pausegame', 'camera_mode',
|
||||
'rotate_camera', 'effect']
|
||||
|
||||
|
||||
def ExcelCommand(command, arguments, clientid, accountid):
|
||||
|
|
@ -137,7 +146,10 @@ def create_team(arguments):
|
|||
bs.chatmessage("enter team name")
|
||||
else:
|
||||
from bascenev1._team import SessionTeam
|
||||
bs.get_foreground_host_session().sessionteams.append(SessionTeam(team_id=len(bs.get_foreground_host_session().sessionteams) + 1, name=str(arguments[0]), color=(random.uniform(0, 1.2), random.uniform(
|
||||
bs.get_foreground_host_session().sessionteams.append(SessionTeam(
|
||||
team_id=len(bs.get_foreground_host_session().sessionteams) + 1,
|
||||
name=str(arguments[0]),
|
||||
color=(random.uniform(0, 1.2), random.uniform(
|
||||
0, 1.2), random.uniform(0, 1.2))))
|
||||
from bascenev1._lobby import Lobby
|
||||
bs.get_foreground_host_session().lobby = Lobby()
|
||||
|
|
@ -162,7 +174,8 @@ def get_player_info(arguments, client_id):
|
|||
def get_recents(client_id):
|
||||
for players in serverdata.recents:
|
||||
send(
|
||||
f"{players['client_id']} {players['deviceId']} {players['pbid']}", client_id)
|
||||
f"{players['client_id']} {players['deviceId']} {players['pbid']}",
|
||||
client_id)
|
||||
|
||||
|
||||
def changepartysize(arguments):
|
||||
|
|
@ -209,7 +222,8 @@ def kikvote(arguments, clientid):
|
|||
logger.log(
|
||||
f'kick vote enabled for {ros["account_id"]} {ros["display_string"]}')
|
||||
send(
|
||||
"Upon server restart, Kick-vote will be enabled for this person", clientid)
|
||||
"Upon server restart, Kick-vote will be enabled for this person",
|
||||
clientid)
|
||||
return
|
||||
except:
|
||||
return
|
||||
|
|
@ -222,7 +236,7 @@ def kikvote(arguments, clientid):
|
|||
cl_id = int(arguments[1])
|
||||
for ros in bs.get_game_roster():
|
||||
if ros["client_id"] == cl_id:
|
||||
_babase.disable_kickvote(ros["account_id"])
|
||||
_bascenev1.disable_kickvote(ros["account_id"])
|
||||
send("Kick-vote disabled for this person", clientid)
|
||||
logger.log(
|
||||
f'kick vote disabled for {ros["account_id"]} {ros["display_string"]}')
|
||||
|
|
@ -244,7 +258,8 @@ def get_profiles(arguments, clientid):
|
|||
try:
|
||||
playerID = int(arguments[0])
|
||||
num = 1
|
||||
for i in bs.get_foreground_host_session().sessionplayers[playerID].inputdevice.get_player_profiles():
|
||||
for i in bs.get_foreground_host_session().sessionplayers[
|
||||
playerID].inputdevice.get_player_profiles():
|
||||
try:
|
||||
send(f"{num})- {i}", clientid)
|
||||
num += 1
|
||||
|
|
@ -341,7 +356,6 @@ def un_mute(arguments):
|
|||
|
||||
|
||||
def remove(arguments):
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
return
|
||||
|
||||
|
|
@ -361,7 +375,6 @@ def remove(arguments):
|
|||
|
||||
|
||||
def slow_motion():
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
|
||||
if activity.globalsnode.slow_motion != True:
|
||||
|
|
@ -372,7 +385,6 @@ def slow_motion():
|
|||
|
||||
|
||||
def nv(arguments):
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
|
|
@ -391,7 +403,6 @@ def nv(arguments):
|
|||
|
||||
|
||||
def dv(arguments):
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
|
||||
if arguments == [] or arguments == ['']:
|
||||
|
|
@ -410,7 +421,6 @@ def dv(arguments):
|
|||
|
||||
|
||||
def pause():
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
|
||||
if activity.globalsnode.paused != True:
|
||||
|
|
@ -421,7 +431,6 @@ def pause():
|
|||
|
||||
|
||||
def rotate_camera():
|
||||
|
||||
activity = _babase.get_foreground_host_activity()
|
||||
|
||||
if activity.globalsnode.camera_mode != 'rotate':
|
||||
|
|
@ -525,8 +534,16 @@ def set_custom_effect(arguments):
|
|||
return
|
||||
|
||||
|
||||
all_commands = ["changetag", "createrole", "addrole", "removerole", "addcommand", "addcmd", "removecommand", "removecmd", "kick", "remove", "rm", "end", "next", "quit", "restart", "mute", "mutechat", "unmute", "unmutechat", "sm", "slow", "slowmo", "nv", "night", "dv", "day", "pause", "pausegame", "cameraMode",
|
||||
"camera_mode", "rotate_camera", "kill", "die", "heal", "heath", "curse", "cur", "sleep", "sp", "superpunch", "gloves", "punch", "shield", "protect", "freeze", "ice", "unfreeze", "thaw", "gm", "godmode", "fly", "inv", "invisible", "hl", "headless", "creepy", "creep", "celebrate", "celeb", "spaz"]
|
||||
all_commands = ["changetag", "createrole", "addrole", "removerole",
|
||||
"addcommand", "addcmd", "removecommand", "removecmd", "kick",
|
||||
"remove", "rm", "end", "next", "quit", "restart", "mute",
|
||||
"mutechat", "unmute", "unmutechat", "sm", "slow", "slowmo",
|
||||
"nv", "night", "dv", "day", "pause", "pausegame", "cameraMode",
|
||||
"camera_mode", "rotate_camera", "kill", "die", "heal", "heath",
|
||||
"curse", "cur", "sleep", "sp", "superpunch", "gloves", "punch",
|
||||
"shield", "protect", "freeze", "ice", "unfreeze", "thaw", "gm",
|
||||
"godmode", "fly", "inv", "invisible", "hl", "headless",
|
||||
"creepy", "creep", "celebrate", "celeb", "spaz"]
|
||||
|
||||
|
||||
def add_command_to_role(arguments):
|
||||
|
|
@ -578,7 +595,6 @@ def remove_command_to_role(arguments):
|
|||
|
||||
|
||||
def spectators(arguments):
|
||||
|
||||
if arguments[0] in ['on', 'off']:
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
# ba_meta require api 6
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
import _babase,ba,random,math
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.bomb import Bomb
|
||||
|
||||
import _babase
|
||||
import math
|
||||
import random
|
||||
from babase._generated.enums import InputType
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.bomb import Bomb
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
class Floater(bs.Actor):
|
||||
|
|
@ -162,7 +168,8 @@ class Floater(bs.Actor):
|
|||
self.dis()
|
||||
|
||||
def distance(self, x1, y1, z1, x2, y2, z2):
|
||||
d = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2))
|
||||
d = math.sqrt(
|
||||
math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2))
|
||||
return d
|
||||
|
||||
def drop(self):
|
||||
|
|
@ -170,7 +177,11 @@ class Floater(bs.Actor):
|
|||
np = self.node.position
|
||||
except:
|
||||
np = (0, 0, 0)
|
||||
self.b = Bomb(bomb_type=random.choice(['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']), source_player=self.source_player, position=(np[0], np[1] - 1, np[2]), velocity=(0, -1, 0)).autoretain()
|
||||
self.b = Bomb(bomb_type=random.choice(
|
||||
['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']),
|
||||
source_player=self.source_player,
|
||||
position=(np[0], np[1] - 1, np[2]),
|
||||
velocity=(0, -1, 0)).autoretain()
|
||||
if self.b.bomb_type in ['impact', 'land_mine']:
|
||||
self.b.arm()
|
||||
|
||||
|
|
@ -181,7 +192,8 @@ class Floater(bs.Actor):
|
|||
if self.node.exists() and not self.controlled:
|
||||
pn = self.node.position
|
||||
dist = self.distance(pn[0], pn[1], pn[2], px, py, pz)
|
||||
self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist)
|
||||
self.node.velocity = (
|
||||
(px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist)
|
||||
t = dist - 1 if dist - 1 >= 0 else 0.1
|
||||
bs.timer(t, bs.WeakCall(self.move), suppress_format_warning=True)
|
||||
|
||||
|
|
@ -196,21 +208,24 @@ class Floater(bs.Actor):
|
|||
super().handlemessage(msg)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def assignFloInputs(clientID: int):
|
||||
with babase.Context(_babase.get_foreground_host_activity()):
|
||||
activity = bs.getactivity()
|
||||
if not hasattr(activity, 'flo') or not activity.flo.node.exists():
|
||||
try: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
|
||||
except: return #Perhaps using in main-menu/score-screen
|
||||
try:
|
||||
activity.flo = Floater(
|
||||
activity.map.get_def_bound_box('map_bounds'))
|
||||
except:
|
||||
return # Perhaps using in main-menu/score-screen
|
||||
floater = activity.flo
|
||||
if floater.controlled:
|
||||
bs.broadcastmessage('Floater is already being controlled', color=(1, 0, 0), transient=True, clients=[clientID])
|
||||
bs.broadcastmessage('Floater is already being controlled',
|
||||
color=(1, 0, 0), transient=True,
|
||||
clients=[clientID])
|
||||
return
|
||||
bs.broadcastmessage('You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!', clients=[clientID], transient=True, color=(0, 1, 1))
|
||||
bs.broadcastmessage(
|
||||
'You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!',
|
||||
clients=[clientID], transient=True, color=(0, 1, 1))
|
||||
|
||||
for i in _babase.get_foreground_host_activity().players:
|
||||
if i.sessionplayer.inputdevice.client_id == clientID:
|
||||
|
|
@ -219,6 +234,7 @@ def assignFloInputs(clientID: int):
|
|||
i.resetinput()
|
||||
i.actor.connect_controls_to_player()
|
||||
floater.dis()
|
||||
|
||||
ps = i.actor.node.position
|
||||
i.actor.node.invincible = True
|
||||
floater.node.position = (ps[0], ps[1] + 1.0, ps[2])
|
||||
|
|
@ -233,6 +249,7 @@ def assignFloInputs(clientID: int):
|
|||
i.assigninput(InputType.PICK_UP_RELEASE, floater.upR)
|
||||
i.assigninput(InputType.JUMP_PRESS, floater.down)
|
||||
i.assigninput(InputType.BOMB_PRESS, floater.drop)
|
||||
i.assigninput(InputType.PUNCH_PRESS, babase.Call(dis, i, floater))
|
||||
i.assigninput(InputType.PUNCH_PRESS,
|
||||
babase.Call(dis, i, floater))
|
||||
i.assigninput(InputType.UP_DOWN, floater.updown)
|
||||
i.assigninput(InputType.LEFT_RIGHT, floater.leftright)
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from serverData import serverdata
|
||||
from features import profanity
|
||||
from tools import servercheck
|
||||
import time
|
||||
import setting
|
||||
from tools import logger
|
||||
import _thread
|
||||
import time
|
||||
|
||||
import setting
|
||||
from features import profanity
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
|
||||
import bascenev1 as bs
|
||||
from tools import logger
|
||||
from tools import servercheck
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
||||
def check_permissions(accountid):
|
||||
roles = pdata.get_roles()
|
||||
for role in roles:
|
||||
if accountid in roles[role]["ids"] and ( role == "bypass-warn" or role=="owner") :
|
||||
if accountid in roles[role]["ids"] and (
|
||||
role == "bypass-warn" or role == "owner"):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -23,11 +26,14 @@ def check_permissions(accountid):
|
|||
def filter(msg, pb_id, client_id):
|
||||
new_msg = profanity.censor(msg)
|
||||
if new_msg != msg:
|
||||
_bs.broadcastmessage("Don\'t ABUSE!", color=(1,0,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Don\'t ABUSE!", color=(1, 0, 0), transient=True,
|
||||
clients=[client_id])
|
||||
if not check_permissions(pb_id):
|
||||
addWarn(pb_id, client_id)
|
||||
else:
|
||||
_bs.broadcastmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Special role found, Warn BYPASSED!",
|
||||
color=(0, 1, 0), transient=True,
|
||||
clients=[client_id])
|
||||
|
||||
now = time.time()
|
||||
if pb_id not in serverdata.clients:
|
||||
|
|
@ -39,13 +45,18 @@ def filter(msg,pb_id,client_id):
|
|||
if now - serverdata.clients[pb_id]["lastMsgTime"] < 8:
|
||||
count += 1
|
||||
if count == 2: # when 3 msgs
|
||||
_bs.broadcastmessage("Sending messages too fast, cool down...", color=(1,0.40,0.50), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Sending messages too fast, cool down...",
|
||||
color=(1, 0.40, 0.50), transient=True,
|
||||
clients=[client_id])
|
||||
elif count >= 3: # when 4 msgs
|
||||
_bs.broadcastmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Don\'t SPAM!", color=(1, 0, 0),
|
||||
transient=True, clients=[client_id])
|
||||
if not check_permissions(pb_id):
|
||||
addWarn(pb_id, client_id)
|
||||
else:
|
||||
_bs.broadcastmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Special role found, Warn BYPASSED!",
|
||||
color=(0, 1, 0), transient=True,
|
||||
clients=[client_id])
|
||||
count = 0
|
||||
elif now - serverdata.clients[pb_id]["lastMsgTime"] < 20:
|
||||
# < 30
|
||||
|
|
@ -56,18 +67,20 @@ def filter(msg,pb_id,client_id):
|
|||
logger.log(pb_id + " | kicked for chat spam")
|
||||
bs.disconnect_client(client_id)
|
||||
smsgcount = 0
|
||||
_bs.broadcastmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Don\'t SPAM!", color=(1, 0, 0),
|
||||
transient=True, clients=[client_id])
|
||||
if not check_permissions(pb_id):
|
||||
addWarn(pb_id, client_id)
|
||||
else:
|
||||
_bs.broadcastmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||
bs.broadcastmessage("Special role found, Warn BYPASSED!",
|
||||
color=(0, 1, 0), transient=True,
|
||||
clients=[client_id])
|
||||
else:
|
||||
smsgcount = 0
|
||||
else:
|
||||
count = 0
|
||||
smsgcount = 0
|
||||
|
||||
|
||||
serverdata.clients[pb_id]['cMsgCount'] = count
|
||||
serverdata.clients[pb_id]['lastMsgTime'] = now
|
||||
serverdata.clients[pb_id]['lastMsg'] = msg
|
||||
|
|
@ -80,7 +93,6 @@ def filter(msg,pb_id,client_id):
|
|||
return new_msg
|
||||
|
||||
|
||||
|
||||
def addWarn(pb_id, client_id):
|
||||
now = time.time()
|
||||
player = serverdata.clients[pb_id]
|
||||
|
|
@ -88,17 +100,17 @@ def addWarn(pb_id,client_id):
|
|||
if now - player['lastWarned'] <= settings["WarnCooldownMinutes"] * 60:
|
||||
warn += 1
|
||||
if warn > settings["maxWarnCount"]:
|
||||
bs.broadcastmessage(settings["afterWarnKickMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
||||
bs.broadcastmessage(settings["afterWarnKickMsg"], color=(1, 0, 0),
|
||||
transient=True, clients=[client_id])
|
||||
logger.log(pb_id + " | kicked for chat spam")
|
||||
bs.disconnect_client(client_id)
|
||||
_thread.start_new_thread(servercheck.reportSpam, (pb_id,))
|
||||
|
||||
else:
|
||||
_bs.broadcastmessage(settings["warnMsg"]+f"\n\nWarn Count = {warn}/3!!!",color=(1,0,0),transient=True,clients=[client_id])
|
||||
bs.broadcastmessage(
|
||||
settings["warnMsg"] + f"\n\nWarn Count = {warn}/3!!!",
|
||||
color=(1, 0, 0), transient=True, clients=[client_id])
|
||||
else:
|
||||
warn = 0
|
||||
serverdata.clients[pb_id]["warnCount"] = warn
|
||||
serverdata.clients[pb_id]['lastWarned'] = now
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
blackListWords=['wtf']
|
||||
48
dist/ba_root/mods/chatHandle/handlechat.py
vendored
48
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -1,18 +1,17 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
from chatHandle.ChatCommands import Main
|
||||
from tools import logger, servercheck
|
||||
from datetime import datetime
|
||||
|
||||
import setting
|
||||
from chatHandle.chatFilter import ChatFilter
|
||||
from chatHandle.chatcommands import executor
|
||||
from features import votingmachine
|
||||
from playersData import pdata
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
from serverData import serverdata
|
||||
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import setting
|
||||
from datetime import datetime
|
||||
from tools import logger, servercheck
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
||||
|
|
@ -20,7 +19,8 @@ def filter_chat_message(msg, client_id):
|
|||
now = datetime.now()
|
||||
if client_id == -1:
|
||||
if msg.startswith("/"):
|
||||
Main.Command(msg, client_id)
|
||||
print("message stars with /")
|
||||
executor.execute(msg, client_id)
|
||||
return None
|
||||
logger.log(f"Host msg: | {msg}", "chat")
|
||||
return msg
|
||||
|
|
@ -28,7 +28,7 @@ def filter_chat_message(msg, client_id):
|
|||
displaystring = ""
|
||||
currentname = ""
|
||||
|
||||
for i in babase.internal.get_game_roster():
|
||||
for i in bs.get_game_roster():
|
||||
if i['client_id'] == client_id:
|
||||
acid = i['account_id']
|
||||
try:
|
||||
|
|
@ -42,7 +42,7 @@ def filter_chat_message(msg, client_id):
|
|||
return
|
||||
logger.log(f'{acid} | {displaystring}| {currentname} | {msg}', "chat")
|
||||
if msg.startswith("/"):
|
||||
msg = Main.Command(msg, client_id)
|
||||
msg = executor.execute(msg, client_id)
|
||||
if msg == None:
|
||||
return
|
||||
|
||||
|
|
@ -52,26 +52,32 @@ def filter_chat_message(msg, client_id):
|
|||
if acid in serverdata.clients and serverdata.clients[acid]["verified"]:
|
||||
|
||||
if serverdata.muted:
|
||||
_bs.broadcastmessage("Server on mute",
|
||||
bs.broadcastmessage("Server on mute",
|
||||
transient=True, clients=[client_id])
|
||||
return
|
||||
|
||||
elif acid in pdata.get_blacklist()["muted-ids"] and now < datetime.strptime(pdata.get_blacklist()["muted-ids"][acid]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
_bs.broadcastmessage(
|
||||
"You are on mute, maybe try after some time", transient=True, clients=[client_id])
|
||||
elif acid in pdata.get_blacklist()[
|
||||
"muted-ids"] and now < datetime.strptime(
|
||||
pdata.get_blacklist()["muted-ids"][acid]["till"],
|
||||
"%Y-%m-%d %H:%M:%S"):
|
||||
bs.broadcastmessage(
|
||||
"You are on mute, maybe try after some time", transient=True,
|
||||
clients=[client_id])
|
||||
return None
|
||||
elif servercheck.get_account_age(serverdata.clients[acid]["accountAge"]) < settings['minAgeToChatInHours']:
|
||||
_bs.broadcastmessage("New accounts not allowed to chat here",
|
||||
elif servercheck.get_account_age(
|
||||
serverdata.clients[acid]["accountAge"]) < settings[
|
||||
'minAgeToChatInHours']:
|
||||
bs.broadcastmessage("New accounts not allowed to chat here",
|
||||
transient=True, clients=[client_id])
|
||||
return None
|
||||
else:
|
||||
if msg.startswith(",") and settings["allowTeamChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
return executor.QuickAccess(msg, client_id)
|
||||
if msg.startswith(".") and settings["allowInGameChat"]:
|
||||
return Main.QuickAccess(msg, client_id)
|
||||
return executor.QuickAccess(msg, client_id)
|
||||
return msg
|
||||
|
||||
else:
|
||||
_bs.broadcastmessage("Fetching your account info , Wait a minute",
|
||||
bs.broadcastmessage("Fetching your account info , Wait a minute",
|
||||
transient=True, clients=[client_id])
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -1,24 +1,17 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
|
||||
from .commands import NormalCommands
|
||||
from .commands import Management
|
||||
from .commands import Fun
|
||||
from .commands import Cheats
|
||||
from datetime import datetime
|
||||
|
||||
from .Handlers import clientid_to_accountid
|
||||
from .Handlers import check_permissions
|
||||
from chatHandle.chatFilter import ChatFilter
|
||||
from bascenev1lib.actor import popuptext
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import setting
|
||||
from datetime import datetime
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
|
||||
import bascenev1 as bs
|
||||
from .handlers import check_permissions
|
||||
from .handlers import clientid_to_accountid
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
||||
|
|
@ -45,7 +38,7 @@ def command_type(command):
|
|||
return "Cheats"
|
||||
|
||||
|
||||
def Command(msg, clientid):
|
||||
def execute(msg, clientid):
|
||||
"""
|
||||
Command Execution
|
||||
|
||||
|
|
@ -59,37 +52,40 @@ def Command(msg, clientid):
|
|||
command = msg.lower().split(" ")[0].split("/")[1]
|
||||
arguments = msg.lower().split(" ")[1:]
|
||||
accountid = clientid_to_accountid(clientid)
|
||||
|
||||
print("checking command type")
|
||||
print(command_type(command))
|
||||
if command_type(command) == "Normal":
|
||||
NormalCommands.ExcelCommand(command, arguments, clientid, accountid)
|
||||
|
||||
elif command_type(command) == "Manage":
|
||||
if check_permissions(accountid, command):
|
||||
Management.ExcelCommand(command, arguments, clientid, accountid)
|
||||
_bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
else:
|
||||
_bs.broadcastmessage("access denied", transient=True,
|
||||
bs.broadcastmessage("access denied", transient=True,
|
||||
clients=[clientid])
|
||||
|
||||
elif command_type(command) == "Fun":
|
||||
if check_permissions(accountid, command):
|
||||
Fun.ExcelCommand(command, arguments, clientid, accountid)
|
||||
_bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
else:
|
||||
_bs.broadcastmessage("access denied", transient=True,
|
||||
bs.broadcastmessage("access denied", transient=True,
|
||||
clients=[clientid])
|
||||
|
||||
elif command_type(command) == "Cheats":
|
||||
if check_permissions(accountid, command):
|
||||
Cheats.ExcelCommand(command, arguments, clientid, accountid)
|
||||
_bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
bs.broadcastmessage("Executed", transient=True, clients=[clientid])
|
||||
else:
|
||||
_bs.broadcastmessage("access denied", transient=True,
|
||||
bs.broadcastmessage("access denied", transient=True,
|
||||
clients=[clientid])
|
||||
now = datetime.now()
|
||||
if accountid in pdata.get_blacklist()["muted-ids"] and now < datetime.strptime(pdata.get_blacklist()["muted-ids"][accountid]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
|
||||
_bs.broadcastmessage("You are on mute", transient=True,
|
||||
if accountid in pdata.get_blacklist()[
|
||||
"muted-ids"] and now < datetime.strptime(
|
||||
pdata.get_blacklist()["muted-ids"][accountid]["till"],
|
||||
"%Y-%m-%d %H:%M:%S"):
|
||||
bs.broadcastmessage("You are on mute", transient=True,
|
||||
clients=[clientid])
|
||||
return None
|
||||
if serverdata.muted:
|
||||
|
|
@ -100,6 +96,7 @@ def Command(msg, clientid):
|
|||
|
||||
|
||||
def QuickAccess(msg, client_id):
|
||||
from bascenev1lib.actor import popuptext
|
||||
if msg.startswith(","):
|
||||
name = ""
|
||||
teamid = 0
|
||||
|
|
@ -109,8 +106,10 @@ def QuickAccess(msg, client_id):
|
|||
name = i.getname(True)
|
||||
|
||||
for i in bs.get_foreground_host_session().sessionplayers:
|
||||
if hasattr(i, 'sessionteam') and i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
||||
bs.broadcastmessage(name + ":" + msg[1:], clients=[i.inputdevice.client_id],
|
||||
if hasattr(i,
|
||||
'sessionteam') and i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
||||
bs.broadcastmessage(name + ":" + msg[1:],
|
||||
clients=[i.inputdevice.client_id],
|
||||
color=(0.3, 0.6, 0.3), transient=True)
|
||||
|
||||
return None
|
||||
|
|
@ -118,15 +117,17 @@ def QuickAccess(msg, client_id):
|
|||
msg = msg[1:]
|
||||
msgAr = msg.split(" ")
|
||||
if len(msg) > 25 or int(len(msg) / 5) > len(msgAr):
|
||||
_bs.broadcastmessage("msg/word length too long",
|
||||
bs.broadcastmessage("msg/word length too long",
|
||||
clients=[client_id], transient=True)
|
||||
return None
|
||||
msgAr.insert(int(len(msgAr) / 2), "\n")
|
||||
for player in _babase.get_foreground_host_activity().players:
|
||||
if player.sessionplayer.inputdevice.client_id == client_id and player.actor.exists() and hasattr(player.actor.node, "position"):
|
||||
if player.sessionplayer.inputdevice.client_id == client_id and player.actor.exists() and hasattr(
|
||||
player.actor.node, "position"):
|
||||
pos = player.actor.node.position
|
||||
with _babase.Context(_babase.get_foreground_host_activity()):
|
||||
with bs.get_foreground_host_activity().context:
|
||||
popuptext.PopupText(
|
||||
" ".join(msgAr), (pos[0], pos[1] + 1, pos[2])).autoretain()
|
||||
" ".join(msgAr),
|
||||
(pos[0], pos[1] + 1, pos[2])).autoretain()
|
||||
return None
|
||||
return None
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
from .Handlers import send
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
from stats import mystats
|
||||
from babase._general import Call
|
||||
import _thread
|
||||
|
||||
import _babase
|
||||
import _bascenev1
|
||||
from stats import mystats
|
||||
|
||||
import bascenev1 as bs
|
||||
from babase._general import Call
|
||||
from .handlers import send
|
||||
|
||||
Commands = ['me', 'list', 'uniqeid', 'ping']
|
||||
CommandAliases = ['stats', 'score', 'rank',
|
||||
'myself', 'l', 'id', 'pb-id', 'pb', 'accountid']
|
||||
|
|
@ -39,7 +41,7 @@ def ExcelCommand(command, arguments, clientid, accountid):
|
|||
|
||||
def get_ping(arguments, clientid):
|
||||
if arguments == [] or arguments == ['']:
|
||||
send(f"Your ping {_babase.get_client_ping(clientid)}ms ", clientid)
|
||||
send(f"Your ping {_bascenev1.get_client_ping(clientid)}ms ", clientid)
|
||||
elif arguments[0] == 'all':
|
||||
pingall(clientid)
|
||||
else:
|
||||
|
|
@ -49,7 +51,7 @@ def get_ping(arguments, clientid):
|
|||
for index, player in enumerate(session.sessionplayers):
|
||||
name = player.getname(full=True, icon=False),
|
||||
if player.inputdevice.client_id == int(arguments[0]):
|
||||
ping = _babase.get_client_ping(int(arguments[0]))
|
||||
ping = _bascenev1.get_client_ping(int(arguments[0]))
|
||||
send(f" {name}'s ping {ping}ms", clientid)
|
||||
except:
|
||||
return
|
||||
|
|
@ -58,8 +60,10 @@ def get_ping(arguments, clientid):
|
|||
def stats(ac_id, clientid):
|
||||
stats = mystats.get_stats_by_id(ac_id)
|
||||
if stats:
|
||||
reply = "Score:"+str(stats["scores"])+"\nGames:"+str(stats["games"])+"\nKills:"+str(
|
||||
stats["kills"])+"\nDeaths:"+str(stats["deaths"])+"\nAvg.:"+str(stats["avg_score"])
|
||||
reply = "Score:" + str(stats["scores"]) + "\nGames:" + str(
|
||||
stats["games"]) + "\nKills:" + str(
|
||||
stats["kills"]) + "\nDeaths:" + str(
|
||||
stats["deaths"]) + "\nAvg.:" + str(stats["avg_score"])
|
||||
else:
|
||||
reply = "Not played any match yet."
|
||||
|
||||
|
|
@ -69,6 +73,7 @@ def stats(ac_id, clientid):
|
|||
def fetch_send_stats(ac_id, clientid):
|
||||
_thread.start_new_thread(stats, (ac_id, clientid,))
|
||||
|
||||
|
||||
def pingall(clientid):
|
||||
"""Returns The List Of Players Clientid and index"""
|
||||
|
||||
|
|
@ -80,10 +85,12 @@ def pingall(clientid):
|
|||
|
||||
for index, player in enumerate(session.sessionplayers):
|
||||
list += p.format(player.getname(icon=True),
|
||||
_babase.get_client_ping(int(player.inputdevice.client_id)))+"\n"
|
||||
_bascenev1.get_client_ping(
|
||||
int(player.inputdevice.client_id))) + "\n"
|
||||
|
||||
send(list, clientid)
|
||||
|
||||
|
||||
def list(clientid):
|
||||
"""Returns The List Of Players Clientid and index"""
|
||||
|
||||
123
dist/ba_root/mods/custom_hooks.py
vendored
123
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -8,39 +8,43 @@
|
|||
# pylint: disable=protected-access
|
||||
|
||||
from __future__ import annotations
|
||||
from baclassic._servermode import ServerController
|
||||
from bascenev1._session import Session
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from datetime import datetime
|
||||
import _thread
|
||||
import importlib
|
||||
import time
|
||||
import os
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import _bascenev1
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import _babase
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
import bauiv1 as bui
|
||||
import setting
|
||||
from baclassic._servermode import ServerController
|
||||
from bascenev1._activitytypes import ScoreScreenActivity
|
||||
from bascenev1._map import Map
|
||||
from bascenev1._session import Session
|
||||
from bascenev1lib.activity import dualteamscore, multiteamscore, drawscore
|
||||
from bascenev1lib.activity.coopscore import CoopScoreScreen
|
||||
import setting
|
||||
from tools import account
|
||||
from chatHandle import handlechat
|
||||
from features import team_balancer, afk_check, fire_flies, hearts, dual_team_score as newdts
|
||||
from stats import mystats
|
||||
from spazmod import modifyspaz
|
||||
from tools import servercheck, ServerUpdate, logger, playlist, servercontroller
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
from features import votingmachine
|
||||
from features import text_on_map, announcement
|
||||
from bascenev1lib.actor import playerspaz
|
||||
from chathandle import handlechat
|
||||
from features import map_fun
|
||||
|
||||
from features import team_balancer, afk_check, dual_team_score as newdts
|
||||
from features import text_on_map, announcement
|
||||
from features import votingmachine
|
||||
from playersdata import pdata
|
||||
from serverdata import serverdata
|
||||
from spazmod import modifyspaz
|
||||
from stats import mystats
|
||||
from tools import account
|
||||
from tools import notification_manager
|
||||
from tools import servercheck, ServerUpdate, logger, playlist, servercontroller
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any
|
||||
from typing import Any
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
|
@ -49,7 +53,10 @@ def filter_chat_message(msg: str, client_id: int) -> str | None:
|
|||
"""Returns all in game messages or None (ignore's message)."""
|
||||
return handlechat.filter_chat_message(msg, client_id)
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
|
||||
|
||||
class modSetup(babase.Plugin):
|
||||
def on_app_running(self):
|
||||
"""Runs when app is launched."""
|
||||
|
|
@ -62,7 +69,8 @@ class modSetup(babase.Plugin):
|
|||
afk_check.checkIdle().start()
|
||||
if (settings["useV2Account"]):
|
||||
|
||||
if (babase.internal.get_v1_account_state() == 'signed_in' and babase.internal.get_v1_account_type() == 'V2'):
|
||||
if (babase.internal.get_v1_account_state() ==
|
||||
'signed_in' and babase.internal.get_v1_account_type() == 'V2'):
|
||||
logging.debug("Account V2 is active")
|
||||
else:
|
||||
logging.warning("Account V2 login require ....stay tuned.")
|
||||
|
|
@ -74,7 +82,8 @@ class modSetup(babase.Plugin):
|
|||
plus.sign_in_v1('Local')
|
||||
bs.apptimer(60, playlist.flush_playlists)
|
||||
|
||||
# it works sometimes , but it blocks shutdown so server raise runtime exception, also dump server logs
|
||||
# it works sometimes , but it blocks shutdown so server raise runtime
|
||||
# exception, also dump server logs
|
||||
def on_app_shutdown(self):
|
||||
print("Server shutting down , lets save cache")
|
||||
# lets try threading here
|
||||
|
|
@ -82,29 +91,36 @@ class modSetup(babase.Plugin):
|
|||
# _thread.start_new_thread(notification_manager.dump_cache, ())
|
||||
# print("Done dumping memory")
|
||||
|
||||
from bascenev1._activitytypes import ScoreScreenActivity
|
||||
|
||||
def score_screen_on_begin(func) -> None:
|
||||
"""Runs when score screen is displayed."""
|
||||
|
||||
def wrapper(self, *args, **kwargs):
|
||||
result = func(self, *args, **kwargs) # execute the original method
|
||||
team_balancer.balanceTeams()
|
||||
mystats.update(self._stats)
|
||||
announcement.showScoreScreenAnnouncement()
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
|
||||
ScoreScreenActivity.on_begin = score_screen_on_begin(ScoreScreenActivity.on_begin)
|
||||
|
||||
from bascenev1._map import Map
|
||||
ScoreScreenActivity.on_begin = score_screen_on_begin(
|
||||
ScoreScreenActivity.on_begin)
|
||||
|
||||
|
||||
def on_map_init(func):
|
||||
def wrapper(self, *args, **kwargs):
|
||||
func(self, *args, **kwargs)
|
||||
text_on_map.textonmap()
|
||||
modifyspaz.setTeamCharacter()
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
Map.__init__ = on_map_init(Map.__init__)
|
||||
|
||||
|
||||
def playerspaz_init(playerspaz: bs.Player, node: bs.Node, player: bs.Player):
|
||||
"""Runs when player is spawned on map."""
|
||||
modifyspaz.main(playerspaz, node, player)
|
||||
|
|
@ -117,7 +133,8 @@ def bootstraping():
|
|||
# _bascenev1.set_server_name(settings["HostName"])
|
||||
# _bascenev1.set_transparent_kickvote(settings["ShowKickVoteStarterName"])
|
||||
# _bascenev1.set_kickvote_msg_type(settings["KickVoteMsgType"])
|
||||
# bs.hide_player_device_id(settings["Anti-IdRevealer"]) TODO add call in cpp
|
||||
# bs.hide_player_device_id(settings["Anti-IdRevealer"]) TODO add call in
|
||||
# cpp
|
||||
|
||||
# check for auto update stats
|
||||
_thread.start_new_thread(mystats.refreshStats, ())
|
||||
|
|
@ -159,7 +176,8 @@ def bootstraping():
|
|||
# Install psutil package
|
||||
# Download get-pip.py
|
||||
curl_process = subprocess.Popen(
|
||||
["curl", "-sS", "https://bootstrap.pypa.io/get-pip.py"], stdout=subprocess.PIPE)
|
||||
["curl", "-sS", "https://bootstrap.pypa.io/get-pip.py"],
|
||||
stdout=subprocess.PIPE)
|
||||
|
||||
# Install pip using python3.10
|
||||
python_process = subprocess.Popen(
|
||||
|
|
@ -176,7 +194,7 @@ def bootstraping():
|
|||
_babase.quit()
|
||||
from tools import healthcheck
|
||||
healthcheck.main()
|
||||
except:
|
||||
except BaseException:
|
||||
logging.warning("please install psutil to enable system monitor.")
|
||||
|
||||
# import features
|
||||
|
|
@ -194,7 +212,8 @@ def import_discord_bot() -> None:
|
|||
if settings["discordbot"]["enable"]:
|
||||
from features import discord_bot
|
||||
discord_bot.token = settings["discordbot"]["token"]
|
||||
discord_bot.liveStatsChannelID = settings["discordbot"]["liveStatsChannelID"]
|
||||
discord_bot.liveStatsChannelID = settings["discordbot"][
|
||||
"liveStatsChannelID"]
|
||||
discord_bot.logsChannelID = settings["discordbot"]["logsChannelID"]
|
||||
discord_bot.liveChat = settings["discordbot"]["liveChat"]
|
||||
discord_bot.BsDataThread()
|
||||
|
|
@ -243,7 +262,8 @@ bs._activity.Activity.on_begin = new_begin
|
|||
org_end = bs._activity.Activity.end
|
||||
|
||||
|
||||
def new_end(self, results: Any = None, delay: float = 0.0, force: bool = False):
|
||||
def new_end(self, results: Any = None,
|
||||
delay: float = 0.0, force: bool = False):
|
||||
"""Runs when game is ended."""
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
|
|
@ -305,17 +325,15 @@ def on_join_request(ip):
|
|||
servercheck.on_join_request(ip)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def shutdown(func) -> None:
|
||||
"""Set the app to quit either now or at the next clean opportunity."""
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
# add screen text and tell players we are going to restart soon.
|
||||
bs.chatmessage(
|
||||
"Server will restart on next opportunity. (series end)")
|
||||
_babase.restart_scheduled = True
|
||||
_babase.get_foreground_host_activity().restart_msg = _bs.newnode('text',
|
||||
bs.get_foreground_host_activity().restart_msg = bs.newnode('text',
|
||||
attrs={
|
||||
'text': "Server going to restart after this series.",
|
||||
'flatness': 1.0,
|
||||
|
|
@ -323,10 +341,16 @@ def shutdown(func) -> None:
|
|||
'v_attach': 'bottom',
|
||||
'h_attach': 'right',
|
||||
'scale': 0.5,
|
||||
'position': (-25, 54),
|
||||
'color': (1, 0.5, 0.7)
|
||||
'position': (
|
||||
-25,
|
||||
54),
|
||||
'color': (
|
||||
1,
|
||||
0.5,
|
||||
0.7)
|
||||
})
|
||||
func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
|
|
@ -337,16 +361,21 @@ def on_player_request(func) -> bool:
|
|||
def wrapper(*args, **kwargs):
|
||||
player = args[1]
|
||||
count = 0
|
||||
if not (player.get_v1_account_id() in serverdata.clients and serverdata.clients[player.get_v1_account_id()]["verified"]):
|
||||
if not (player.get_v1_account_id(
|
||||
) in serverdata.clients and
|
||||
serverdata.clients[player.get_v1_account_id()]["verified"]):
|
||||
return False
|
||||
for current_player in args[0].sessionplayers:
|
||||
if current_player.get_v1_account_id() == player.get_v1_account_id():
|
||||
count += 1
|
||||
if count >= settings["maxPlayersPerDevice"]:
|
||||
_bs.broadcastmessage("Reached max players limit per device", clients=[
|
||||
player.inputdevice.client_id], transient=True,)
|
||||
bs.broadcastmessage("Reached max players limit per device",
|
||||
clients=[
|
||||
player.inputdevice.client_id],
|
||||
transient=True, )
|
||||
return False
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
|
|
@ -354,18 +383,20 @@ Session.on_player_request = on_player_request(Session.on_player_request)
|
|||
|
||||
ServerController._access_check_response = servercontroller._access_check_response
|
||||
|
||||
from bascenev1lib.actor import playerspaz
|
||||
|
||||
def wrap_player_spaz_init(original_class):
|
||||
"""
|
||||
Modify the __init__ method of the player_spaz.
|
||||
"""
|
||||
|
||||
class WrappedClass(original_class):
|
||||
def __init__(self, *args, **kwargs):
|
||||
# Custom code before the original __init__
|
||||
|
||||
# Modify args or kwargs as needed
|
||||
player = args[0] if args else kwargs.get('player')
|
||||
character = args[3] if len(args) > 3 else kwargs.get('character', 'Spaz')
|
||||
character = args[3] if len(
|
||||
args) > 3 else kwargs.get('character', 'Spaz')
|
||||
|
||||
print(f"Player: {player}, Character: {character}")
|
||||
# Modify the character value
|
||||
|
|
@ -381,4 +412,6 @@ def wrap_player_spaz_init(original_class):
|
|||
|
||||
# Return the modified class
|
||||
return WrappedClass
|
||||
|
||||
|
||||
playerspaz.PlayerSpaz = wrap_player_spaz_init(playerspaz.PlayerSpaz)
|
||||
|
|
|
|||
BIN
dist/ba_root/mods/features/StumbledScoreScreen.so
vendored
BIN
dist/ba_root/mods/features/StumbledScoreScreen.so
vendored
Binary file not shown.
39
dist/ba_root/mods/features/afk_check.py
vendored
39
dist/ba_root/mods/features/afk_check.py
vendored
|
|
@ -1,31 +1,35 @@
|
|||
# Custom kick idle player script by mr.smoothy#5824
|
||||
import time
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from babase._general import Call
|
||||
import _babase
|
||||
|
||||
import setting
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
INGAME_TIME = settings["afk_remover"]["ingame_idle_time_in_secs"]
|
||||
LOBBY_KICK = settings['afk_remover']["kick_idle_from_lobby"]
|
||||
INLOBBY_TIME = settings['afk_remover']["lobby_idle_time_in_secs"]
|
||||
cIdle = 0 # players/player found idle within very short time
|
||||
cLastIdle = 0
|
||||
|
||||
|
||||
class checkIdle(object):
|
||||
def start(self):
|
||||
self.t1 = bs.timer(2, babase.Call(self.check), repeat=True)
|
||||
self.lobbies = {}
|
||||
|
||||
def check(self):
|
||||
global cLastIdle
|
||||
global cIdle
|
||||
current=bs.time(babase.TimeType.REAL,timeformat=babase.TimeFormat.MILLISECONDS)
|
||||
current = bs.time(babase.TimeType.REAL,
|
||||
timeformat=babase.TimeFormat.MILLISECONDS)
|
||||
if not bs.get_foreground_host_session():
|
||||
return
|
||||
for player in bs.get_foreground_host_session().sessionplayers:
|
||||
last_input = int(player.inputdevice.get_last_input_time())
|
||||
afk_time = int((current - last_input) / 1000)
|
||||
if afk_time in range(INGAME_TIME,INGAME_TIME+20) or afk_time > INGAME_TIME+20:
|
||||
if afk_time in range(INGAME_TIME,
|
||||
INGAME_TIME + 20) or afk_time > INGAME_TIME + 20:
|
||||
if (current - cLastIdle) / 1000 < 3:
|
||||
cIdle = cIdle + 1
|
||||
if cIdle >= 3:
|
||||
|
|
@ -35,7 +39,9 @@ class checkIdle(object):
|
|||
cLastIdle = current
|
||||
|
||||
if afk_time in range(INGAME_TIME, INGAME_TIME + 20):
|
||||
self.warn_player(player.get_v1_account_id(),"Press any button within "+str(INGAME_TIME+20-afk_time)+" secs")
|
||||
self.warn_player(player.get_v1_account_id(),
|
||||
"Press any button within " + str(
|
||||
INGAME_TIME + 20 - afk_time) + " secs")
|
||||
if afk_time > INGAME_TIME + 20:
|
||||
player.remove_from_game()
|
||||
if LOBBY_KICK:
|
||||
|
|
@ -45,9 +51,13 @@ class checkIdle(object):
|
|||
current_players.append(player['client_id'])
|
||||
if player['client_id'] not in self.lobbies:
|
||||
self.lobbies[player['client_id']] = current
|
||||
lobby_afk=int((current - self.lobbies[player['client_id']])/1000)
|
||||
lobby_afk = int(
|
||||
(current - self.lobbies[player['client_id']]) / 1000)
|
||||
if lobby_afk in range(INLOBBY_TIME, INLOBBY_TIME + 10):
|
||||
_bs.broadcastmessage("Join game within "+str(INLOBBY_TIME+10-lobby_afk)+" secs",color=(1,0,0),transient=True,clients=[player['client_id']])
|
||||
_bs.broadcastmessage("Join game within " + str(
|
||||
INLOBBY_TIME + 10 - lobby_afk) + " secs",
|
||||
color=(1, 0, 0), transient=True,
|
||||
clients=[player['client_id']])
|
||||
if lobby_afk > INLOBBY_TIME + 10:
|
||||
bs.disconnect_client(player['client_id'], 0)
|
||||
# clean the lobbies dict
|
||||
|
|
@ -55,10 +65,9 @@ class checkIdle(object):
|
|||
for clid in temp:
|
||||
if clid not in current_players:
|
||||
del self.lobbies[clid]
|
||||
|
||||
def warn_player(self, pbid, msg):
|
||||
for player in bs.get_game_roster():
|
||||
if player["account_id"] == pbid:
|
||||
_bs.broadcastmessage(msg,color=(1,0,0),transient=True,clients=[player['client_id']])
|
||||
|
||||
|
||||
|
||||
bs.broadcastmessage(msg, color=(1, 0, 0), transient=True,
|
||||
clients=[player['client_id']])
|
||||
|
|
|
|||
12
dist/ba_root/mods/features/announcement.py
vendored
12
dist/ba_root/mods/features/announcement.py
vendored
|
|
@ -1,13 +1,15 @@
|
|||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
|
||||
import setting
|
||||
import random
|
||||
|
||||
import bascenev1 as bs
|
||||
|
||||
setti = setting.get_settings_data()
|
||||
|
||||
|
||||
def showScoreScreenAnnouncement():
|
||||
if setti["ScoreScreenAnnouncement"]["enable"]:
|
||||
color=((0+random.random()*1.0),(0+random.random()*1.0),(0+random.random()*1.0))
|
||||
color = ((0 + random.random() * 1.0), (0 + random.random() * 1.0),
|
||||
(0 + random.random() * 1.0))
|
||||
msgs = setti["ScoreScreenAnnouncement"]["msg"]
|
||||
bs.broadcastmessage(random.choice(msgs), color=color)
|
||||
|
|
|
|||
24
dist/ba_root/mods/features/discord_bot.py
vendored
24
dist/ba_root/mods/features/discord_bot.py
vendored
|
|
@ -1,23 +1,20 @@
|
|||
|
||||
import discord
|
||||
import asyncio
|
||||
import logging
|
||||
from threading import Thread
|
||||
|
||||
import _babase
|
||||
import discord
|
||||
from discord.ext.commands import Bot
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from babase._general import Call
|
||||
import _babaseimport babase.internal
|
||||
import json
|
||||
import os
|
||||
import _thread
|
||||
import logging
|
||||
|
||||
logging.getLogger('asyncio').setLevel(logging.WARNING)
|
||||
intents = discord.Intents().all()
|
||||
|
||||
client = Bot(command_prefix='!', intents=intents)
|
||||
|
||||
|
||||
# client = discord.Client()
|
||||
|
||||
|
||||
|
|
@ -36,7 +33,6 @@ def push_log(msg):
|
|||
|
||||
|
||||
def init():
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(client.start(token))
|
||||
|
||||
|
|
@ -91,7 +87,6 @@ async def refresh_stats():
|
|||
await client.wait_until_ready()
|
||||
|
||||
while not client.is_closed():
|
||||
|
||||
await livestatsmsgs[0].edit(content=get_live_players_msg())
|
||||
await livestatsmsgs[1].edit(content=get_chats())
|
||||
await asyncio.sleep(10)
|
||||
|
|
@ -183,10 +178,13 @@ class BsDataThread(object):
|
|||
for i in babase.internal.get_game_roster():
|
||||
try:
|
||||
liveplayers[i['account_id']] = {
|
||||
'name': i['players'][0]['name_full'], 'client_id': i['client_id'], 'device_id': i['display_string']}
|
||||
'name': i['players'][0]['name_full'],
|
||||
'client_id': i['client_id'],
|
||||
'device_id': i['display_string']}
|
||||
except:
|
||||
liveplayers[i['account_id']] = {
|
||||
'name': "<in-lobby>", 'clientid': i['client_id'], 'device_id': i['display_string']}
|
||||
'name': "<in-lobby>", 'clientid': i['client_id'],
|
||||
'device_id': i['display_string']}
|
||||
try:
|
||||
nextMap = babase.internal.get_foreground_host_session(
|
||||
).get_next_game_description().evaluate()
|
||||
|
|
|
|||
30
dist/ba_root/mods/features/dual_team_score.py
vendored
30
dist/ba_root/mods/features/dual_team_score.py
vendored
|
|
@ -7,12 +7,12 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.activity.multiteamscore import MultiTeamScoreScreenActivity
|
||||
from bascenev1lib.actor.zoomtext import ZoomText
|
||||
from bascenev1lib.actor.text import Text
|
||||
from bascenev1lib.actor.image import Image
|
||||
from bascenev1lib.actor.text import Text
|
||||
from bascenev1lib.actor.zoomtext import ZoomText
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
|
@ -64,8 +64,7 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
i * 0.15 + 0.15,
|
||||
bs.WeakCall(self._show_team_name, vval - i * height, team,
|
||||
i * 0.2, shift_time - (i * 0.150 + 0.150)))
|
||||
bs.timer(i * 0.150 + 0.5,
|
||||
babase.Call(babase.playsound, self._score_display_sound_small))
|
||||
bs.timer(i * 0.150 + 0.5, self._score_display_sound_small.play)
|
||||
scored = (team is self._winner)
|
||||
delay = 0.2
|
||||
if scored:
|
||||
|
|
@ -74,8 +73,7 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
i * 0.150 + 0.2,
|
||||
bs.WeakCall(self._show_team_old_score, vval - i * height,
|
||||
team, shift_time - (i * 0.15 + 0.2)))
|
||||
bs.timer(i * 0.15 + 1.5,
|
||||
babase.Call(babase.playsound, self._score_display_sound))
|
||||
bs.timer(i * 0.15 + 1.5, self._score_display_sound.play)
|
||||
|
||||
bs.timer(
|
||||
i * 0.150 + delay,
|
||||
|
|
@ -185,7 +183,7 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
|
||||
def show_player_scores(self,
|
||||
delay: float = 2.5,
|
||||
results: Optional[bs.GameResults] = None,
|
||||
results: bs.GameResults | None = None,
|
||||
scale: float = 1.0,
|
||||
x_offset: float = 0.0,
|
||||
y_offset: float = 0.0) -> None:
|
||||
|
|
@ -334,7 +332,10 @@ def show_player_scores(self,
|
|||
|
||||
Text(text,
|
||||
position=(ts_h_offs + x_offs * scale,
|
||||
ts_v_offset + (voffs + 15) * scale) if team_id == 1 else (ts_h_offs+x_offs*scale, ts_v_offset+(voffs_team0+15)*scale),
|
||||
ts_v_offset + (
|
||||
voffs + 15) * scale) if team_id == 1 else (
|
||||
ts_h_offs + x_offs * scale,
|
||||
ts_v_offset + (voffs_team0 + 15) * scale),
|
||||
scale=scale,
|
||||
color=(1.0, 0.9, 0.5, 1.0) if highlight else
|
||||
(0.5, 0.5, 0.6, 0.5),
|
||||
|
|
@ -342,7 +343,8 @@ def show_player_scores(self,
|
|||
v_align=Text.VAlign.CENTER,
|
||||
maxwidth=maxwidth,
|
||||
transition=Text.Transition.IN_LEFT,
|
||||
transition_delay=(tdelay + delay2) if team_id == 1 else (tdelay_team0+delay2)).autoretain()
|
||||
transition_delay=(tdelay + delay2) if team_id == 1 else (
|
||||
tdelay_team0 + delay2)).autoretain()
|
||||
|
||||
for playerrec in player_records:
|
||||
if is_two_team and playerrec.team.id == 0:
|
||||
|
|
@ -378,9 +380,11 @@ def show_player_scores(self,
|
|||
|
||||
if is_two_team and playerrec.team.id == 0:
|
||||
_scoretxt(str(playerrec.accum_kill_count), -400,
|
||||
playerrec.accum_kill_count == topkillcount, 0.1, team_id=0)
|
||||
playerrec.accum_kill_count == topkillcount, 0.1,
|
||||
team_id=0)
|
||||
_scoretxt(str(playerrec.accum_killed_count), -300,
|
||||
playerrec.accum_killed_count == topkilledcount, 0.1, team_id=0)
|
||||
playerrec.accum_killed_count == topkilledcount, 0.1,
|
||||
team_id=0)
|
||||
_scoretxt(_get_prec_score_str(playerrec), -190,
|
||||
_get_prec_score(playerrec) == top_score, 0.2, team_id=0)
|
||||
else:
|
||||
|
|
@ -410,5 +414,5 @@ class DrawScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||
scale=0.7,
|
||||
trail=False,
|
||||
jitter=1.0).autoretain()
|
||||
bs.timer(0.35, babase.Call(babase.playsound, self._score_display_sound))
|
||||
bs.timer(0.35, self._score_display_sound.play)
|
||||
self.show_player_scores(results=self.settings_raw.get('results', None))
|
||||
|
|
|
|||
18
dist/ba_root/mods/features/fire_flies.py
vendored
18
dist/ba_root/mods/features/fire_flies.py
vendored
|
|
@ -1,12 +1,10 @@
|
|||
import random
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
from bascenev1._messages import DeathType, OutOfBoundsMessage
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
import random
|
||||
import weakref
|
||||
from bascenev1._messages import DieMessage, DeathType, OutOfBoundsMessage, UNHANDLED
|
||||
|
||||
on_begin_original = bs._activity.Activity.on_begin
|
||||
|
||||
|
||||
|
|
@ -67,8 +65,11 @@ class FireFly(bs.Actor):
|
|||
('modify_part_collision', 'collide', False),
|
||||
('modify_part_collision', 'physical', False),
|
||||
))
|
||||
self.node = bs.newnode('locator', attrs={'shape': 'circle', 'position': (0, .5, 0),
|
||||
'color': self.color, 'opacity': 0.5, 'draw_beauty': True, 'additive': False, 'size': [0.10]})
|
||||
self.node = bs.newnode('locator',
|
||||
attrs={'shape': 'circle', 'position': (0, .5, 0),
|
||||
'color': self.color, 'opacity': 0.5,
|
||||
'draw_beauty': True, 'additive': False,
|
||||
'size': [0.10]})
|
||||
# bs.animate(
|
||||
# self.node,
|
||||
# 'scale',
|
||||
|
|
@ -120,7 +121,8 @@ class FireFly(bs.Actor):
|
|||
self.off()
|
||||
return None
|
||||
elif isinstance(msg, OutOfBoundsMessage):
|
||||
return self.handlemessage(bs.DieMessage(how=DeathType.OUT_OF_BOUNDS))
|
||||
return self.handlemessage(
|
||||
bs.DieMessage(how=DeathType.OUT_OF_BOUNDS))
|
||||
return super().handlemessage(msg)
|
||||
|
||||
def generate_keys(self, m):
|
||||
|
|
|
|||
14
dist/ba_root/mods/features/hearts.py
vendored
14
dist/ba_root/mods/features/hearts.py
vendored
|
|
@ -1,13 +1,10 @@
|
|||
import random
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
|
||||
from typing import Any, Sequence
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
|
||||
class PopupText(bs.Actor):
|
||||
"""Text that pops up above a position to denote something special.
|
||||
|
|
@ -135,7 +132,8 @@ def spawn_heart():
|
|||
bounds = activity.map.get_def_bound_box("area_of_interest_bounds")
|
||||
for i in range(0, 4):
|
||||
position = (random.uniform(bounds[0], bounds[3]), random.uniform(
|
||||
bounds[4]*1.15, bounds[4]*1.45)-8, random.uniform(bounds[2], bounds[5]))
|
||||
bounds[4] * 1.15, bounds[4] * 1.45) - 8,
|
||||
random.uniform(bounds[2], bounds[5]))
|
||||
with activity.context:
|
||||
k = PopupText(u"\ue047", position)
|
||||
activity.heart.append(k)
|
||||
|
|
@ -143,4 +141,6 @@ def spawn_heart():
|
|||
|
||||
def start(activity):
|
||||
bs.timer(random.uniform(7, 8), spawn_heart, repeat=True)
|
||||
|
||||
|
||||
bs._activity.Activity.hearts_generator = start
|
||||
|
|
|
|||
5
dist/ba_root/mods/features/map_fun.py
vendored
5
dist/ba_root/mods/features/map_fun.py
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import bascenev1 as bs
|
||||
import random
|
||||
|
||||
|
||||
def decorate_map():
|
||||
try:
|
||||
|
|
@ -13,7 +13,8 @@ def decorate_map():
|
|||
m = 5
|
||||
s = 5000
|
||||
bs.animate_array(activity.globalsnode, 'ambient_color', 3, {0: (
|
||||
1*m, 0, 0), s: (0, 1*m, 0), s*2: (0, 0, 1*m), s*3: (1*m, 0, 0)}, True)
|
||||
1 * m, 0, 0), s: (0, 1 * m, 0), s * 2: (0, 0, 1 * m),
|
||||
s * 3: (1 * m, 0, 0)}, True)
|
||||
activity.map.background.reflection = "soft"
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
1
dist/ba_root/mods/features/profanity.py
vendored
1
dist/ba_root/mods/features/profanity.py
vendored
|
|
@ -50,6 +50,7 @@ PATTERN = (
|
|||
r"ni+p+le+"
|
||||
)
|
||||
|
||||
|
||||
def censor(message):
|
||||
censored_message = re.sub(
|
||||
PATTERN,
|
||||
|
|
|
|||
27
dist/ba_root/mods/features/team_balancer.py
vendored
27
dist/ba_root/mods/features/team_balancer.py
vendored
|
|
@ -1,19 +1,23 @@
|
|||
from tools import playlist
|
||||
import _babase
|
||||
import setting
|
||||
from serverData import serverdata
|
||||
|
||||
import bascenev1 as bs
|
||||
from bascenev1._dualteamsession import DualTeamSession
|
||||
from bascenev1._coopsession import CoopSession
|
||||
from bascenev1._dualteamsession import DualTeamSession
|
||||
from tools import playlist
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
|
||||
def balanceTeams():
|
||||
session = bs.get_foreground_host_session()
|
||||
if settings["coopModeWithLessPlayers"]["enable"] and len(session.sessionplayers) < settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"]:
|
||||
if settings["coopModeWithLessPlayers"]["enable"] and len(
|
||||
session.sessionplayers) < settings["coopModeWithLessPlayers"][
|
||||
"minPlayerToExitCoop"]:
|
||||
playlist.setPlaylist('coop')
|
||||
return
|
||||
if not isinstance(session, DualTeamSession) or len(session.sessionplayers) < 4 or len(session.sessionteams) != 2:
|
||||
if not isinstance(session, DualTeamSession) or len(
|
||||
session.sessionplayers) < 4 or len(session.sessionteams) != 2:
|
||||
return
|
||||
teamASize = 0
|
||||
teamBSize = 0
|
||||
|
|
@ -44,7 +48,8 @@ def movePlayers(fromTeam, toTeam, count):
|
|||
color=toTeam.color, highlight=player.highlight)
|
||||
iconinfo = player.get_icon_info()
|
||||
player.set_icon_info(
|
||||
iconinfo['texture'], iconinfo['tint_texture'], toTeam.color, player.highlight)
|
||||
iconinfo['texture'], iconinfo['tint_texture'], toTeam.color,
|
||||
player.highlight)
|
||||
toTeam.players.append(player)
|
||||
player.sessionteam.activityteam.players.append(player.activityplayer)
|
||||
|
||||
|
|
@ -61,16 +66,20 @@ def on_player_join():
|
|||
if len(session.sessionplayers) > 1:
|
||||
return
|
||||
if isinstance(session, DualTeamSession):
|
||||
if settings["coopModeWithLessPlayers"]["enable"] and len(session.sessionplayers) < settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"]:
|
||||
if settings["coopModeWithLessPlayers"]["enable"] and len(
|
||||
session.sessionplayers) < settings["coopModeWithLessPlayers"][
|
||||
"minPlayerToExitCoop"]:
|
||||
playlist.setPlaylist('coop')
|
||||
|
||||
# this not usefull now ., leave it here for now
|
||||
elif isinstance(session, CoopSession):
|
||||
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"]:
|
||||
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"][
|
||||
"minPlayerToExitCoop"]:
|
||||
playlist.setPlaylist('default')
|
||||
|
||||
|
||||
def checkToExitCoop():
|
||||
session = bs.get_foreground_host_session()
|
||||
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"]["minPlayerToExitCoop"] and not serverdata.coopmode:
|
||||
if len(session.sessionplayers) >= settings["coopModeWithLessPlayers"][
|
||||
"minPlayerToExitCoop"] and not serverdata.coopmode:
|
||||
playlist.setPlaylist('default')
|
||||
|
|
|
|||
73
dist/ba_root/mods/features/text_on_map.py
vendored
73
dist/ba_root/mods/features/text_on_map.py
vendored
|
|
@ -2,16 +2,18 @@
|
|||
|
||||
""" TODO need to set coordinates of text node , move timer values to settings.json """
|
||||
|
||||
import random
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import setting
|
||||
from stats import mystats
|
||||
from datetime import datetime
|
||||
import random
|
||||
import _babase
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
setti = setting.get_settings_data()
|
||||
|
||||
|
||||
class textonmap:
|
||||
|
||||
def __init__(self):
|
||||
|
|
@ -23,7 +25,11 @@ class textonmap:
|
|||
nextMap = bs.get_foreground_host_session().get_next_game_description().evaluate()
|
||||
except:
|
||||
pass
|
||||
top = top.replace("@IP", _babase.our_ip).replace("@PORT", str(_babase.our_port))
|
||||
try:
|
||||
top = top.replace("@IP", _babase.our_ip).replace("@PORT",
|
||||
str(_babase.our_port))
|
||||
except:
|
||||
pass
|
||||
self.index = 0
|
||||
self.highlights = data['center highlights']["msg"]
|
||||
self.left_watermark(left)
|
||||
|
|
@ -39,7 +45,8 @@ class textonmap:
|
|||
|
||||
def highlights_(self):
|
||||
if setti["textonmap"]['center highlights']["randomColor"]:
|
||||
color=((0+random.random()*1.0),(0+random.random()*1.0),(0+random.random()*1.0))
|
||||
color = ((0 + random.random() * 1.0), (0 + random.random() * 1.0),
|
||||
(0 + random.random() * 1.0))
|
||||
else:
|
||||
color = tuple(setti["textonmap"]["center highlights"]["color"])
|
||||
node = bs.newnode('text',
|
||||
|
|
@ -68,6 +75,7 @@ class textonmap:
|
|||
'position': (25, 67),
|
||||
'color': (0.7, 0.7, 0.7)
|
||||
})
|
||||
|
||||
def nextGame(self, text):
|
||||
node = bs.newnode('text',
|
||||
attrs={
|
||||
|
|
@ -80,6 +88,7 @@ class textonmap:
|
|||
'position': (-25, 16),
|
||||
'color': (0.5, 0.5, 0.5)
|
||||
})
|
||||
|
||||
def season_reset(self, text):
|
||||
node = bs.newnode('text',
|
||||
attrs={
|
||||
|
|
@ -92,9 +101,11 @@ class textonmap:
|
|||
'position': (-25, 34),
|
||||
'color': (0.6, 0.5, 0.7)
|
||||
})
|
||||
|
||||
def restart_msg(self):
|
||||
if hasattr(_babase, 'restart_scheduled'):
|
||||
_babase.get_foreground_host_activity().restart_msg = bs.newnode('text',
|
||||
_babase.get_foreground_host_activity().restart_msg = bs.newnode(
|
||||
'text',
|
||||
attrs={
|
||||
'text': "Server going to restart after this series.",
|
||||
'flatness': 1.0,
|
||||
|
|
@ -121,12 +132,44 @@ class textonmap:
|
|||
def leaderBoard(self):
|
||||
if len(mystats.top3Name) > 2:
|
||||
if setti["leaderboard"]["barsBehindName"]:
|
||||
self.ss1=bs.newnode('image',attrs={'scale':(300,30),'texture':bs.gettexture('bar'),'position':(0,-80),'attach':'topRight','opacity':0.5,'color':(0.7,0.1,0)})
|
||||
self.ss1=bs.newnode('image',attrs={'scale':(300,30),'texture':bs.gettexture('bar'),'position':(0,-115),'attach':'topRight','opacity':0.5,'color':(0.6,0.6,0.6)})
|
||||
self.ss1=bs.newnode('image',attrs={'scale':(300,30),'texture':bs.gettexture('bar'),'position':(0,-150),'attach':'topRight','opacity':0.5,'color':(0.1,0.3,0.1)})
|
||||
self.ss1 = bs.newnode('image', attrs={'scale': (300, 30),
|
||||
'texture': bs.gettexture(
|
||||
'bar'),
|
||||
'position': (0, -80),
|
||||
'attach': 'topRight',
|
||||
'opacity': 0.5,
|
||||
'color': (0.7, 0.1, 0)})
|
||||
self.ss1 = bs.newnode('image', attrs={'scale': (300, 30),
|
||||
'texture': bs.gettexture(
|
||||
'bar'),
|
||||
'position': (0, -115),
|
||||
'attach': 'topRight',
|
||||
'opacity': 0.5,
|
||||
'color': (0.6, 0.6, 0.6)})
|
||||
self.ss1 = bs.newnode('image', attrs={'scale': (300, 30),
|
||||
'texture': bs.gettexture(
|
||||
'bar'),
|
||||
'position': (0, -150),
|
||||
'attach': 'topRight',
|
||||
'opacity': 0.5,
|
||||
'color': (0.1, 0.3, 0.1)})
|
||||
|
||||
self.ss1a=bs.newnode('text',attrs={'text':"#1 "+mystats.top3Name[0][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-80),'scale':0.7,'color':(0.7,0.4,0.3)})
|
||||
self.ss1a = bs.newnode('text', attrs={
|
||||
'text': "#1 " + mystats.top3Name[0][:10] + "...",
|
||||
'flatness': 1.0, 'h_align': 'left', 'h_attach': 'right',
|
||||
'v_attach': 'top', 'v_align': 'center', 'position': (-140, -80),
|
||||
'scale': 0.7, 'color': (0.7, 0.4, 0.3)})
|
||||
|
||||
self.ss1a=bs.newnode('text',attrs={'text':"#2 "+mystats.top3Name[1][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-115),'scale':0.7,'color':(0.8,0.8,0.8)})
|
||||
self.ss1a = bs.newnode('text', attrs={
|
||||
'text': "#2 " + mystats.top3Name[1][:10] + "...",
|
||||
'flatness': 1.0, 'h_align': 'left', 'h_attach': 'right',
|
||||
'v_attach': 'top', 'v_align': 'center',
|
||||
'position': (-140, -115), 'scale': 0.7,
|
||||
'color': (0.8, 0.8, 0.8)})
|
||||
|
||||
self.ss1a=bs.newnode('text',attrs={'text':"#3 "+mystats.top3Name[2][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-150),'scale':0.7,'color':(0.2,0.6,0.2)})
|
||||
self.ss1a = bs.newnode('text', attrs={
|
||||
'text': "#3 " + mystats.top3Name[2][:10] + "...",
|
||||
'flatness': 1.0, 'h_align': 'left', 'h_attach': 'right',
|
||||
'v_attach': 'top', 'v_align': 'center',
|
||||
'position': (-140, -150), 'scale': 0.7,
|
||||
'color': (0.2, 0.6, 0.2)})
|
||||
|
|
|
|||
34
dist/ba_root/mods/features/votingmachine.py
vendored
34
dist/ba_root/mods/features/votingmachine.py
vendored
|
|
@ -1,10 +1,12 @@
|
|||
# Electronic Voting Machine (EVM) by -mr.smoothy
|
||||
|
||||
import _babase
|
||||
import time
|
||||
import bascenev1 as bs
|
||||
game_started_on = 0
|
||||
|
||||
import _babase
|
||||
|
||||
import bascenev1 as bs
|
||||
|
||||
game_started_on = 0
|
||||
|
||||
vote_machine = {"end": {"last_vote_start_time": 0, "vote_duration": 50,
|
||||
"min_game_duration_to_start_vote": 30, "voters": []},
|
||||
|
|
@ -21,14 +23,17 @@ def vote(pb_id, client_id, vote_type):
|
|||
voters = vote_machine[vote_type]["voters"]
|
||||
last_vote_start_time = vote_machine[vote_type]["last_vote_start_time"]
|
||||
vote_duration = vote_machine[vote_type]["vote_duration"]
|
||||
min_game_duration_to_start_vote = vote_machine[vote_type]["min_game_duration_to_start_vote"]
|
||||
min_game_duration_to_start_vote = vote_machine[vote_type][
|
||||
"min_game_duration_to_start_vote"]
|
||||
|
||||
now = time.time()
|
||||
if now > last_vote_start_time + vote_duration:
|
||||
voters = []
|
||||
vote_machine[vote_type]["last_vote_start_time"] = now
|
||||
if now < game_started_on + min_game_duration_to_start_vote:
|
||||
bs.broadcastmessage("Seems game just started, Try again after some time", transient=True,
|
||||
bs.broadcastmessage(
|
||||
"Seems game just started, Try again after some time",
|
||||
transient=True,
|
||||
clients=[client_id])
|
||||
return
|
||||
if len(voters) == 0:
|
||||
|
|
@ -43,7 +48,9 @@ def vote(pb_id, client_id, vote_type):
|
|||
voters.remove(voter)
|
||||
if pb_id not in voters:
|
||||
voters.append(pb_id)
|
||||
bs.broadcastmessage(f'Thanks for vote , encourage other players to type {vote_type} too.', transient=True,
|
||||
bs.broadcastmessage(
|
||||
f'Thanks for vote , encourage other players to type {vote_type} too.',
|
||||
transient=True,
|
||||
clients=[client_id])
|
||||
if vote_type == 'end':
|
||||
update_vote_text(max_votes_required(
|
||||
|
|
@ -52,10 +59,14 @@ def vote(pb_id, client_id, vote_type):
|
|||
activity = bs.get_foreground_host_activity()
|
||||
if activity is not None:
|
||||
with _babase.Context(activity):
|
||||
_bs.broadcastmessage(f"{max_votes_required(len(active_players)) - len(voters)} votes required for {vote_type}",
|
||||
image={"texture": bs.gettexture("achievementSharingIsCaring"),
|
||||
"tint_texture": bs.gettexture("achievementSharingIsCaring"),
|
||||
"tint_color": (0.5, 0.5, 0.5), "tint2_color": (0.7, 0.5, 0.9)},
|
||||
bs.broadcastmessage(
|
||||
f"{max_votes_required(len(active_players)) - len(voters)} votes required for {vote_type}",
|
||||
image={"texture": bs.gettexture(
|
||||
"achievementSharingIsCaring"),
|
||||
"tint_texture": bs.gettexture(
|
||||
"achievementSharingIsCaring"),
|
||||
"tint_color": (0.5, 0.5, 0.5),
|
||||
"tint2_color": (0.7, 0.5, 0.9)},
|
||||
top=True)
|
||||
vote_machine[vote_type]["voters"] = voters
|
||||
|
||||
|
|
@ -129,5 +140,6 @@ def update_vote_text(votes_needed):
|
|||
|
||||
def remove_vote_text():
|
||||
activity = bs.get_foreground_host_activity()
|
||||
if hasattr(activity, "end_vote_text") and activity.end_vote_text.node.exists():
|
||||
if hasattr(activity,
|
||||
"end_vote_text") and activity.end_vote_text.node.exists():
|
||||
activity.end_vote_text.node.delete()
|
||||
|
|
|
|||
|
|
@ -10,10 +10,9 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import (Any, Tuple, Type, List, Sequence, Optional,
|
||||
|
|
|
|||
18
dist/ba_root/mods/games/arms_race.py
vendored
18
dist/ba_root/mods/games/arms_race.py
vendored
|
|
@ -12,14 +12,14 @@ from typing import TYPE_CHECKING
|
|||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
from typing import Any, Type, List, Union, Sequence
|
||||
|
||||
|
||||
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.grab = grab
|
||||
self.punch = punch
|
||||
|
|
@ -110,7 +110,8 @@ class ArmsRaceGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.BoolSetting('Epic Mode', default=False)]
|
||||
for state in states:
|
||||
if not state.required:
|
||||
settings.append(bs.BoolSetting(state.get_setting(), default=True))
|
||||
settings.append(
|
||||
bs.BoolSetting(state.get_setting(), default=True))
|
||||
|
||||
return settings
|
||||
|
||||
|
|
@ -175,10 +176,13 @@ class ArmsRaceGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
if isinstance(msg, bs.PlayerDiedMessage):
|
||||
if self.isValidKill(msg):
|
||||
self.stats.player_scored(msg.getkillerplayer(Player), 10, kill=True)
|
||||
self.stats.player_scored(msg.getkillerplayer(Player), 10,
|
||||
kill=True)
|
||||
if not msg.getkillerplayer(Player).state.final:
|
||||
msg.getkillerplayer(Player).state = msg.getkillerplayer(Player).state.next
|
||||
msg.getkillerplayer(Player).state.apply(msg.getkillerplayer(Player).actor)
|
||||
msg.getkillerplayer(Player).state = msg.getkillerplayer(
|
||||
Player).state.next
|
||||
msg.getkillerplayer(Player).state.apply(
|
||||
msg.getkillerplayer(Player).actor)
|
||||
else:
|
||||
msg.getkillerplayer(Player).team.score += 1
|
||||
self.end_game()
|
||||
|
|
|
|||
54
dist/ba_root/mods/games/big_ball.py
vendored
54
dist/ba_root/mods/games/big_ball.py
vendored
|
|
@ -4,16 +4,15 @@
|
|||
|
||||
# ba_meta require api 8
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.flag import Flag
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Dict, Type, List, Optional, Union
|
||||
|
||||
|
|
@ -24,6 +23,7 @@ class PuckDiedMessage:
|
|||
def __init__(self, puck: Puck):
|
||||
self.puck = puck
|
||||
|
||||
|
||||
# goalpost
|
||||
|
||||
|
||||
|
|
@ -33,10 +33,12 @@ class FlagKale(bs.Actor):
|
|||
activity = self.getactivity()
|
||||
shared = SharedObjects.get()
|
||||
self.node = bs.newnode('flag',
|
||||
attrs={'position': (position[0], position[1]+0.75, position[2]),
|
||||
attrs={'position': (
|
||||
position[0], position[1] + 0.75, position[2]),
|
||||
'color_texture': activity._flagKaleTex,
|
||||
'color': color,
|
||||
'materials': [shared.object_material, activity._kaleMaterial],
|
||||
'materials': [shared.object_material,
|
||||
activity._kaleMaterial],
|
||||
},
|
||||
delegate=self)
|
||||
|
||||
|
|
@ -99,7 +101,8 @@ class Puck(bs.Actor):
|
|||
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,
|
||||
1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
|
||||
|
|
@ -113,6 +116,7 @@ class Puck(bs.Actor):
|
|||
else:
|
||||
super().handlemessage(msg)
|
||||
|
||||
|
||||
# for night mode: using a actor with large shadow and little mesh scale. Better then tint i think, players and objects more visible
|
||||
|
||||
|
||||
|
|
@ -220,19 +224,23 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._nightTex = bs.gettexture("black")
|
||||
self._kaleMaterial = bs.Material()
|
||||
# add friction to flags for standing our position (as far as)
|
||||
self._kaleMaterial.add_actions(conditions=("they_have_material", shared.footing_material),
|
||||
self._kaleMaterial.add_actions(
|
||||
conditions=("they_have_material", shared.footing_material),
|
||||
actions=(("modify_part_collision", "friction", 9999.5)))
|
||||
self._kaleMaterial.add_actions(conditions=(("we_are_younger_than", 1), 'and',
|
||||
self._kaleMaterial.add_actions(
|
||||
conditions=(("we_are_younger_than", 1), 'and',
|
||||
("they_have_material", shared.object_material)),
|
||||
actions=(("modify_part_collision", "collide", False)))
|
||||
self._kaleMaterial.add_actions(conditions=("they_have_material", shared.pickup_material),
|
||||
self._kaleMaterial.add_actions(
|
||||
conditions=("they_have_material", shared.pickup_material),
|
||||
actions=(("modify_part_collision", "collide", False)))
|
||||
self._kaleMaterial.add_actions(
|
||||
conditions=('they_have_material', shared.object_material),
|
||||
actions=(('impact_sound', self._kaleSound, 2, 5)))
|
||||
# we dont wanna hit the night so
|
||||
self._nightMaterial = bs.Material()
|
||||
self._nightMaterial.add_actions(conditions=(('they_have_material', shared.pickup_material), 'or',
|
||||
self._nightMaterial.add_actions(
|
||||
conditions=(('they_have_material', shared.pickup_material), 'or',
|
||||
('they_have_material', shared.attack_material)),
|
||||
actions=(('modify_part_collision', 'collide', False)))
|
||||
# we also dont want anything moving it
|
||||
|
|
@ -327,7 +335,8 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.NodeActor(
|
||||
bs.newnode('region',
|
||||
attrs={
|
||||
'position': (-13.55, 0.85744967453, 0.1095578275),
|
||||
'position': (
|
||||
-13.55, 0.85744967453, 0.1095578275),
|
||||
'scale': (1.05, 1.1, 3.8),
|
||||
'type': 'box',
|
||||
'materials': [self._score_region_material]
|
||||
|
|
@ -365,6 +374,7 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
attrs={'position': kale4,
|
||||
'radius': 0.15,
|
||||
'color': (0.7, 1.0, 1.0)})
|
||||
|
||||
# flags positions
|
||||
|
||||
def _flagKalesSpawn(self):
|
||||
|
|
@ -374,10 +384,14 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
if team.id == 1:
|
||||
_colorTeam1 = team.color
|
||||
|
||||
self._MythB = FlagKale(position=(-12.45, 0.05744967453, -2.075), color=_colorTeam0)
|
||||
self._MythB2 = FlagKale(position=(-12.45, 0.05744967453, 2.075), color=_colorTeam0)
|
||||
self._MythB3 = FlagKale(position=(12.66, 0.03986567039, 2.075), color=_colorTeam1)
|
||||
self._MythB4 = FlagKale(position=(12.66, 0.03986567039, -2.075), color=_colorTeam1)
|
||||
self._MythB = FlagKale(position=(-12.45, 0.05744967453, -2.075),
|
||||
color=_colorTeam0)
|
||||
self._MythB2 = FlagKale(position=(-12.45, 0.05744967453, 2.075),
|
||||
color=_colorTeam0)
|
||||
self._MythB3 = FlagKale(position=(12.66, 0.03986567039, 2.075),
|
||||
color=_colorTeam1)
|
||||
self._MythB4 = FlagKale(position=(12.66, 0.03986567039, -2.075),
|
||||
color=_colorTeam1)
|
||||
|
||||
def on_team_join(self, team: Team) -> None:
|
||||
self._update_scoreboard()
|
||||
|
|
@ -423,7 +437,8 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
if self._grant_power:
|
||||
for player in team.players:
|
||||
try:
|
||||
player.actor.node.handlemessage(bs.PowerupMessage('punch'))
|
||||
player.actor.node.handlemessage(
|
||||
bs.PowerupMessage('punch'))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
@ -448,7 +463,8 @@ class BBGame(bs.TeamGameActivity[Player, Team]):
|
|||
if self._grant_power:
|
||||
for player in team.players:
|
||||
try:
|
||||
player.actor.node.handlemessage(bs.PowerupMessage('shield'))
|
||||
player.actor.node.handlemessage(
|
||||
bs.PowerupMessage('shield'))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
|||
7
dist/ba_root/mods/games/boxing.py
vendored
7
dist/ba_root/mods/games/boxing.py
vendored
|
|
@ -6,15 +6,13 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.game.deathmatch import DeathMatchGame
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence
|
||||
|
||||
from typing import Sequence
|
||||
|
||||
lang = bs.app.lang.language
|
||||
|
||||
|
|
@ -85,6 +83,7 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
self.node.position[2],
|
||||
0, 0, 0, 95, 95, 0, 0, 0, 1, 0
|
||||
)
|
||||
|
||||
bs.timer(0.0, do_jump)
|
||||
bs.timer(0.1, do_jump)
|
||||
bs.timer(0.2, do_jump)
|
||||
|
|
@ -93,7 +92,6 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class BoxingGame(DeathMatchGame):
|
||||
|
||||
name = name
|
||||
description = description
|
||||
|
||||
|
|
@ -197,7 +195,6 @@ class BoxingGame(DeathMatchGame):
|
|||
import random
|
||||
from babase import _math
|
||||
from bascenev1._gameutils import animate
|
||||
from bascenev1._coopsession import CoopSession
|
||||
|
||||
if isinstance(self.session, bs.DualTeamSession):
|
||||
position = self.map.get_start_position(player.team.id)
|
||||
|
|
|
|||
12
dist/ba_root/mods/games/collector.py
vendored
12
dist/ba_root/mods/games/collector.py
vendored
|
|
@ -27,24 +27,23 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
import weakref
|
||||
from enum import Enum
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1lib.actor.flag import Flag
|
||||
from bascenev1lib.actor.popuptext import PopupText
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.popuptext import PopupText
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
lang = bs.app.lang.language
|
||||
if lang == 'Spanish':
|
||||
name = 'Coleccionista'
|
||||
|
|
@ -119,7 +118,6 @@ class Team(bs.Team[Player]):
|
|||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class CollectorGame(bs.TeamGameActivity[Player, Team]):
|
||||
|
||||
name = name
|
||||
description = description
|
||||
tips = tips
|
||||
|
|
@ -510,6 +508,7 @@ class CollectorGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
def newintensity():
|
||||
player.light.intensity = intensity
|
||||
|
||||
bs.timer(0.1, newintensity)
|
||||
else:
|
||||
player.light = bs.newnode(
|
||||
|
|
@ -629,7 +628,8 @@ class Capsule(bs.Actor):
|
|||
'impulse',
|
||||
msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
msg.velocity[0] / 8, msg.velocity[1] / 8, msg.velocity[2] / 8,
|
||||
1.0*msg.magnitude, 1.0*msg.velocity_magnitude, msg.radius, 0,
|
||||
1.0 * msg.magnitude, 1.0 * msg.velocity_magnitude, msg.radius,
|
||||
0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
else:
|
||||
|
|
|
|||
31
dist/ba_root/mods/games/demolition_war.py
vendored
31
dist/ba_root/mods/games/demolition_war.py
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# ba_meta require api 8
|
||||
"""
|
||||
DemolitionWar - BombFight on wooden floor flying in air.
|
||||
|
|
@ -10,19 +9,20 @@ Github: https://github.com/bombsquad-community
|
|||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1 import _map
|
||||
from bascenev1lib.actor.bomb import BombFactory
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.game.elimination import EliminationGame, Player
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.bomb import BombFactory
|
||||
import random
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence
|
||||
from typing import Any
|
||||
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
|
@ -161,8 +161,12 @@ class DemolitionWar(EliminationGame):
|
|||
('modify_part_collision', 'collide', False))
|
||||
)
|
||||
pos = (x, 0, z)
|
||||
ud_1_r = bs.newnode('region', attrs={'position': pos, 'scale': (1.5, 1, 1.5), 'type': 'box', 'materials': [
|
||||
shared.footing_material, self._real_collied_material, self.ramp_bomb]})
|
||||
ud_1_r = bs.newnode('region',
|
||||
attrs={'position': pos, 'scale': (1.5, 1, 1.5),
|
||||
'type': 'box', 'materials': [
|
||||
shared.footing_material,
|
||||
self._real_collied_material,
|
||||
self.ramp_bomb]})
|
||||
|
||||
node = bs.newnode('prop',
|
||||
owner=ud_1_r,
|
||||
|
|
@ -176,7 +180,8 @@ class DemolitionWar(EliminationGame):
|
|||
'color_texture': bs.gettexture('tnt'),
|
||||
'mesh_scale': 1.5,
|
||||
'reflection_scale': [1.5],
|
||||
'materials': [self.mat, shared.object_material, shared.footing_material],
|
||||
'materials': [self.mat, shared.object_material,
|
||||
shared.footing_material],
|
||||
'density': 9000000000
|
||||
})
|
||||
# node.changerotation(1, 0, 0)
|
||||
|
|
@ -221,7 +226,8 @@ class mapdefs:
|
|||
points['tnt1'] = (-0.08421587483, 0.9515026107, -0.7762602271)
|
||||
|
||||
|
||||
class WoodenFloor(bs._map.Map): # ahdunno if this is correct way, change if u find better way
|
||||
class WoodenFloor(
|
||||
bs._map.Map): # ahdunno if this is correct way, change if u find better way
|
||||
"""Stadium map for football games."""
|
||||
defs = mapdefs
|
||||
defs.points['spawn1'] = (-12.03866341, 0.02275111462, 0.0) + (0.5, 1.0, 4.0)
|
||||
|
|
@ -272,7 +278,8 @@ class WoodenFloor(bs._map.Map): # ahdunno if this is correct way, change if u f
|
|||
'lighting': False,
|
||||
'vr_only': True,
|
||||
'background': True,
|
||||
'color_texture': self.preloaddata['mesh_bg_tex']
|
||||
'color_texture': self.preloaddata[
|
||||
'mesh_bg_tex']
|
||||
})
|
||||
gnode = bs.getactivity().globalsnode
|
||||
gnode.tint = (1.3, 1.2, 1.0)
|
||||
|
|
|
|||
36
dist/ba_root/mods/games/dodge_the_ball.py
vendored
36
dist/ba_root/mods/games/dodge_the_ball.py
vendored
|
|
@ -8,17 +8,18 @@
|
|||
|
||||
# ba_meta require api 8
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from random import choice
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from random import choice
|
||||
from enum import Enum
|
||||
from bascenev1lib.actor.bomb import Blast
|
||||
from bascenev1lib.actor.onscreencountdown import OnScreenCountdown
|
||||
from bascenev1lib.actor.popuptext import PopupText
|
||||
from bascenev1lib.actor.powerupbox import PowerupBox
|
||||
from bascenev1lib.actor.onscreencountdown import OnScreenCountdown
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -91,7 +92,8 @@ class Ball(bs.Actor):
|
|||
'mesh_scale': body_scale,
|
||||
'color_texture': texture,
|
||||
'gravity_scale': gravity_scale,
|
||||
'density': 4.0, # increase density of ball so ball collide with player with heavy force. # ammm very bad grammer
|
||||
'density': 4.0,
|
||||
# increase density of ball so ball collide with player with heavy force. # ammm very bad grammer
|
||||
'materials': (ball_material,),
|
||||
},
|
||||
)
|
||||
|
|
@ -242,7 +244,8 @@ class Box(bs.Actor):
|
|||
# to finding difference between player and box.
|
||||
# we just need to subtract player pos and ball pos.
|
||||
# Same logic as eric applied in Target Practice Gamemode.
|
||||
difference = babase.Vec3(target_player.position) - babase.Vec3(self.node.position)
|
||||
difference = babase.Vec3(target_player.position) - babase.Vec3(
|
||||
self.node.position)
|
||||
|
||||
# discard Y position so ball shoot more straight.
|
||||
difference[1] = 0.0
|
||||
|
|
@ -298,9 +301,11 @@ class Box(bs.Actor):
|
|||
0.000, # magnetude velocity
|
||||
0.000, # radius
|
||||
0.000, # idk
|
||||
difference[0] + self.player_facing_direction[0], # force direction X
|
||||
difference[0] + self.player_facing_direction[0],
|
||||
# force direction X
|
||||
difference[1], # force direction Y
|
||||
difference[2] + self.player_facing_direction[1], # force direction Z
|
||||
difference[2] + self.player_facing_direction[1],
|
||||
# force direction Z
|
||||
)
|
||||
# creating our timer and shoot the ball again.(and we create a loop)
|
||||
self.shoot_timer = bs.Timer(self.shoot_speed, self.start_shoot)
|
||||
|
|
@ -412,7 +417,8 @@ class Box(bs.Actor):
|
|||
bs.timer(self.shoot_speed, light.delete)
|
||||
bs.timer(self.shoot_speed, circle_outline.delete)
|
||||
|
||||
def calculate_player_analog_stick(self, player: bs.Player, distance: float) -> NoReturn:
|
||||
def calculate_player_analog_stick(self, player: bs.Player,
|
||||
distance: float) -> NoReturn:
|
||||
# at first i was very confused how i can read the player analog stick \
|
||||
# then i saw TheMikirog#1984 autorun plugin code.
|
||||
# and i got it how analog stick values are works.
|
||||
|
|
@ -424,8 +430,10 @@ class Box(bs.Actor):
|
|||
# if player is too close and the player pushing his analog stick fully the ball shoot's too far away to player.
|
||||
# so, we need to reduce the value of "self.player_facing_direction" to fix this problem.
|
||||
if distance <= 3:
|
||||
self.player_facing_direction[0] = 0.4 if self.player_facing_direction[0] > 0 else -0.4
|
||||
self.player_facing_direction[1] = 0.4 if self.player_facing_direction[0] > 0 else -0.4
|
||||
self.player_facing_direction[0] = 0.4 if \
|
||||
self.player_facing_direction[0] > 0 else -0.4
|
||||
self.player_facing_direction[1] = 0.4 if \
|
||||
self.player_facing_direction[0] > 0 else -0.4
|
||||
# same problem to long distance but in reverse, the ball can't reach to the player,
|
||||
# its because player analog stick value is between 1 and -1,
|
||||
# and this value is low to shoot ball forward to Player if player is too far from the box.
|
||||
|
|
@ -471,6 +479,7 @@ class Player(bs.Player['Team']):
|
|||
class Team(bs.Team[Player]):
|
||||
"""Our team type for this game."""
|
||||
|
||||
|
||||
# almost 80 % for game we done in box class.
|
||||
# now remain things, like name, seetings, scoring, cooldonw,
|
||||
# and main thing don't allow player to camp inside of box are going in this class.
|
||||
|
|
@ -479,7 +488,6 @@ class Team(bs.Team[Player]):
|
|||
|
||||
|
||||
class DodgeTheBall(bs.TeamGameActivity[Player, Team]):
|
||||
|
||||
# defining name, description and settings..
|
||||
name = 'Dodge the ball'
|
||||
description = 'Survive from shooting balls'
|
||||
|
|
@ -586,7 +594,8 @@ class DodgeTheBall(bs.TeamGameActivity[Player, Team]):
|
|||
for player in self.get_alive_players():
|
||||
|
||||
# same logic as applied for the ball
|
||||
difference = babase.Vec3(player.position) - babase.Vec3(self.box.node.position)
|
||||
difference = babase.Vec3(player.position) - babase.Vec3(
|
||||
self.box.node.position)
|
||||
|
||||
distance = difference.length()
|
||||
|
||||
|
|
@ -686,7 +695,6 @@ class DodgeTheBall(bs.TeamGameActivity[Player, Team]):
|
|||
def handlemessage(self, msg: Any) -> Any:
|
||||
|
||||
if isinstance(msg, bs.PlayerDiedMessage):
|
||||
|
||||
# Augment standard behavior.
|
||||
super().handlemessage(msg)
|
||||
|
||||
|
|
|
|||
2
dist/ba_root/mods/games/frozen_one.py
vendored
2
dist/ba_root/mods/games/frozen_one.py
vendored
|
|
@ -1,8 +1,6 @@
|
|||
# Ported by your friend: Freaku
|
||||
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.game.chosenone import Player, ChosenOneGame
|
||||
|
||||
|
||||
|
|
|
|||
7
dist/ba_root/mods/games/handball.py
vendored
7
dist/ba_root/mods/games/handball.py
vendored
|
|
@ -9,12 +9,10 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -77,7 +75,8 @@ class Puck(bs.Actor):
|
|||
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,
|
||||
1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
|
||||
|
|
|
|||
102
dist/ba_root/mods/games/hot_bomb.py
vendored
102
dist/ba_root/mods/games/hot_bomb.py
vendored
|
|
@ -7,23 +7,20 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import random
|
||||
|
||||
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 _babase
|
||||
import _bascenev1 as _bs
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import bascenev1 as bs
|
||||
import _bascenev1 as _bs
|
||||
import _babase
|
||||
|
||||
from bascenev1._messages import StandMessage
|
||||
from bascenev1lib.actor.bomb import Bomb
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.spaz import PickupMessage, BombDiedMessage
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Dict, Type, List, Optional, Union
|
||||
|
|
@ -43,7 +40,8 @@ class ExplodeHitMessage:
|
|||
class Ball(bs.Actor):
|
||||
"""A lovely bomb mortal"""
|
||||
|
||||
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0), timer: int = 5, d_time=0.2, color=(1, 1, 1)):
|
||||
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
timer: int = 5, d_time=0.2, color=(1, 1, 1)):
|
||||
super().__init__()
|
||||
shared = SharedObjects.get()
|
||||
activity = self.getactivity()
|
||||
|
|
@ -100,8 +98,10 @@ class Ball(bs.Actor):
|
|||
self.node.connectattr('position', self.light, 'position')
|
||||
self.animate_light = None
|
||||
|
||||
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)
|
||||
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)
|
||||
|
||||
self.d_time = d_time
|
||||
|
||||
|
|
@ -194,7 +194,8 @@ class Ball(bs.Actor):
|
|||
'region',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'position': (self.node.position[0], self.node.position[1] - 0.1, self.node.position[2]),
|
||||
'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
|
||||
|
|
@ -286,7 +287,8 @@ class Ball(bs.Actor):
|
|||
and msg.node.getdelegate(PlayerSpaz).hitpoints > 0):
|
||||
spaz = msg.node.getdelegate(PlayerSpaz)
|
||||
spaz.node.color = (spaz.node.color[0] - 0.1,
|
||||
spaz.node.color[1]-0.1, spaz.node.color[2]-0.1)
|
||||
spaz.node.color[1] - 0.1,
|
||||
spaz.node.color[2] - 0.1)
|
||||
if spaz.node.hold_node != self.node:
|
||||
self.handlemessage(bs.DroppedMessage(spaz.node))
|
||||
if spaz.hitpoints > 10000:
|
||||
|
|
@ -294,7 +296,8 @@ class Ball(bs.Actor):
|
|||
spaz.hitpoints -= 10000
|
||||
spaz._last_hit_time = None
|
||||
spaz._num_time_shit = 0
|
||||
spaz.node.hurt = 1.0 - float(spaz.hitpoints) / spaz.hitpoints_max
|
||||
spaz.node.hurt = 1.0 - float(
|
||||
spaz.hitpoints) / spaz.hitpoints_max
|
||||
else:
|
||||
spaz.handlemessage(bs.DieMessage())
|
||||
bs.emitfx(
|
||||
|
|
@ -319,7 +322,8 @@ class Ball(bs.Actor):
|
|||
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,
|
||||
1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
|
||||
|
|
@ -352,14 +356,15 @@ class Ball(bs.Actor):
|
|||
else:
|
||||
super().handlemessage(msg)
|
||||
|
||||
|
||||
### HUMAN###
|
||||
|
||||
|
||||
class NewPlayerSpaz(PlayerSpaz):
|
||||
|
||||
move_mult = 1.0
|
||||
reload = True
|
||||
extra_jump = True
|
||||
|
||||
# calls
|
||||
|
||||
def impulse(self):
|
||||
|
|
@ -443,7 +448,8 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
except bs.NotFoundError:
|
||||
return True
|
||||
if opposingnode.getnodetype() == 'spaz':
|
||||
player = opposingnode.getdelegate(PlayerSpaz, True).getplayer(Player, True)
|
||||
player = opposingnode.getdelegate(PlayerSpaz, True).getplayer(
|
||||
Player, True)
|
||||
if player.actor.shield:
|
||||
return None
|
||||
super().handlemessage(msg)
|
||||
|
|
@ -479,7 +485,8 @@ if lang == 'Spanish':
|
|||
difficulty = 'Dificultad'
|
||||
difficulty_o = ['Fácil', 'Difícil', 'Chernobyl']
|
||||
wall_color = 'Color de la Red'
|
||||
w_c = ['Verde', 'Rojo', 'Naranja', 'Amarillo', 'Celeste', 'Azul', 'Rosa', 'Gris']
|
||||
w_c = ['Verde', 'Rojo', 'Naranja', 'Amarillo', 'Celeste', 'Azul', 'Rosa',
|
||||
'Gris']
|
||||
ball_body = 'Tipo de Hot Bomb'
|
||||
body = ['Esfera', 'Cubo']
|
||||
|
||||
|
|
@ -499,7 +506,8 @@ else:
|
|||
difficulty = 'Difficulty'
|
||||
difficulty_o = ['Easy', 'Hard', 'Chernobyl']
|
||||
wall_color = 'Mesh Color'
|
||||
w_c = ['Green', 'Red', 'Orange', 'Yellow', 'Light blue', 'Blue', 'Ping', 'Gray']
|
||||
w_c = ['Green', 'Red', 'Orange', 'Yellow', 'Light blue', 'Blue', 'Ping',
|
||||
'Gray']
|
||||
ball_body = 'Type of Hot Bomb'
|
||||
body = ['Sphere', 'Box']
|
||||
|
||||
|
|
@ -622,8 +630,10 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._ball_sound = bs.getsound('splatter')
|
||||
|
||||
self.last_point = None
|
||||
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)]
|
||||
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)]
|
||||
#
|
||||
self.slow_motion = self._epic_mode
|
||||
|
||||
|
|
@ -804,11 +814,13 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
while g < self._num_bones:
|
||||
b = 0
|
||||
Torso(
|
||||
position=(-6+random.random()*12, 3.5, -5+random.random()*10)
|
||||
position=(
|
||||
-6 + random.random() * 12, 3.5, -5 + random.random() * 10)
|
||||
)
|
||||
while b < 6:
|
||||
Bone(
|
||||
position=(-6+random.random()*12, 2, -5+random.random()*10),
|
||||
position=(
|
||||
-6 + random.random() * 12, 2, -5 + random.random() * 10),
|
||||
style=b
|
||||
)
|
||||
b += 1
|
||||
|
|
@ -832,20 +844,24 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
'locator',
|
||||
attrs={
|
||||
'shape': 'box',
|
||||
'position': (0, -13.51, 0.5) if self._space_under_wall else (0, -35.540, 0.5),
|
||||
'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]
|
||||
'size': [0.3, 30, 13] if self._space_under_wall else [0.3, 75,
|
||||
13]
|
||||
}
|
||||
)
|
||||
wall = bs.newnode(
|
||||
'region',
|
||||
attrs={
|
||||
'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),
|
||||
'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),
|
||||
'type': 'box',
|
||||
'materials': (self._wall_material, self._reaction_material)
|
||||
}
|
||||
|
|
@ -858,7 +874,8 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
'position': pos,
|
||||
'scale': (0.001, 15, 12),
|
||||
'type': 'box',
|
||||
'materials': [self._check_region_material, self._reaction_material]
|
||||
'materials': [self._check_region_material,
|
||||
self._reaction_material]
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -986,7 +1003,9 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
collision = bs.getcollision()
|
||||
try:
|
||||
ball = collision.sourcenode.getdelegate(Ball, True)
|
||||
player = collision.opposingnode.getdelegate(PlayerSpaz, True).getplayer(Player, True)
|
||||
player = collision.opposingnode.getdelegate(PlayerSpaz,
|
||||
True).getplayer(Player,
|
||||
True)
|
||||
except bs.NotFoundError:
|
||||
return
|
||||
|
||||
|
|
@ -1038,7 +1057,8 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._ball._counter.color = (0, 0, 5)
|
||||
else:
|
||||
self._ball.node.color_texture = bs.gettexture('powerupPunch')
|
||||
bs.animate_array(gnode, 'vignette_outer', 3, {1.0: (0.6, 0.45, 0.45)})
|
||||
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)
|
||||
|
||||
|
|
@ -1158,7 +1178,8 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
texture = 'powerupPunch' if pos[0] == -5 else 'powerupIceBombs'
|
||||
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)
|
||||
self._ball = Ball(position=pos, timer=timer, d_time=self.damage_time,
|
||||
color=color)
|
||||
self._ball.node.color_texture = bs.gettexture(texture)
|
||||
self._ball._counter.color = counter_color
|
||||
|
||||
|
|
@ -1220,6 +1241,7 @@ class HotBombGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
return super().spawn_player_spaz(player, position, angle)
|
||||
|
||||
|
||||
##### New-Bomb#####
|
||||
|
||||
|
||||
|
|
@ -1386,6 +1408,7 @@ class NewBomb(bs.Actor):
|
|||
if self.node:
|
||||
self.node.delete()
|
||||
|
||||
|
||||
###### Object#####
|
||||
|
||||
|
||||
|
|
@ -1500,7 +1523,8 @@ class HealthBox(bs.Actor):
|
|||
'reflection': 'powerup',
|
||||
'reflection_scale': [0.5],
|
||||
'shadow_size': 0.0,
|
||||
'materials': (shared.object_material, self.healthbox_material, factory.health_material)})
|
||||
'materials': (shared.object_material, self.healthbox_material,
|
||||
factory.health_material)})
|
||||
|
||||
self.light = bs.newnode('light', owner=self.node, attrs={
|
||||
'color': (1, 1, 1),
|
||||
|
|
@ -1526,7 +1550,8 @@ class HealthBox(bs.Actor):
|
|||
elif isinstance(msg, bs.HitMessage):
|
||||
try:
|
||||
spaz = msg._source_player
|
||||
spaz.actor.node.handlemessage(bs.PowerupMessage(poweruptype='health'))
|
||||
spaz.actor.node.handlemessage(
|
||||
bs.PowerupMessage(poweruptype='health'))
|
||||
t_color = spaz.team.color
|
||||
spaz.actor.node.color = t_color
|
||||
bs.getsound('healthPowerup').play(volume=0.5)
|
||||
|
|
@ -1629,6 +1654,7 @@ class Bone(bs.Actor):
|
|||
if self.node:
|
||||
self.node.delete()
|
||||
|
||||
|
||||
###### Object#####
|
||||
|
||||
|
||||
|
|
|
|||
14
dist/ba_root/mods/games/icy_emits.py
vendored
14
dist/ba_root/mods/games/icy_emits.py
vendored
|
|
@ -1,11 +1,12 @@
|
|||
# Made by your friend: Freaku
|
||||
|
||||
|
||||
import random
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1lib.actor.bomb import Bomb
|
||||
from bascenev1lib.game.meteorshower import Player, MeteorShowerGame
|
||||
from bascenev1lib.game.meteorshower import MeteorShowerGame
|
||||
|
||||
|
||||
# ba_meta require api 8
|
||||
|
|
@ -35,8 +36,10 @@ class IcyEmitsGame(MeteorShowerGame):
|
|||
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()
|
||||
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
|
||||
|
|
@ -45,4 +48,5 @@ class byFreaku(babase.Plugin):
|
|||
## 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)))
|
||||
name='Icy Emits', displayname='${GAME}', gametype=IcyEmitsGame,
|
||||
settings={}, preview_texture_name=random.choice(randomPic)))
|
||||
|
|
|
|||
436
dist/ba_root/mods/games/memory_game.py
vendored
436
dist/ba_root/mods/games/memory_game.py
vendored
|
|
@ -1,30 +1,25 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
# ba_meta require api 8
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
## Original creator: byANG3L ##
|
||||
## Made by: Freaku ##
|
||||
|
||||
## From: BSWorld Modpack (https://youtu.be/1TN56NLlShE) ##
|
||||
|
||||
|
||||
# Used in-game boxes and textures instead of external
|
||||
# So it will run on server and randoms can play init ._.
|
||||
# (& some improvements)
|
||||
|
||||
|
||||
# incase someone is wondering how is map floating. Check out
|
||||
# def spawnAllMap(self)
|
||||
|
||||
|
||||
# ba_meta require api 8
|
||||
from typing import TYPE_CHECKING, overload
|
||||
import _babase
|
||||
import babase
|
||||
import random
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, List, Dict, Type, Union, Any, Literal
|
||||
from typing import Any, Optional, List, Dict, Type, Any
|
||||
|
||||
|
||||
class OnTimer(bs.Actor):
|
||||
|
|
@ -33,8 +28,12 @@ class OnTimer(bs.Actor):
|
|||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self._starttime_ms: int | None = None
|
||||
self.node = bs.newnode('text', attrs={'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (
|
||||
1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
|
||||
self.node = bs.newnode('text',
|
||||
attrs={'v_attach': 'top', 'h_attach': 'center',
|
||||
'h_align': 'center', 'color': (
|
||||
1, 1, 0.5, 1), 'flatness': 0.5,
|
||||
'shadow': 0.5, 'position': (0, -70),
|
||||
'scale': 0, 'text': ''})
|
||||
self.inputnode = bs.newnode(
|
||||
'timedisplay', attrs={'timemin': 0, 'showsubseconds': True}
|
||||
)
|
||||
|
|
@ -112,12 +111,14 @@ class Team(bs.Team[Player]):
|
|||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class MGgame(bs.TeamGameActivity[Player, Team]):
|
||||
|
||||
name = 'Memory Game'
|
||||
description = 'Memories tiles and survive till the end!'
|
||||
available_settings = [bs.BoolSetting(
|
||||
'Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)]
|
||||
scoreconfig = bs.ScoreConfig(label='Survived', scoretype=bs.ScoreType.MILLISECONDS, version='B')
|
||||
'Epic Mode', default=False),
|
||||
bs.BoolSetting('Enable Bottom Credits', True)]
|
||||
scoreconfig = bs.ScoreConfig(label='Survived',
|
||||
scoretype=bs.ScoreType.MILLISECONDS,
|
||||
version='B')
|
||||
|
||||
# Print messages when players die (since its meaningful in this game).
|
||||
announce_player_deaths = True
|
||||
|
|
@ -149,9 +150,11 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
self.slow_motion = True
|
||||
shared = SharedObjects.get()
|
||||
self._collide_with_player = bs.Material()
|
||||
self._collide_with_player.add_actions(actions=(('modify_part_collision', 'collide', True)))
|
||||
self._collide_with_player.add_actions(
|
||||
actions=(('modify_part_collision', 'collide', True)))
|
||||
self.dont_collide = bs.Material()
|
||||
self.dont_collide.add_actions(actions=(('modify_part_collision', 'collide', False)))
|
||||
self.dont_collide.add_actions(
|
||||
actions=(('modify_part_collision', 'collide', False)))
|
||||
self._levelStage = 0
|
||||
|
||||
self.announcePlayerDeaths = True
|
||||
|
|
@ -210,7 +213,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
'v_align': 'center'})
|
||||
|
||||
self._textLevel = bs.newnode('text',
|
||||
attrs={'text': 'Level ' + str(self._levelStage),
|
||||
attrs={'text': 'Level ' + str(
|
||||
self._levelStage),
|
||||
'position': (0, -28),
|
||||
'scale': 1.3,
|
||||
'shadow': 1.0,
|
||||
|
|
@ -295,7 +299,9 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
self.coldel16 = True
|
||||
if self.credit_text:
|
||||
t = bs.newnode('text',
|
||||
attrs={'text': "Made by Freaku\nOriginally for 1.4: byANG3L", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
|
||||
attrs={
|
||||
'text': "Made by Freaku\nOriginally for 1.4: byANG3L",
|
||||
# Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
|
||||
'scale': 0.7,
|
||||
'position': (0, 0),
|
||||
'shadow': 0.5,
|
||||
|
|
@ -327,33 +333,43 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
self._textCounter.text = ''
|
||||
self._tickFinal.play()
|
||||
self._stop()
|
||||
|
||||
self._textCounter.text = '1'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, countFinal)
|
||||
|
||||
self._textCounter.text = '2'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count1)
|
||||
|
||||
self._textCounter.text = '3'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count2)
|
||||
|
||||
self._textCounter.text = '4'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count3)
|
||||
|
||||
self._textCounter.text = '5'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count4)
|
||||
|
||||
self._textCounter.text = '6'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count5)
|
||||
|
||||
self._textCounter.text = '7'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count6)
|
||||
|
||||
self._textCounter.text = '8'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count7)
|
||||
|
||||
self._textCounter.text = '9'
|
||||
self._tickSound.play()
|
||||
bs.timer(1, count8)
|
||||
|
||||
bs.timer(1, count9)
|
||||
|
||||
def on_player_join(self, player: Player) -> None:
|
||||
|
|
@ -363,7 +379,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.broadcastmessage(
|
||||
babase.Lstr(resource='playerDelayedJoinText',
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
color=(0, 1, 0), transient=True, clients=[player.sessionplayer.inputdevice.client_id])
|
||||
color=(0, 1, 0), transient=True,
|
||||
clients=[player.sessionplayer.inputdevice.client_id])
|
||||
# For score purposes, mark them as having died right as the
|
||||
# game started.
|
||||
assert self._timer is not None
|
||||
|
|
@ -382,8 +399,10 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
def spawn_player(self, player: Player) -> bs.Actor:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5),
|
||||
self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5))
|
||||
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False)
|
||||
self._spawnCenter[1],
|
||||
self._spawnCenter[2] + random.uniform(-2.5, 1.5))
|
||||
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False,
|
||||
enable_pickup=False)
|
||||
spaz.handlemessage(bs.StandMessage(pos))
|
||||
return spaz
|
||||
|
||||
|
|
@ -441,14 +460,17 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
self._imageCircle3.opacity = 1.0
|
||||
self._bellHigh.play()
|
||||
bs.timer(0.2, self._doDelete)
|
||||
|
||||
self._imageCircle2.color = (1.0, 1.0, 0.0)
|
||||
self._imageCircle2.opacity = 1.0
|
||||
self._bellMed.play()
|
||||
bs.timer(1, circle3)
|
||||
|
||||
self._imageCircle.color = (1.0, 0.0, 0.0)
|
||||
self._imageCircle.opacity = 1.0
|
||||
self._bellLow.play()
|
||||
bs.timer(1, circle2)
|
||||
|
||||
bs.timer(1, circle)
|
||||
|
||||
def _randomPlatform(self):
|
||||
|
|
@ -683,130 +705,386 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
|
|||
shared = SharedObjects.get()
|
||||
if self.coldel:
|
||||
self.mapFGP = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (4.5, 2, -9),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGPTex = None
|
||||
self.mapFGPcol = bs.newnode('region', attrs={'position': (4.5, 2, -9), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGPcol = bs.newnode('region',
|
||||
attrs={'position': (4.5, 2, -9),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel = False
|
||||
|
||||
if self.coldel2:
|
||||
self.mapFGP2 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (4.5, 2, -6),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP2Tex = None
|
||||
self.mapFGP2col = bs.newnode('region', attrs={'position': (4.5, 2, -6), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP2col = bs.newnode('region',
|
||||
attrs={'position': (4.5, 2, -6),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel2 = False
|
||||
|
||||
if self.coldel3:
|
||||
self.mapFGP3 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (4.5, 2, -3),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP3Tex = None
|
||||
self.mapFGP3col = bs.newnode('region', attrs={'position': (4.5, 2, -3), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP3col = bs.newnode('region',
|
||||
attrs={'position': (4.5, 2, -3),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel3 = False
|
||||
|
||||
if self.coldel4:
|
||||
self.mapFGP4 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (4.5, 2, 0),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP4Tex = None
|
||||
self.mapFGP4col = bs.newnode('region', attrs={'position': (4.5, 2, 0), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP4col = bs.newnode('region',
|
||||
attrs={'position': (4.5, 2, 0),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel4 = False
|
||||
|
||||
if self.coldel5:
|
||||
self.mapFGP5 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (1.5, 2, -9),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP5Tex = None
|
||||
self.mapFGP5col = bs.newnode('region', attrs={'position': (1.5, 2, -9), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP5col = bs.newnode('region',
|
||||
attrs={'position': (1.5, 2, -9),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel5 = False
|
||||
|
||||
if self.coldel6:
|
||||
self.mapFGP6 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (1.5, 2, -6),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP6Tex = None
|
||||
self.mapFGP6col = bs.newnode('region', attrs={'position': (1.5, 2, -6), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP6col = bs.newnode('region',
|
||||
attrs={'position': (1.5, 2, -6),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel6 = False
|
||||
|
||||
if self.coldel7:
|
||||
self.mapFGP7 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (1.5, 2, -3),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP7Tex = None
|
||||
self.mapFGP7col = bs.newnode('region', attrs={'position': (1.5, 2, -3), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP7col = bs.newnode('region',
|
||||
attrs={'position': (1.5, 2, -3),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel7 = False
|
||||
|
||||
if self.coldel8:
|
||||
self.mapFGP8 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (1.5, 2, 0),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP8Tex = None
|
||||
self.mapFGP8col = bs.newnode('region', attrs={'position': (1.5, 2, 0), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP8col = bs.newnode('region',
|
||||
attrs={'position': (1.5, 2, 0),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel8 = False
|
||||
|
||||
if self.coldel9:
|
||||
self.mapFGP9 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-1.5, 2, -9),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP9Tex = None
|
||||
self.mapFGP9col = bs.newnode('region', attrs={'position': (-1.5, 2, -9), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP9col = bs.newnode('region',
|
||||
attrs={'position': (-1.5, 2, -9),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel9 = False
|
||||
|
||||
if self.coldel10:
|
||||
self.mapFGP10 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-1.5, 2, -6),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP10Tex = None
|
||||
self.mapFGP10col = bs.newnode('region', attrs={'position': (-1.5, 2, -6), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP10col = bs.newnode('region',
|
||||
attrs={'position': (-1.5, 2, -6),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel10 = False
|
||||
|
||||
if self.coldel11:
|
||||
self.mapFGP11 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-1.5, 2, -3),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP11Tex = None
|
||||
self.mapFGP11col = bs.newnode('region', attrs={'position': (-1.5, 2, -3), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP11col = bs.newnode('region',
|
||||
attrs={'position': (-1.5, 2, -3),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel11 = False
|
||||
|
||||
if self.coldel12:
|
||||
self.mapFGP12 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-1.5, 2, 0),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP12Tex = None
|
||||
self.mapFGP12col = bs.newnode('region', attrs={'position': (-1.5, 2, 0), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP12col = bs.newnode('region',
|
||||
attrs={'position': (-1.5, 2, 0),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel12 = False
|
||||
|
||||
if self.coldel13:
|
||||
self.mapFGP13 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-4.5, 2, -9),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP13Tex = None
|
||||
self.mapFGP13col = bs.newnode('region', attrs={'position': (-4.5, 2, -9), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP13col = bs.newnode('region',
|
||||
attrs={'position': (-4.5, 2, -9),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel13 = False
|
||||
|
||||
if self.coldel14:
|
||||
self.mapFGP14 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-4.5, 2, -6),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP14Tex = None
|
||||
self.mapFGP14col = bs.newnode('region', attrs={'position': (-4.5, 2, -6), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP14col = bs.newnode('region',
|
||||
attrs={'position': (-4.5, 2, -6),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel14 = False
|
||||
|
||||
if self.coldel15:
|
||||
self.mapFGP15 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-4.5, 2, -3),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP15Tex = None
|
||||
self.mapFGP15col = bs.newnode('region', attrs={'position': (-4.5, 2, -3), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP15col = bs.newnode('region',
|
||||
attrs={'position': (-4.5, 2, -3),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel15 = False
|
||||
|
||||
if self.coldel16:
|
||||
self.mapFGP16 = bs.newnode('prop',
|
||||
attrs={'body': 'puck', 'position': (-4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
|
||||
attrs={'body': 'puck',
|
||||
'position': (-4.5, 2, 0),
|
||||
'mesh': self._mapFGPModel,
|
||||
'mesh_scale': 3.73,
|
||||
'body_scale': 3.73,
|
||||
'shadow_size': 0.5,
|
||||
'gravity_scale': 0.0,
|
||||
'color_texture': self._mapFGPDefaultTex,
|
||||
'reflection': 'soft',
|
||||
'reflection_scale': [1.0],
|
||||
'is_area_of_interest': True,
|
||||
'materials': [self.dont_collide]})
|
||||
self.mapFGP16Tex = None
|
||||
self.mapFGP16col = bs.newnode('region', attrs={'position': (-4.5, 2, 0), 'scale': (
|
||||
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
|
||||
self.mapFGP16col = bs.newnode('region',
|
||||
attrs={'position': (-4.5, 2, 0),
|
||||
'scale': (
|
||||
3.5, 0.1, 3.5),
|
||||
'type': 'box', 'materials': (
|
||||
self._collide_with_player,
|
||||
shared.footing_material)})
|
||||
self.coldel16 = False
|
||||
|
||||
def _platformTexDefault(self):
|
||||
|
|
@ -946,9 +1224,12 @@ class MGdefs():
|
|||
points = {}
|
||||
boxes = {}
|
||||
boxes['area_of_interest_bounds'] = (
|
||||
0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888)
|
||||
0.3544110667, 4.493562578,
|
||||
-2.518391331) + (0.0, 0.0, 0.0) + (
|
||||
16.64754831, 8.06138989, 18.5029888)
|
||||
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + \
|
||||
(0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
|
||||
(0.0, 0.0, 0.0) + (
|
||||
29.23565494, 14.19991443, 29.92689344)
|
||||
|
||||
|
||||
class MGmap(bs.Map):
|
||||
|
|
@ -1000,4 +1281,5 @@ class byFreaku(babase.Plugin):
|
|||
def __init__(self):
|
||||
## Campaign support ##
|
||||
babase.app.classic.add_coop_practice_level(bs.Level(
|
||||
name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo'))
|
||||
name='Memory Game', displayname='${GAME}', gametype=MGgame,
|
||||
settings={}, preview_texture_name='achievementOffYouGo'))
|
||||
|
|
|
|||
63
dist/ba_root/mods/games/musical_flags.py
vendored
63
dist/ba_root/mods/games/musical_flags.py
vendored
|
|
@ -9,15 +9,18 @@
|
|||
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
import _babase
|
||||
import random
|
||||
|
||||
import math
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.flag import Flag, FlagPickedUpMessage
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
from typing import Any, Type, List, Union, Sequence
|
||||
|
||||
|
||||
class Player(bs.Player['Team']):
|
||||
|
|
@ -89,7 +92,14 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
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)})
|
||||
'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
|
||||
# A cool music, matching our gamemode theme
|
||||
|
|
@ -125,7 +135,9 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
self.spawned = []
|
||||
if self.credit_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,
|
||||
'position': (0, 0),
|
||||
'shadow': 0.5,
|
||||
|
|
@ -148,10 +160,14 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
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()))
|
||||
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)
|
||||
|
|
@ -189,8 +205,10 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
spacing = 360 // (c)
|
||||
except:
|
||||
self.checkEnd()
|
||||
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)]
|
||||
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)]
|
||||
|
||||
# Add support for more than 13 players
|
||||
if c > 12:
|
||||
|
|
@ -205,7 +223,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
angle %= 360
|
||||
x = 6 * math.sin(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)
|
||||
|
||||
def killRound(self):
|
||||
|
|
@ -221,9 +240,11 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> bs.Actor:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
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,
|
||||
enable_bomb=False, enable_run=self.is_run)
|
||||
enable_bomb=False,
|
||||
enable_run=self.is_run)
|
||||
spaz.handlemessage(bs.StandMessage(pos))
|
||||
return spaz
|
||||
|
||||
|
|
@ -240,7 +261,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.timer(0.5, self.checkEnd)
|
||||
elif isinstance(msg, FlagPickedUpMessage):
|
||||
self.numPickedUp += 1
|
||||
msg.node.getdelegate(PlayerSpaz, True).getplayer(Player, True).done = True
|
||||
msg.node.getdelegate(PlayerSpaz, True).getplayer(Player,
|
||||
True).done = True
|
||||
l = bs.newnode('light',
|
||||
owner=None,
|
||||
attrs={'color': msg.node.color,
|
||||
|
|
@ -258,9 +280,12 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
try:
|
||||
player.survived = False
|
||||
bs.broadcastmessage("No Flag? " + player.getname())
|
||||
player.actor.handlemessage(bs.StandMessage((0, 3, -2)))
|
||||
bs.timer(0.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
|
||||
bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
|
||||
player.actor.handlemessage(
|
||||
bs.StandMessage((0, 3, -2)))
|
||||
bs.timer(0.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)
|
||||
|
|
|
|||
82
dist/ba_root/mods/games/quake_original.py
vendored
82
dist/ba_root/mods/games/quake_original.py
vendored
|
|
@ -4,22 +4,17 @@
|
|||
# ba_meta require api 8
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from bascenev1lib.actor.powerupbox import PowerupBox as Powerup
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.powerupbox import PowerupBox as Powerup
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
import bascenev1lib.actor.bomb
|
||||
import bascenev1lib.actor.spaz
|
||||
import weakref
|
||||
import random
|
||||
import math
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
|
@ -61,7 +56,8 @@ class QuakeBallFactory(object):
|
|||
self.ball_material = bs.Material()
|
||||
|
||||
self.ball_material.add_actions(
|
||||
conditions=((('we_are_younger_than', 5), 'or', ('they_are_younger_than', 50)),
|
||||
conditions=(
|
||||
(('we_are_younger_than', 5), 'or', ('they_are_younger_than', 50)),
|
||||
'and', ('they_have_material', shared.object_material)),
|
||||
actions=(('modify_node_collision', 'collide', False)))
|
||||
|
||||
|
|
@ -78,14 +74,17 @@ class QuakeBallFactory(object):
|
|||
('message', 'our_node', 'at_connect', TouchedToSpaz())))
|
||||
|
||||
self.ball_material.add_actions(
|
||||
conditions=(('they_dont_have_material', shared.player_material), 'and',
|
||||
conditions=(
|
||||
('they_dont_have_material', shared.player_material), 'and',
|
||||
('they_have_material', shared.object_material)),
|
||||
actions=('message', 'our_node', 'at_connect', TouchedToAnything()))
|
||||
|
||||
self.ball_material.add_actions(
|
||||
conditions=(('they_dont_have_material', shared.player_material), 'and',
|
||||
conditions=(
|
||||
('they_dont_have_material', shared.player_material), 'and',
|
||||
('they_have_material', shared.footing_material)),
|
||||
actions=('message', 'our_node', 'at_connect', TouchedToFootingMaterial()))
|
||||
actions=(
|
||||
'message', 'our_node', 'at_connect', TouchedToFootingMaterial()))
|
||||
|
||||
def give(self, spaz):
|
||||
spaz.punch_callback = self.shot
|
||||
|
|
@ -148,7 +147,8 @@ class QuakeBall(bs.Actor):
|
|||
|
||||
self.node.connectattr('position', self.light_node, 'position')
|
||||
self.emit_time = bs.Timer(0.015, bs.WeakCall(self.emit), repeat=True)
|
||||
self.life_time = bs.Timer(5.0, bs.WeakCall(self.handlemessage, bs.DieMessage()))
|
||||
self.life_time = bs.Timer(5.0, bs.WeakCall(self.handlemessage,
|
||||
bs.DieMessage()))
|
||||
|
||||
def emit(self):
|
||||
bs.emitfx(
|
||||
|
|
@ -185,11 +185,13 @@ class QuakeBall(bs.Actor):
|
|||
velocity = self.node.velocity
|
||||
explosion = bs.newnode('explosion', attrs={
|
||||
'position': self.node.position,
|
||||
'velocity': (velocity[0], max(-1.0, velocity[1]), velocity[2]),
|
||||
'velocity': (
|
||||
velocity[0], max(-1.0, velocity[1]), velocity[2]),
|
||||
'radius': 1,
|
||||
'big': False})
|
||||
|
||||
bs.getsound(random.choice(['impactHard', 'impactHard2', 'impactHard3'])).play(),
|
||||
bs.getsound(random.choice(
|
||||
['impactHard', 'impactHard2', 'impactHard3'])).play(),
|
||||
position = self.node.position
|
||||
|
||||
self.emit_time = None
|
||||
|
|
@ -202,8 +204,10 @@ class QuakeBall(bs.Actor):
|
|||
elif isinstance(m, bs.HitMessage):
|
||||
self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2],
|
||||
m.velocity[0], m.velocity[1], m.velocity[2],
|
||||
1.0*m.magnitude, 1.0*m.velocity_magnitude, m.radius, 0,
|
||||
m.force_direction[0], m.force_direction[1], m.force_direction[2])
|
||||
1.0 * m.magnitude,
|
||||
1.0 * m.velocity_magnitude, m.radius, 0,
|
||||
m.force_direction[0], m.force_direction[1],
|
||||
m.force_direction[2])
|
||||
|
||||
elif isinstance(m, TouchedToSpaz):
|
||||
node = bs.getcollision().opposingnode
|
||||
|
|
@ -244,6 +248,7 @@ class Team(bs.Team[Player]):
|
|||
def __init__(self) -> None:
|
||||
self.score = 0
|
||||
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
||||
|
|
@ -369,7 +374,8 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
|
|||
self.setup_standard_time_limit(self._time_limit)
|
||||
|
||||
self.drop_shield()
|
||||
self.drop_shield_timer = bs.Timer(8.001, bs.WeakCall(self.drop_shield), repeat=True)
|
||||
self.drop_shield_timer = bs.Timer(8.001, bs.WeakCall(self.drop_shield),
|
||||
repeat=True)
|
||||
|
||||
shared = SharedObjects.get()
|
||||
if self.settings['Obstacles']:
|
||||
|
|
@ -380,12 +386,14 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
|
|||
radius = (random.uniform(-10, 1),
|
||||
6,
|
||||
random.uniform(-4.5, 4.5)) \
|
||||
if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-4.5, 4.5))
|
||||
if i > count / 2 else (
|
||||
random.uniform(10, 1), 6, random.uniform(-4.5, 4.5))
|
||||
else:
|
||||
radius = (random.uniform(-10, 1),
|
||||
6,
|
||||
random.uniform(-8, 8)) \
|
||||
if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-8, 8))
|
||||
if i > count / 2 else (
|
||||
random.uniform(10, 1), 6, random.uniform(-8, 8))
|
||||
|
||||
Obstacle(
|
||||
position=radius,
|
||||
|
|
@ -396,18 +404,25 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
if self.settings['Graphics'] == 2:
|
||||
bs.getactivity().globalsnode.tint = (bs.getactivity(
|
||||
).globalsnode.tint[0]-0.6, bs.getactivity().globalsnode.tint[1]-0.6, bs.getactivity().globalsnode.tint[2]-0.6)
|
||||
).globalsnode.tint[0] - 0.6, bs.getactivity().globalsnode.tint[
|
||||
1] - 0.6,
|
||||
bs.getactivity().globalsnode.tint[
|
||||
2] - 0.6)
|
||||
light = bs.newnode('light', attrs={
|
||||
'position': (9, 10, 0) if map == 'Football Stadium' else (6, 7, -2)
|
||||
if not map == 'Rampage' else (6, 11, -2) if not map == 'The Pad' else (6, 8.5, -2),
|
||||
'position': (9, 10, 0) if map == 'Football Stadium' else (
|
||||
6, 7, -2)
|
||||
if not map == 'Rampage' else (
|
||||
6, 11, -2) if not map == 'The Pad' else (6, 8.5, -2),
|
||||
'color': (0.4, 0.4, 0.45),
|
||||
'radius': 1,
|
||||
'intensity': 6,
|
||||
'volume_intensity_scale': 10.0})
|
||||
|
||||
light2 = bs.newnode('light', attrs={
|
||||
'position': (-9, 10, 0) if map == 'Football Stadium' else (-6, 7, -2)
|
||||
if not map == 'Rampage' else (-6, 11, -2) if not map == 'The Pad' else (-6, 8.5, -2),
|
||||
'position': (-9, 10, 0) if map == 'Football Stadium' else (
|
||||
-6, 7, -2)
|
||||
if not map == 'Rampage' else (
|
||||
-6, 11, -2) if not map == 'The Pad' else (-6, 8.5, -2),
|
||||
'color': (0.4, 0.4, 0.45),
|
||||
'radius': 1,
|
||||
'intensity': 6,
|
||||
|
|
@ -423,7 +438,8 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
|
|||
def drop_shield(self):
|
||||
p = Powerup(
|
||||
poweruptype='shield',
|
||||
position=(random.uniform(-10, 10), 6, random.uniform(-5, 5))).autoretain()
|
||||
position=(
|
||||
random.uniform(-10, 10), 6, random.uniform(-5, 5))).autoretain()
|
||||
|
||||
bs.getsound('dingSmall').play()
|
||||
|
||||
|
|
@ -592,14 +608,17 @@ class Obstacle(bs.Actor):
|
|||
'reflection': 'powerup',
|
||||
'reflection_scale': [0.7],
|
||||
'color_texture': bs.gettexture('bunnyColor'),
|
||||
'materials': [shared.footing_material if rebound else shared.object_material,
|
||||
'materials': [
|
||||
shared.footing_material if rebound else shared.object_material,
|
||||
shared.footing_material]})
|
||||
|
||||
if graphics == 2:
|
||||
self.light_node = bs.newnode('light', attrs={
|
||||
'position': (0, 0, 0),
|
||||
'color': ((0.8, 0.2, 0.2) if i < count / 2 else (0.2, 0.2, 0.8))
|
||||
if not random_color else ((random.uniform(0, 1.1), random.uniform(0, 1.1), random.uniform(0, 1.1))),
|
||||
if not random_color else ((
|
||||
random.uniform(0, 1.1), random.uniform(0, 1.1),
|
||||
random.uniform(0, 1.1))),
|
||||
'radius': 0.2,
|
||||
'intensity': 1,
|
||||
'volume_intensity_scale': 10.0})
|
||||
|
|
@ -620,5 +639,6 @@ class Obstacle(bs.Actor):
|
|||
elif isinstance(m, bs.HitMessage):
|
||||
self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2],
|
||||
m.velocity[0], m.velocity[1], m.velocity[2],
|
||||
m.magnitude, m.velocity_magnitude, m.radius, 0,
|
||||
m.magnitude, m.velocity_magnitude, m.radius,
|
||||
0,
|
||||
m.velocity[0], m.velocity[1], m.velocity[2])
|
||||
|
|
|
|||
7
dist/ba_root/mods/games/soccer.py
vendored
7
dist/ba_root/mods/games/soccer.py
vendored
|
|
@ -10,11 +10,11 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import bauiv1 as bui
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -77,7 +77,8 @@ class Puck(bs.Actor):
|
|||
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,
|
||||
1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
|
||||
|
|
|
|||
9
dist/ba_root/mods/games/super_duel.py
vendored
9
dist/ba_root/mods/games/super_duel.py
vendored
|
|
@ -8,15 +8,13 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.game.elimination import Icon
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
from typing import Any, Type, List, Union, Sequence, Optional
|
||||
|
||||
|
||||
class SuperSpaz(PlayerSpaz):
|
||||
|
|
@ -103,6 +101,7 @@ else:
|
|||
box_mode = 'Box Mode'
|
||||
boxing_gloves = 'Boxing Gloves'
|
||||
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
||||
|
|
@ -311,7 +310,8 @@ class NewDuelGame(bs.TeamGameActivity[Player, Team]):
|
|||
else:
|
||||
pos3.append(pos1[0])
|
||||
|
||||
spaz.handlemessage(bs.StandMessage(pos1[0] if player.playervs1 else pos2[0],
|
||||
spaz.handlemessage(
|
||||
bs.StandMessage(pos1[0] if player.playervs1 else pos2[0],
|
||||
pos1[1] if player.playervs1 else pos2[1]))
|
||||
|
||||
if any(pos3):
|
||||
|
|
@ -345,6 +345,7 @@ class NewDuelGame(bs.TeamGameActivity[Player, Team]):
|
|||
chunk_type='spark')
|
||||
if lfx:
|
||||
spaz.node.connectattr('position', lfx, 'position')
|
||||
|
||||
bs.timer(0.1, sp_fx, repeat=True)
|
||||
|
||||
if self._box_mode:
|
||||
|
|
|
|||
33
dist/ba_root/mods/games/supersmash.py
vendored
33
dist/ba_root/mods/games/supersmash.py
vendored
|
|
@ -3,20 +3,19 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import random
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from babase import _math
|
||||
from bascenev1lib.actor.spaz import Spaz
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.game import elimination
|
||||
from bascenev1lib.game.elimination import Icon, Player, Team
|
||||
from bascenev1lib.actor.bomb import Bomb, Blast
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz, PlayerSpazHurtMessage
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.spaz import Spaz
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
from bascenev1lib.game.elimination import Icon, Player, Team
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Sequence, Optional
|
||||
|
|
@ -109,7 +108,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
if not self.node:
|
||||
return None
|
||||
if self.node.invincible:
|
||||
SpazFactory.get().block_sound.play(1.0, position=self.node.position)
|
||||
SpazFactory.get().block_sound.play(1.0,
|
||||
position=self.node.position)
|
||||
return True
|
||||
|
||||
# If we were recently hit, don't count this as another.
|
||||
|
|
@ -156,7 +156,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
# FIXME: Transition out perhaps?
|
||||
self.shield.delete()
|
||||
self.shield = None
|
||||
SpazFactory.get().shield_down_sound.play(1.0, position=self.node.position)
|
||||
SpazFactory.get().shield_down_sound.play(1.0,
|
||||
position=self.node.position)
|
||||
|
||||
# Emit some cool looking sparks when the shield dies.
|
||||
npos = self.node.position
|
||||
|
|
@ -168,7 +169,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
chunk_type='spark')
|
||||
|
||||
else:
|
||||
SpazFactory.get().shield_hit_sound.play(0.5, position=self.node.position)
|
||||
SpazFactory.get().shield_hit_sound.play(0.5,
|
||||
position=self.node.position)
|
||||
|
||||
# Emit some cool looking sparks on shield hit.
|
||||
assert msg.force_direction is not None
|
||||
|
|
@ -223,7 +225,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
# Let's always add in a super-punch sound with boxing
|
||||
# gloves just to differentiate them.
|
||||
if msg.hit_subtype == 'super_punch':
|
||||
SpazFactory.get().punch_sound_stronger.play(1.0, position=self.node.position)
|
||||
SpazFactory.get().punch_sound_stronger.play(1.0,
|
||||
position=self.node.position)
|
||||
if damage > 500:
|
||||
sounds = SpazFactory.get().punch_sound_strong
|
||||
sound = sounds[random.randrange(len(sounds))]
|
||||
|
|
@ -302,7 +305,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
# self.hitpoints -= damage
|
||||
self.multiplyer += min(damage / 2000, 0.15)
|
||||
if damage / 2000 > 0.05:
|
||||
self.set_score_text(str(int((self.multiplyer-1)*100))+'%')
|
||||
self.set_score_text(
|
||||
str(int((self.multiplyer - 1) * 100)) + '%')
|
||||
# self.node.hurt = 1.0 - float(
|
||||
# self.hitpoints) / self.hitpoints_max
|
||||
self.node.hurt = 0.0
|
||||
|
|
@ -334,7 +338,8 @@ class SSPlayerSpaz(PlayerSpaz):
|
|||
self.last_player_attacked_by = source_player
|
||||
self.last_attacked_time = bs.time()
|
||||
self.last_attacked_type = (msg.hit_type, msg.hit_subtype)
|
||||
Spaz.handlemessage(self, bs.HitMessage) # Augment standard behavior.
|
||||
Spaz.handlemessage(self,
|
||||
bs.HitMessage) # Augment standard behavior.
|
||||
activity = self._activity()
|
||||
if activity is not None and self._player.exists():
|
||||
activity.handlemessage(PlayerSpazHurtMessage(self))
|
||||
|
|
@ -368,7 +373,6 @@ class Team(bs.Team[Player]):
|
|||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class SuperSmash(bs.TeamGameActivity[Player, Team]):
|
||||
|
||||
name = 'Super Smash'
|
||||
description = 'Knock everyone off the map.'
|
||||
|
||||
|
|
@ -614,7 +618,6 @@ class Team2(bs.Team[Player]):
|
|||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class SuperSmashElimination(bs.TeamGameActivity[Player2, Team2]):
|
||||
|
||||
name = 'Super Smash Elimination'
|
||||
description = 'Knock everyone off the map.'
|
||||
scoreconfig = bs.ScoreConfig(label='Survived',
|
||||
|
|
|
|||
274
dist/ba_root/mods/games/volleyball.py
vendored
274
dist/ba_root/mods/games/volleyball.py
vendored
|
|
@ -31,7 +31,6 @@
|
|||
- More accurate Goal positions
|
||||
"""
|
||||
|
||||
|
||||
# ba_meta require api 8
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -39,12 +38,11 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import random
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.bomb import BombFactory
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.scoreboard import Scoreboard
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -112,7 +110,8 @@ class Puck(bs.Actor):
|
|||
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,
|
||||
1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
msg.force_direction[2])
|
||||
|
||||
|
|
@ -366,7 +365,8 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._chant_sound.play()
|
||||
if self.credit_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,
|
||||
'position': (0, 0),
|
||||
'shadow': 0.5,
|
||||
|
|
@ -375,11 +375,15 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
|
|||
'h_align': 'center',
|
||||
'v_attach': 'bottom'})
|
||||
shared = SharedObjects.get()
|
||||
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, )})))
|
||||
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,)})))
|
||||
|
||||
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, )})))
|
||||
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,)})))
|
||||
|
||||
def on_team_join(self, team: Team) -> None:
|
||||
self._update_scoreboard()
|
||||
|
|
@ -522,7 +526,8 @@ class Pointzz:
|
|||
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)
|
||||
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) + (
|
||||
42.09506485, 22.81173179, 29.76723155)
|
||||
|
||||
|
|
@ -530,8 +535,10 @@ class Pointzz:
|
|||
class PointzzforH:
|
||||
points, boxes = {}, {}
|
||||
boxes['area_of_interest_bounds'] = (0.0, 0.7956858119, 0.0) + \
|
||||
(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) + (
|
||||
(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) + (
|
||||
35.16182389, 12.18696164, 21.52869693)
|
||||
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)
|
||||
|
|
@ -564,40 +571,106 @@ class VolleyBallMap(bs.Map):
|
|||
shared = SharedObjects.get()
|
||||
x = -5
|
||||
while x < 5:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
x = x + 0.5
|
||||
|
||||
y = -1
|
||||
while y > -11:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
y -= 1
|
||||
|
||||
z = 0
|
||||
while z < 5:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
z += 1
|
||||
|
||||
self.node = bs.newnode(
|
||||
|
|
@ -657,40 +730,106 @@ class VolleyBallMapH(bs.Map):
|
|||
shared = SharedObjects.get()
|
||||
x = -5
|
||||
while x < 5:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
x = x + 0.5
|
||||
|
||||
y = -1
|
||||
while y > -11:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
y -= 1
|
||||
|
||||
z = 0
|
||||
while z < 5:
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
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]})
|
||||
z += 1
|
||||
|
||||
self.node = bs.newnode('terrain',
|
||||
|
|
@ -700,7 +839,8 @@ class VolleyBallMapH(bs.Map):
|
|||
None,
|
||||
'collision_mesh':
|
||||
# we dont want Goalposts...
|
||||
bs.getcollisionmesh('footballStadiumCollide'),
|
||||
bs.getcollisionmesh(
|
||||
'footballStadiumCollide'),
|
||||
'color_texture':
|
||||
self.preloaddata['tex'],
|
||||
'materials': [
|
||||
|
|
|
|||
2
dist/ba_root/mods/games/yeeting_party.py
vendored
2
dist/ba_root/mods/games/yeeting_party.py
vendored
|
|
@ -1,8 +1,6 @@
|
|||
# Made by your friend: Freaku
|
||||
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.game.deathmatch import Player, DeathMatchGame
|
||||
|
||||
|
||||
|
|
|
|||
53
dist/ba_root/mods/playersData/pdata.py
vendored
53
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -4,31 +4,34 @@
|
|||
# (see https://ballistica.net/wiki/meta-tag-system)
|
||||
|
||||
from __future__ import annotations
|
||||
import shutil
|
||||
|
||||
import _thread
|
||||
import copy
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import _bascenev1
|
||||
import setting
|
||||
from serverData import serverdata
|
||||
from tools.ServerUpdate import checkSpammer
|
||||
from tools.file_handle import OpenJson
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import time
|
||||
import os
|
||||
import _thread
|
||||
import babase
|
||||
from serverData import serverdata
|
||||
from tools.file_handle import OpenJson
|
||||
# pylint: disable=import-error
|
||||
import bascenev1 as bs
|
||||
import _bascenev1
|
||||
import json
|
||||
import datetime
|
||||
from tools.ServerUpdate import checkSpammer
|
||||
import setting
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
PLAYERS_DATA_PATH = os.path.join(
|
||||
babase.env()["python_directory_user"], "playersData" + os.sep
|
||||
babase.env()["python_directory_user"], "playersdata" + os.sep
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -97,7 +100,8 @@ def get_profiles() -> dict:
|
|||
|
||||
|
||||
def get_profiles_archive_index():
|
||||
return [x for x in os.listdir(PLAYERS_DATA_PATH) if x.startswith("profiles")]
|
||||
return [x for x in os.listdir(PLAYERS_DATA_PATH) if
|
||||
x.startswith("profiles")]
|
||||
|
||||
|
||||
def get_old_profiles(filename):
|
||||
|
|
@ -156,7 +160,8 @@ def get_detailed_info(pbid):
|
|||
dob = main_account["accountAge"]
|
||||
profiles = get_profiles()
|
||||
for key, value in profiles.items():
|
||||
if ("lastIP" in value and value["lastIP"] == ip) or ("deviceUUID" in value and value["deviceUUID"] == deviceid):
|
||||
if ("lastIP" in value and value["lastIP"] == ip) or (
|
||||
"deviceUUID" in value and value["deviceUUID"] == deviceid):
|
||||
otheraccounts += ' '.join(value["display_string"])
|
||||
return f"Accounts:{linked_accounts} \n other accounts {otheraccounts} \n created on {dob}"
|
||||
|
||||
|
|
@ -213,7 +218,8 @@ def add_profile(
|
|||
device_id = _bascenev1.get_client_device_uuid(cid)
|
||||
checkSpammer({'id': account_id, 'display': display_string,
|
||||
'ip': ip, 'device': device_id})
|
||||
if device_id in get_blacklist()["ban"]["deviceids"] or account_id in get_blacklist()["ban"]["ids"]:
|
||||
if device_id in get_blacklist()["ban"]["deviceids"] or account_id in \
|
||||
get_blacklist()["ban"]["ids"]:
|
||||
bs.disconnect_client(cid)
|
||||
serverdata.clients[account_id]["deviceUUID"] = device_id
|
||||
|
||||
|
|
@ -296,7 +302,8 @@ def ban_player(account_id: str, duration_in_days: float, reason: str) -> None:
|
|||
"%Y-%m-%d %H:%M:%S"), "reason": f'linked with account {account_id}'}
|
||||
CacheData.blacklist["ban"]["ids"][account_id] = {
|
||||
"till": ban_time.strftime("%Y-%m-%d %H:%M:%S"), "reason": reason}
|
||||
CacheData.blacklist["ban"]["deviceids"][device_id] = {"till": ban_time.strftime(
|
||||
CacheData.blacklist["ban"]["deviceids"][device_id] = {
|
||||
"till": ban_time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S"), "reason": f'linked with account {account_id}'}
|
||||
_thread.start_new_thread(update_blacklist, ())
|
||||
|
||||
|
|
@ -317,7 +324,8 @@ def unban_player(account_id):
|
|||
|
||||
def disable_kick_vote(account_id, duration, reason):
|
||||
ban_time = datetime.now() + timedelta(days=duration)
|
||||
CacheData.blacklist["kick-vote-disabled"][account_id] = {"till": ban_time.strftime(
|
||||
CacheData.blacklist["kick-vote-disabled"][account_id] = {
|
||||
"till": ban_time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S"), "reason": reason}
|
||||
_thread.start_new_thread(update_blacklist, ())
|
||||
|
||||
|
|
@ -597,8 +605,10 @@ def get_custom() -> dict:
|
|||
f.close()
|
||||
CacheData.custom = custom
|
||||
for account_id in custom["customeffects"]:
|
||||
custom["customeffects"][account_id] = [custom["customeffects"][account_id]] if type(
|
||||
custom["customeffects"][account_id]) is str else custom["customeffects"][account_id]
|
||||
custom["customeffects"][account_id] = [
|
||||
custom["customeffects"][account_id]] if type(
|
||||
custom["customeffects"][account_id]) is str else \
|
||||
custom["customeffects"][account_id]
|
||||
|
||||
return CacheData.custom
|
||||
|
||||
|
|
@ -616,7 +626,8 @@ def set_effect(effect: str, account_id: str) -> None:
|
|||
custom = get_custom()
|
||||
if account_id in custom["customeffects"]:
|
||||
effects = [custom["customeffects"][account_id]] if type(
|
||||
custom["customeffects"][account_id]) is str else custom["customeffects"][account_id]
|
||||
custom["customeffects"][account_id]) is str else \
|
||||
custom["customeffects"][account_id]
|
||||
effects.append(effect)
|
||||
custom["customeffects"][account_id] = effects
|
||||
else:
|
||||
|
|
|
|||
10
dist/ba_root/mods/playersData/profiles.json
vendored
10
dist/ba_root/mods/playersData/profiles.json
vendored
|
|
@ -22982,11 +22982,15 @@
|
|||
"lastSpam": 1692041275.3951833,
|
||||
"totaltimeplayer": 0,
|
||||
"warnCount": 0,
|
||||
"lastWarned": 1692043356.2733295,
|
||||
"lastWarned": 1692092826.0631683,
|
||||
"verified": true,
|
||||
"rejoincount": 1,
|
||||
"lastJoin": 1692043356.2733343,
|
||||
"lastJoin": 1692092826.063172,
|
||||
"lastIP": "axj~}j~~jhai",
|
||||
"deviceUUID": "26f30cfd3921c2d15574b534cb824c952b14f189"
|
||||
"deviceUUID": "26f30cfd3921c2d15574b534cb824c952b14f189",
|
||||
"cMsgCount": 0,
|
||||
"lastMsgTime": 1692092832.8181152,
|
||||
"lastMsg": "/ping all",
|
||||
"cSameMsg": 0
|
||||
}
|
||||
}
|
||||
|
|
@ -22982,11 +22982,15 @@
|
|||
"lastSpam": 1692041275.3951833,
|
||||
"totaltimeplayer": 0,
|
||||
"warnCount": 0,
|
||||
"lastWarned": 1692043356.2733295,
|
||||
"lastWarned": 1692092826.0631683,
|
||||
"verified": true,
|
||||
"rejoincount": 1,
|
||||
"lastJoin": 1692043356.2733343,
|
||||
"lastJoin": 1692092826.063172,
|
||||
"lastIP": "axj~}j~~jhai",
|
||||
"deviceUUID": "26f30cfd3921c2d15574b534cb824c952b14f189"
|
||||
"deviceUUID": "26f30cfd3921c2d15574b534cb824c952b14f189",
|
||||
"cMsgCount": 0,
|
||||
"lastMsgTime": 1692092832.8181152,
|
||||
"lastMsg": "/ping all",
|
||||
"cSameMsg": 0
|
||||
}
|
||||
}
|
||||
28928
dist/ba_root/mods/playersdata/profiles.json2022-12-06 08%3A23%3A09.458547
vendored
Normal file
28928
dist/ba_root/mods/playersdata/profiles.json2022-12-06 08%3A23%3A09.458547
vendored
Normal file
File diff suppressed because it is too large
Load diff
33262
dist/ba_root/mods/playersdata/profiles.json2022-12-06 14%3A32%3A45.695478
vendored
Normal file
33262
dist/ba_root/mods/playersdata/profiles.json2022-12-06 14%3A32%3A45.695478
vendored
Normal file
File diff suppressed because it is too large
Load diff
36666
dist/ba_root/mods/playersdata/profiles.json2022-12-06 20%3A51%3A54.236791
vendored
Normal file
36666
dist/ba_root/mods/playersdata/profiles.json2022-12-06 20%3A51%3A54.236791
vendored
Normal file
File diff suppressed because it is too large
Load diff
37588
dist/ba_root/mods/playersdata/profiles.json2022-12-07 03%3A05%3A19.300593
vendored
Normal file
37588
dist/ba_root/mods/playersdata/profiles.json2022-12-07 03%3A05%3A19.300593
vendored
Normal file
File diff suppressed because one or more lines are too long
357
dist/ba_root/mods/plugins/CharacterChooser.py
vendored
357
dist/ba_root/mods/plugins/CharacterChooser.py
vendored
|
|
@ -1,357 +0,0 @@
|
|||
# ba_meta require api 8
|
||||
|
||||
'''
|
||||
Character Chooser by Mr.Smoothy
|
||||
|
||||
This plugin will let you choose your character from lobby.
|
||||
|
||||
Install this plugin on your Phone/PC or on Server
|
||||
|
||||
If installed on server :- this will also let players choose server specific custom characters . so no more sharing of character file with all players,
|
||||
just install this plugin on server ...and players can pick character from lobby .
|
||||
|
||||
Use:-
|
||||
> select your profile (focus on color and name)
|
||||
> press ready (punch)
|
||||
> now use UP/DOWN buttons to scroll character list
|
||||
> Press ready again (punch) to join the game
|
||||
> or press Bomb button to go back to profile choosing menu
|
||||
> END
|
||||
|
||||
Watch : https://www.youtube.com/watch?v=hNmv2l-NahE
|
||||
Join : https://discord.gg/ucyaesh
|
||||
Contact : discord mr.smoothy#5824
|
||||
|
||||
|
||||
Share this plugin with your server owner /admins to use it online
|
||||
|
||||
:)
|
||||
|
||||
'''
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs,_ba
|
||||
import babase.internal
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
||||
|
||||
from babase._error import print_exception, print_error, NotFoundError
|
||||
from babase._gameutils import animate, animate_array
|
||||
from babase._language import Lstr
|
||||
from babase._generated.enums import SpecialChar, InputType
|
||||
from babase._profile import get_player_profile_colors
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
import weakref
|
||||
import os,json
|
||||
from ba import _lobby
|
||||
from bascenev1lib.actor.spazappearance import *
|
||||
from babase._lobby import ChangeMessage
|
||||
from babase._lobby import PlayerReadyMessage
|
||||
|
||||
def __init__(self, vpos: float, sessionplayer: _bs.SessionPlayer,
|
||||
lobby: 'Lobby') -> None:
|
||||
self._deek_sound = _bs.getsound('deek')
|
||||
self._click_sound = _bs.getsound('click01')
|
||||
self._punchsound = _bs.getsound('punch01')
|
||||
self._swish_sound = _bs.getsound('punchSwish')
|
||||
self._errorsound = _bs.getsound('error')
|
||||
self._mask_texture = _bs.gettexture('characterIconMask')
|
||||
self._vpos = vpos
|
||||
self._lobby = weakref.ref(lobby)
|
||||
self._sessionplayer = sessionplayer
|
||||
self._inited = False
|
||||
self._dead = False
|
||||
self._text_node: Optional[bs.Node] = None
|
||||
self._profilename = ''
|
||||
self._profilenames: List[str] = []
|
||||
self._ready: bool = False
|
||||
self._character_names: List[str] = []
|
||||
self._last_change: Sequence[Union[float, int]] = (0, 0)
|
||||
self._profiles: Dict[str, Dict[str, Any]] = {}
|
||||
|
||||
app = _babase.app
|
||||
|
||||
self.bakwas_chars=["Lee","Todd McBurton","Zola","Butch","Witch","warrior","Middle-Man","Alien","OldLady","Gladiator","Wrestler","Gretel","Robot"]
|
||||
|
||||
# Load available player profiles either from the local config or
|
||||
# from the remote device.
|
||||
self.reload_profiles()
|
||||
for name in _babase.app.spaz_appearances:
|
||||
if name not in self._character_names and name not in self.bakwas_chars:
|
||||
self._character_names.append(name)
|
||||
# Note: this is just our local index out of available teams; *not*
|
||||
# the team-id!
|
||||
self._selected_team_index: int = self.lobby.next_add_team
|
||||
|
||||
# Store a persistent random character index and colors; we'll use this
|
||||
# for the '_random' profile. Let's use their input_device id to seed
|
||||
# it. This will give a persistent character for them between games
|
||||
# and will distribute characters nicely if everyone is random.
|
||||
self._random_color, self._random_highlight = (
|
||||
get_player_profile_colors(None))
|
||||
|
||||
# To calc our random character we pick a random one out of our
|
||||
# unlocked list and then locate that character's index in the full
|
||||
# list.
|
||||
char_index_offset = app.lobby_random_char_index_offset
|
||||
self._random_character_index = (
|
||||
(sessionplayer.inputdevice.id + char_index_offset) %
|
||||
len(self._character_names))
|
||||
|
||||
# Attempt to set an initial profile based on what was used previously
|
||||
# for this input-device, etc.
|
||||
self._profileindex = self._select_initial_profile()
|
||||
self._profilename = self._profilenames[self._profileindex]
|
||||
|
||||
self._text_node = _bs.newnode('text',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'position': (-100, self._vpos),
|
||||
'maxwidth': 190,
|
||||
'shadow': 0.5,
|
||||
'vr_depth': -20,
|
||||
'h_align': 'left',
|
||||
'v_align': 'center',
|
||||
'v_attach': 'top'
|
||||
})
|
||||
animate(self._text_node, 'scale', {0: 0, 0.1: 1.0})
|
||||
self.icon = _bs.newnode('image',
|
||||
owner=self._text_node,
|
||||
attrs={
|
||||
'position': (-130, self._vpos + 20),
|
||||
'mask_texture': self._mask_texture,
|
||||
'vr_depth': -10,
|
||||
'attach': 'topCenter'
|
||||
})
|
||||
|
||||
animate_array(self.icon, 'scale', 2, {0: (0, 0), 0.1: (45, 45)})
|
||||
|
||||
# Set our initial name to '<choosing player>' in case anyone asks.
|
||||
self._sessionplayer.setname(
|
||||
Lstr(resource='choosingPlayerText').evaluate(), real=False)
|
||||
|
||||
# Init these to our rando but they should get switched to the
|
||||
# selected profile (if any) right after.
|
||||
self._character_index = self._random_character_index
|
||||
self._color = self._random_color
|
||||
self._highlight = self._random_highlight
|
||||
self.characterchooser=False
|
||||
self.update_from_profile()
|
||||
self.update_position()
|
||||
self._inited = True
|
||||
|
||||
self._set_ready(False)
|
||||
|
||||
|
||||
|
||||
|
||||
def _set_ready(self, ready: bool) -> None:
|
||||
|
||||
# pylint: disable=cyclic-import
|
||||
from bauiv1lib.profile import browser as pbrowser
|
||||
from babase._general import Call
|
||||
profilename = self._profilenames[self._profileindex]
|
||||
|
||||
# Handle '_edit' as a special case.
|
||||
if profilename == '_edit' and ready:
|
||||
with _babase.Context('ui'):
|
||||
pbrowser.ProfileBrowserWindow(in_main_menu=False)
|
||||
|
||||
# Give their input-device UI ownership too
|
||||
# (prevent someone else from snatching it in crowded games)
|
||||
babase.internal.set_ui_input_device(self._sessionplayer.inputdevice)
|
||||
return
|
||||
|
||||
if ready==False:
|
||||
self._sessionplayer.assigninput(
|
||||
InputType.LEFT_PRESS,
|
||||
Call(self.handlemessage, ChangeMessage('team', -1)))
|
||||
self._sessionplayer.assigninput(
|
||||
InputType.RIGHT_PRESS,
|
||||
Call(self.handlemessage, ChangeMessage('team', 1)))
|
||||
self._sessionplayer.assigninput(
|
||||
InputType.BOMB_PRESS,
|
||||
Call(self.handlemessage, ChangeMessage('character', 1)))
|
||||
self._sessionplayer.assigninput(
|
||||
InputType.UP_PRESS,
|
||||
Call(self.handlemessage, ChangeMessage('profileindex', -1)))
|
||||
self._sessionplayer.assigninput(
|
||||
InputType.DOWN_PRESS,
|
||||
Call(self.handlemessage, ChangeMessage('profileindex', 1)))
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.JUMP_PRESS, InputType.PICK_UP_PRESS,
|
||||
InputType.PUNCH_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('ready', 1)))
|
||||
self._ready = False
|
||||
self._update_text()
|
||||
self._sessionplayer.setname('untitled', real=False)
|
||||
elif ready == True:
|
||||
self.characterchooser=True
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.LEFT_PRESS, InputType.RIGHT_PRESS,
|
||||
InputType.UP_PRESS, InputType.DOWN_PRESS,
|
||||
InputType.JUMP_PRESS, InputType.BOMB_PRESS,
|
||||
InputType.PICK_UP_PRESS), self._do_nothing)
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.UP_PRESS),Call(self.handlemessage,ChangeMessage('characterchooser',-1)))
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.DOWN_PRESS),Call(self.handlemessage,ChangeMessage('characterchooser',1)))
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.BOMB_PRESS),Call(self.handlemessage,ChangeMessage('ready',0)))
|
||||
|
||||
self._sessionplayer.assigninput(
|
||||
(InputType.JUMP_PRESS,InputType.PICK_UP_PRESS, InputType.PUNCH_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('ready', 2)))
|
||||
|
||||
# Store the last profile picked by this input for reuse.
|
||||
input_device = self._sessionplayer.inputdevice
|
||||
name = input_device.name
|
||||
unique_id = input_device.unique_identifier
|
||||
device_profiles = _babase.app.config.setdefault(
|
||||
'Default Player Profiles', {})
|
||||
|
||||
# Make an exception if we have no custom profiles and are set
|
||||
# to random; in that case we'll want to start picking up custom
|
||||
# profiles if/when one is made so keep our setting cleared.
|
||||
special = ('_random', '_edit', '__account__')
|
||||
have_custom_profiles = any(p not in special
|
||||
for p in self._profiles)
|
||||
|
||||
profilekey = name + ' ' + unique_id
|
||||
if profilename == '_random' and not have_custom_profiles:
|
||||
if profilekey in device_profiles:
|
||||
del device_profiles[profilekey]
|
||||
else:
|
||||
device_profiles[profilekey] = profilename
|
||||
_babase.app.config.commit()
|
||||
|
||||
# Set this player's short and full name.
|
||||
self._sessionplayer.setname(self._getname(),
|
||||
self._getname(full=True),
|
||||
real=True)
|
||||
self._ready = True
|
||||
self._update_text()
|
||||
else:
|
||||
|
||||
|
||||
|
||||
# Inform the session that this player is ready.
|
||||
_babase.getsession().handlemessage(PlayerReadyMessage(self))
|
||||
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
"""Standard generic message handler."""
|
||||
|
||||
if isinstance(msg, ChangeMessage):
|
||||
self._handle_repeat_message_attack()
|
||||
|
||||
# If we've been removed from the lobby, ignore this stuff.
|
||||
if self._dead:
|
||||
print_error('chooser got ChangeMessage after dying')
|
||||
return
|
||||
|
||||
if not self._text_node:
|
||||
print_error('got ChangeMessage after nodes died')
|
||||
return
|
||||
if msg.what=='characterchooser':
|
||||
_self._click_sound.play()
|
||||
# update our index in our local list of characters
|
||||
self._character_index = ((self._character_index + msg.value) %
|
||||
len(self._character_names))
|
||||
self._update_text()
|
||||
self._update_icon()
|
||||
|
||||
if msg.what == 'team':
|
||||
sessionteams = self.lobby.sessionteams
|
||||
if len(sessionteams) > 1:
|
||||
_self._swish_sound.play()
|
||||
self._selected_team_index = (
|
||||
(self._selected_team_index + msg.value) %
|
||||
len(sessionteams))
|
||||
self._update_text()
|
||||
self.update_position()
|
||||
self._update_icon()
|
||||
|
||||
elif msg.what == 'profileindex':
|
||||
if len(self._profilenames) == 1:
|
||||
|
||||
# This should be pretty hard to hit now with
|
||||
# automatic local accounts.
|
||||
__bs.getsound('error').play()
|
||||
else:
|
||||
|
||||
# Pick the next player profile and assign our name
|
||||
# and character based on that.
|
||||
_self._deek_sound.play()
|
||||
self._profileindex = ((self._profileindex + msg.value) %
|
||||
len(self._profilenames))
|
||||
self.update_from_profile()
|
||||
|
||||
elif msg.what == 'character':
|
||||
_self._click_sound.play()
|
||||
self.characterchooser=True
|
||||
# update our index in our local list of characters
|
||||
self._character_index = ((self._character_index + msg.value) %
|
||||
len(self._character_names))
|
||||
self._update_text()
|
||||
self._update_icon()
|
||||
|
||||
elif msg.what == 'ready':
|
||||
self._handle_ready_msg(msg.value)
|
||||
|
||||
def _update_text(self) -> None:
|
||||
assert self._text_node is not None
|
||||
if self._ready:
|
||||
|
||||
# Once we're ready, we've saved the name, so lets ask the system
|
||||
# for it so we get appended numbers and stuff.
|
||||
text = Lstr(value=self._sessionplayer.getname(full=True))
|
||||
if self.characterchooser:
|
||||
text = Lstr(value='${A}\n${B}',
|
||||
subs=[('${A}', text),
|
||||
('${B}', Lstr(value=""+self._character_names[self._character_index]))])
|
||||
self._text_node.scale=0.8
|
||||
else:
|
||||
text = Lstr(value='${A} (${B})',
|
||||
subs=[('${A}', text),
|
||||
('${B}', Lstr(resource='readyText'))])
|
||||
else:
|
||||
text = Lstr(value=self._getname(full=True))
|
||||
self._text_node.scale=1.0
|
||||
|
||||
can_switch_teams = len(self.lobby.sessionteams) > 1
|
||||
|
||||
# Flash as we're coming in.
|
||||
fin_color = _babase.safecolor(self.get_color()) + (1, )
|
||||
if not self._inited:
|
||||
animate_array(self._text_node, 'color', 4, {
|
||||
0.15: fin_color,
|
||||
0.25: (2, 2, 2, 1),
|
||||
0.35: fin_color
|
||||
})
|
||||
else:
|
||||
|
||||
# Blend if we're in teams mode; switch instantly otherwise.
|
||||
if can_switch_teams:
|
||||
animate_array(self._text_node, 'color', 4, {
|
||||
0: self._text_node.color,
|
||||
0.1: fin_color
|
||||
})
|
||||
else:
|
||||
self._text_node.color = fin_color
|
||||
|
||||
self._text_node.text = text
|
||||
|
||||
def enable() -> None:
|
||||
_lobby.Chooser.__init__=__init__
|
||||
_lobby.Chooser._set_ready=_set_ready
|
||||
|
||||
_lobby.Chooser._update_text=_update_text
|
||||
_lobby.Chooser.handlemessage=handlemessage
|
||||
3
dist/ba_root/mods/plugins/__init__.py
vendored
3
dist/ba_root/mods/plugins/__init__.py
vendored
|
|
@ -14,12 +14,11 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
class Init(babase.Plugin): # pylint: disable=too-few-public-methods
|
||||
"""Initializes all of the plugins in the directory."""
|
||||
|
|
|
|||
117
dist/ba_root/mods/plugins/auto_stunt.py
vendored
117
dist/ba_root/mods/plugins/auto_stunt.py
vendored
|
|
@ -6,29 +6,30 @@
|
|||
# and import this as module.
|
||||
# If want to contribute in this original module, raise PR on github https://github.com/bombsquad-community/plugin-manager
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import bascenev1lib
|
||||
from bascenev1lib.actor.text import Text
|
||||
from bascenev1lib.actor.image import Image
|
||||
from bascenev1lib.actor import spaz
|
||||
from bascenev1lib.actor import playerspaz
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
from bascenev1lib.game.elimination import EliminationGame
|
||||
import math
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
|
||||
import _babase
|
||||
from typing import Optional
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
import bascenev1lib
|
||||
import bauiv1 as bui
|
||||
from bascenev1lib.actor import spaz
|
||||
from bascenev1lib.actor.image import Image
|
||||
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
|
||||
from bascenev1lib.actor.spazfactory import SpazFactory
|
||||
from bascenev1lib.actor.text import Text
|
||||
from bascenev1lib.game.elimination import EliminationGame
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
CONTROLS_CENTER = (0, 0)
|
||||
CONTROLS_SCALE = 1
|
||||
|
||||
BASE_STUNTS_DIRECTORY = os.path.join(_babase.env()["python_directory_user"], "CustomStunts")
|
||||
BASE_STUNTS_DIRECTORY = os.path.join(_babase.env()["python_directory_user"],
|
||||
"CustomStunts")
|
||||
PLAYERS_STUNT_INFO = {}
|
||||
|
||||
STUNT_CACHE = {}
|
||||
|
|
@ -40,55 +41,74 @@ class ControlsUI:
|
|||
|
||||
def on_jump_press(activity):
|
||||
activity._jump_image.node.color = list(
|
||||
channel * 2 for channel in activity._jump_image.node.color[:3]) + [1]
|
||||
channel * 2 for channel in activity._jump_image.node.color[:3]) + [
|
||||
1]
|
||||
|
||||
def on_jump_release(activity):
|
||||
activity._jump_image.node.color = list(
|
||||
channel * 0.5 for channel in activity._jump_image.node.color[:3]) + [1]
|
||||
channel * 0.5 for channel in
|
||||
activity._jump_image.node.color[:3]) + [1]
|
||||
|
||||
def on_pickup_press(activity):
|
||||
activity._pickup_image.node.color = list(
|
||||
channel * 2 for channel in activity._pickup_image.node.color[:3]) + [1]
|
||||
channel * 2 for channel in
|
||||
activity._pickup_image.node.color[:3]) + [1]
|
||||
|
||||
def on_pickup_release(activity):
|
||||
activity._pickup_image.node.color = list(
|
||||
channel * 0.5 for channel in activity._pickup_image.node.color[:3]) + [1]
|
||||
channel * 0.5 for channel in
|
||||
activity._pickup_image.node.color[:3]) + [1]
|
||||
|
||||
def on_punch_press(activity):
|
||||
activity._punch_image.node.color = list(
|
||||
channel * 2 for channel in activity._punch_image.node.color[:3]) + [1]
|
||||
channel * 2 for channel in activity._punch_image.node.color[:3]) + [
|
||||
1]
|
||||
|
||||
def on_punch_release(activity):
|
||||
activity._punch_image.node.color = list(
|
||||
channel * 0.5 for channel in activity._punch_image.node.color[:3]) + [1]
|
||||
channel * 0.5 for channel in
|
||||
activity._punch_image.node.color[:3]) + [1]
|
||||
|
||||
def on_bomb_press(activity):
|
||||
activity._bomb_image.node.color = list(
|
||||
channel * 2 for channel in activity._bomb_image.node.color[:3]) + [1]
|
||||
channel * 2 for channel in activity._bomb_image.node.color[:3]) + [
|
||||
1]
|
||||
|
||||
def on_bomb_release(activity):
|
||||
activity._bomb_image.node.color = list(
|
||||
channel * 0.5 for channel in activity._bomb_image.node.color[:3]) + [1]
|
||||
channel * 0.5 for channel in
|
||||
activity._bomb_image.node.color[:3]) + [1]
|
||||
|
||||
def on_move_ud(activity, value):
|
||||
activity.set_stick_image_position(activity, x=activity.stick_image_position_x, y=value)
|
||||
activity.set_stick_image_position(activity,
|
||||
x=activity.stick_image_position_x,
|
||||
y=value)
|
||||
|
||||
def on_move_lr(activity, value):
|
||||
activity.set_stick_image_position(activity, x=value, y=activity.stick_image_position_y)
|
||||
activity.set_stick_image_position(activity, x=value,
|
||||
y=activity.stick_image_position_y)
|
||||
|
||||
def display(activity):
|
||||
activity._jump_image.node.color = list(activity._jump_image.node.color[:3]) + [1]
|
||||
activity._pickup_image.node.color = list(activity._pickup_image.node.color[:3]) + [1]
|
||||
activity._punch_image.node.color = list(activity._punch_image.node.color[:3]) + [1]
|
||||
activity._bomb_image.node.color = list(activity._bomb_image.node.color[:3]) + [1]
|
||||
activity._jump_image.node.color = list(
|
||||
activity._jump_image.node.color[:3]) + [1]
|
||||
activity._pickup_image.node.color = list(
|
||||
activity._pickup_image.node.color[:3]) + [1]
|
||||
activity._punch_image.node.color = list(
|
||||
activity._punch_image.node.color[:3]) + [1]
|
||||
activity._bomb_image.node.color = list(
|
||||
activity._bomb_image.node.color[:3]) + [1]
|
||||
activity._stick_base_image.opacity = 1.0
|
||||
activity._stick_nub_image.opacity = 1.0
|
||||
|
||||
def hide(activity):
|
||||
activity._jump_image.node.color = list(activity._jump_image.node.color[:3]) + [0]
|
||||
activity._pickup_image.node.color = list(activity._pickup_image.node.color[:3]) + [0]
|
||||
activity._punch_image.node.color = list(activity._punch_image.node.color[:3]) + [0]
|
||||
activity._bomb_image.node.color = list(activity._bomb_image.node.color[:3]) + [0]
|
||||
activity._jump_image.node.color = list(
|
||||
activity._jump_image.node.color[:3]) + [0]
|
||||
activity._pickup_image.node.color = list(
|
||||
activity._pickup_image.node.color[:3]) + [0]
|
||||
activity._punch_image.node.color = list(
|
||||
activity._punch_image.node.color[:3]) + [0]
|
||||
activity._bomb_image.node.color = list(
|
||||
activity._bomb_image.node.color[:3]) + [0]
|
||||
activity._stick_base_image.opacity = 0.0
|
||||
activity._stick_nub_image.opacity = 0.0
|
||||
|
||||
|
|
@ -283,19 +303,23 @@ def replay(player, stunt_name):
|
|||
else:
|
||||
bs.timer(
|
||||
move["time"],
|
||||
babase.Call(player.actor.move_map[move["move"]["action"]], move["move"]["value"])
|
||||
babase.Call(player.actor.move_map[move["move"]["action"]],
|
||||
move["move"]["value"])
|
||||
)
|
||||
last_move_time = move["time"]
|
||||
time_to_hide_controls = last_move_time + 1
|
||||
bs.timer(time_to_hide_controls, babase.Call(handle_player_replay_end, player))
|
||||
bs.timer(time_to_hide_controls,
|
||||
babase.Call(handle_player_replay_end, player))
|
||||
|
||||
|
||||
def spawn_mirror_spaz(player):
|
||||
player.mirror_mode = True
|
||||
with babase.Context(player.actor._activity()):
|
||||
bot = spaz.Spaz(player.color, player.highlight, character=player.character).autoretain()
|
||||
bot = spaz.Spaz(player.color, player.highlight,
|
||||
character=player.character).autoretain()
|
||||
bot.handlemessage(babase.StandMessage(
|
||||
(player.actor.node.position[0], player.actor.node.position[1], player.actor.node.position[2]+1), 93))
|
||||
(player.actor.node.position[0], player.actor.node.position[1],
|
||||
player.actor.node.position[2] + 1), 93))
|
||||
bot.node.name = player.actor.node.name
|
||||
bot.node.name_color = player.actor.node.name_color
|
||||
player.actor.mirror_spaz.append(bot)
|
||||
|
|
@ -315,9 +339,9 @@ def ghost(player, stunt_name):
|
|||
return
|
||||
player.in_replay = True
|
||||
|
||||
with babase.Context(player.actor._activity()):
|
||||
with player.actor._activity().context:
|
||||
bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain()
|
||||
bot.handlemessage(babase.StandMessage(player.actor.node.position, 93))
|
||||
bot.handlemessage(bs.StandMessage(player.actor.node.position, 93))
|
||||
give_ghost_power(bot)
|
||||
ControlsUI.display(player.actor._activity())
|
||||
for move in stunt:
|
||||
|
|
@ -336,18 +360,21 @@ def ghost(player, stunt_name):
|
|||
else:
|
||||
bs.timer(
|
||||
move["time"],
|
||||
babase.Call(bot.move_map[move["move"]["action"]], move["move"]["value"])
|
||||
babase.Call(bot.move_map[move["move"]["action"]],
|
||||
move["move"]["value"])
|
||||
)
|
||||
ui_activation = CONTROLS_UI_MAP.get(move["move"]["action"])
|
||||
|
||||
if ui_activation:
|
||||
bs.timer(
|
||||
move["time"],
|
||||
babase.Call(ui_activation, player.actor._activity(), move["move"]["value"])
|
||||
babase.Call(ui_activation, player.actor._activity(),
|
||||
move["move"]["value"])
|
||||
)
|
||||
last_move_time = move["time"]
|
||||
time_to_hide_controls = last_move_time + 1
|
||||
bs.timer(time_to_hide_controls, babase.Call(handle_player_replay_end, player))
|
||||
bs.timer(time_to_hide_controls,
|
||||
babase.Call(handle_player_replay_end, player))
|
||||
bs.timer(time_to_hide_controls, babase.Call(bot.node.delete))
|
||||
|
||||
|
||||
|
|
@ -362,7 +389,8 @@ def give_ghost_power(spaz):
|
|||
('they_have_material', shared.player_material), 'or',
|
||||
('they_have_material', shared.attack_material), 'or',
|
||||
('they_have_material', shared.pickup_material), 'or',
|
||||
('they_have_material', PowerupBoxFactory.get().powerup_accept_material)),
|
||||
('they_have_material',
|
||||
PowerupBoxFactory.get().powerup_accept_material)),
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', False),
|
||||
('modify_part_collision', 'physical', False)
|
||||
|
|
@ -439,7 +467,6 @@ def new_chatmessage(msg):
|
|||
|
||||
|
||||
def set_stick_image_position(self, x: float, y: float) -> None:
|
||||
|
||||
# Clamp this to a circle.
|
||||
len_squared = x * x + y * y
|
||||
if len_squared > 1.0:
|
||||
|
|
@ -540,6 +567,8 @@ class byHeySmoothy(babase.Plugin):
|
|||
# lets define a sample elimination game that can use super power of this plugin
|
||||
|
||||
from plugins import auto_stunt
|
||||
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class BroEliminaition(EliminationGame):
|
||||
name = 'BroElimination'
|
||||
|
|
|
|||
33
dist/ba_root/mods/plugins/bcs_plugin.py
vendored
33
dist/ba_root/mods/plugins/bcs_plugin.py
vendored
|
|
@ -6,11 +6,13 @@
|
|||
# from gunicorn.workers import ggevent as gevent_worker
|
||||
|
||||
import logging
|
||||
from threading import Thread
|
||||
from flask import Flask, request, jsonify
|
||||
from functools import wraps
|
||||
import os
|
||||
import _babaseimport _thread
|
||||
from functools import wraps
|
||||
from threading import Thread
|
||||
|
||||
import _babase
|
||||
from flask import Flask, request, jsonify
|
||||
|
||||
# import uvicorn
|
||||
from . import bombsquad_service
|
||||
|
||||
|
|
@ -29,7 +31,8 @@ def add_cors_headers(response):
|
|||
# Allow requests from any origin
|
||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
# Allow specific headers
|
||||
response.headers['Access-Control-Allow-Headers'] = 'Content-Type,Authorization,Secret-Key'
|
||||
response.headers[
|
||||
'Access-Control-Allow-Headers'] = 'Content-Type,Authorization,Secret-Key'
|
||||
# Allow specific HTTP methods
|
||||
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE'
|
||||
return response
|
||||
|
|
@ -38,9 +41,11 @@ def add_cors_headers(response):
|
|||
def check_admin(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
if "Secret-Key" not in request.headers or request.headers["Secret-Key"] != SECRET_KEY:
|
||||
if "Secret-Key" not in request.headers or request.headers[
|
||||
"Secret-Key"] != SECRET_KEY:
|
||||
return jsonify({"message": "Invalid secret key provided."}), 401
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
|
|
@ -69,7 +74,8 @@ def subscribe_player():
|
|||
'message': f'Subscribed {data["name"]} successfully , will send confirmation notification to test'}
|
||||
return jsonify(response), 201
|
||||
except Exception as e:
|
||||
return jsonify({'message': 'Error processing request', 'error': str(e)}), 400
|
||||
return jsonify(
|
||||
{'message': 'Error processing request', 'error': str(e)}), 400
|
||||
|
||||
|
||||
# ============ Admin only =========
|
||||
|
|
@ -109,7 +115,8 @@ def update_roles():
|
|||
'message': 'Roles updated successfully'}
|
||||
return jsonify(response), 201
|
||||
except Exception as e:
|
||||
return jsonify({'message': 'Error processing request', 'error': str(e)}), 400
|
||||
return jsonify(
|
||||
{'message': 'Error processing request', 'error': str(e)}), 400
|
||||
|
||||
|
||||
@app.route('/api/perks', methods=['GET'])
|
||||
|
|
@ -128,7 +135,8 @@ def update_perks():
|
|||
'message': 'Custom perks updated successfully'}
|
||||
return jsonify(response), 201
|
||||
except Exception as e:
|
||||
return jsonify({'message': 'Error processing request', 'error': str(e)}), 400
|
||||
return jsonify(
|
||||
{'message': 'Error processing request', 'error': str(e)}), 400
|
||||
|
||||
|
||||
@app.route('/api/server-settings', methods=['POST'])
|
||||
|
|
@ -141,7 +149,8 @@ def update_server_settings():
|
|||
'message': 'Settings updated successfully, server may need restart'}
|
||||
return jsonify(response), 201
|
||||
except Exception as e:
|
||||
return jsonify({'message': 'Error processing request', 'error': str(e)}), 400
|
||||
return jsonify(
|
||||
{'message': 'Error processing request', 'error': str(e)}), 400
|
||||
|
||||
|
||||
@app.route('/api/db-list', methods=['GET'])
|
||||
|
|
@ -237,7 +246,9 @@ def update_server_config():
|
|||
'message': 'config updated successfully, server will restart'}
|
||||
return jsonify(response), 201
|
||||
except Exception as e:
|
||||
return jsonify({'message': 'Error processing request', 'error': str(e)}), 400
|
||||
return jsonify(
|
||||
{'message': 'Error processing request', 'error': str(e)}), 400
|
||||
|
||||
|
||||
# from flask_asgi import FlaskASGI
|
||||
# asgi_app = FlaskASGI(app)
|
||||
|
|
|
|||
76
dist/ba_root/mods/plugins/bombsquad_service.py
vendored
76
dist/ba_root/mods/plugins/bombsquad_service.py
vendored
|
|
@ -1,21 +1,21 @@
|
|||
import ecdsa
|
||||
import base64
|
||||
import json
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babaseimport babase.internal
|
||||
from stats import mystats
|
||||
from typing import Optional, Any, Dict, List, Type, Sequence
|
||||
import _thread
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
import _babase
|
||||
import setting
|
||||
import yaml
|
||||
from babase._gameactivity import GameActivity
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
from stats import mystats
|
||||
from typing import Type
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from tools import servercheck, logger, notification_manager
|
||||
import setting
|
||||
from datetime import datetime
|
||||
import _thread
|
||||
import os
|
||||
import yaml
|
||||
|
||||
stats = {}
|
||||
leaderboard = {}
|
||||
top200 = {}
|
||||
|
|
@ -30,8 +30,10 @@ class BsDataThread(object):
|
|||
stats["discord"] = "https://discord.gg/ucyaesh"
|
||||
stats["vapidKey"] = notification_manager.get_vapid_keys()["public_key"]
|
||||
|
||||
self.refresh_stats_cache_timer = bs.Timer(8, babase.Call(self.refreshStats),
|
||||
babase.TimeType.REAL, repeat=True)
|
||||
self.refresh_stats_cache_timer = bs.Timer(8, babase.Call(
|
||||
self.refreshStats),
|
||||
babase.TimeType.REAL,
|
||||
repeat=True)
|
||||
self.refresh_leaderboard_cache_timer = bs.Timer(10, babase.Call(
|
||||
self.refreshLeaderboard), babase.TimeType.REAL, repeat=True)
|
||||
|
||||
|
|
@ -59,15 +61,18 @@ class BsDataThread(object):
|
|||
for i in babase.internal.get_game_roster():
|
||||
try:
|
||||
liveplayers[i['account_id']] = {
|
||||
'name': i['players'][0]['name_full'], 'client_id': i['client_id'], 'device_id': i['display_string']}
|
||||
'name': i['players'][0]['name_full'],
|
||||
'client_id': i['client_id'],
|
||||
'device_id': i['display_string']}
|
||||
except:
|
||||
liveplayers[i['account_id']] = {
|
||||
'name': "<in-lobby>", 'client_id': i['client_id'], 'device_id': i['display_string']}
|
||||
'name': "<in-lobby>", 'client_id': i['client_id'],
|
||||
'device_id': i['display_string']}
|
||||
try:
|
||||
nextMap = babase.internal.get_foreground_host_session(
|
||||
nextMap = bs.get_foreground_host_session(
|
||||
).get_next_game_description().evaluate()
|
||||
|
||||
current_game_spec = babase.internal.get_foreground_host_session()._current_game_spec
|
||||
current_game_spec = bs.get_foreground_host_session()._current_game_spec
|
||||
gametype: Type[GameActivity] = current_game_spec['resolved_type']
|
||||
|
||||
currentMap = gametype.get_settings_display_string(
|
||||
|
|
@ -89,18 +94,20 @@ class BsDataThread(object):
|
|||
|
||||
def getTeamInfo(self):
|
||||
data = {}
|
||||
session = babase.internal.get_foreground_host_session()
|
||||
session = bs.get_foreground_host_session()
|
||||
if session:
|
||||
teams = session.sessionteams
|
||||
for team in teams:
|
||||
data[str(team.id)] = {'name': team.name if isinstance(team.name, str) else team.name.evaluate(),
|
||||
data[str(team.id)] = {'name': team.name if isinstance(team.name,
|
||||
str) else team.name.evaluate(),
|
||||
'color': list(team.color),
|
||||
'score': team.customdata['score'],
|
||||
'players': []
|
||||
}
|
||||
for player in team.players:
|
||||
teamplayer = {'name': player.getname(),
|
||||
'device_id': player.inputdevice.get_v1_account_name(True),
|
||||
'device_id': player.inputdevice.get_v1_account_name(
|
||||
True),
|
||||
'inGame': player.in_game,
|
||||
'character': player.character,
|
||||
'account_id': player.get_v1_account_id()
|
||||
|
|
@ -140,7 +147,10 @@ def get_roles():
|
|||
|
||||
def get_perks():
|
||||
# TODO wire with spaz_effects to fetch list of effects.
|
||||
return {"perks": pdata.get_custom_perks(), "availableEffects": ["spark", "glow", "fairydust", "sparkground", "sweat", "sweatground", "distortion", "shine", "highlightshine", "scorch", "ice", "iceground",
|
||||
return {"perks": pdata.get_custom_perks(),
|
||||
"availableEffects": ["spark", "glow", "fairydust", "sparkground",
|
||||
"sweat", "sweatground", "distortion", "shine",
|
||||
"highlightshine", "scorch", "ice", "iceground",
|
||||
"slime", "metal", "splinter", "rainbow"]}
|
||||
|
||||
|
||||
|
|
@ -180,7 +190,8 @@ def search_player_profile(search_key: str, db: str):
|
|||
count = 0
|
||||
for key in selectedDB.keys():
|
||||
if (search_key == key or
|
||||
any(search_key.lower() in s.lower() for s in selectedDB[key].get("display_string", [])) or
|
||||
any(search_key.lower() in s.lower() for s in
|
||||
selectedDB[key].get("display_string", [])) or
|
||||
search_key.lower() in selectedDB[key].get("name", "").lower()):
|
||||
matching_objects[key] = selectedDB[key]
|
||||
count += 1
|
||||
|
|
@ -205,14 +216,21 @@ def get_player_details(account_id: str):
|
|||
if haveBanReason:
|
||||
isBanned = True
|
||||
extra_info += " , Banned for > " + haveBanReason
|
||||
if account_id in pdata.get_blacklist()["muted-ids"] and current_time < datetime.strptime(pdata.get_blacklist()["muted-ids"][account_id]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
if account_id in pdata.get_blacklist()[
|
||||
"muted-ids"] and current_time < datetime.strptime(
|
||||
pdata.get_blacklist()["muted-ids"][account_id]["till"],
|
||||
"%Y-%m-%d %H:%M:%S"):
|
||||
isMuted = True
|
||||
extra_info += f', Muted for > {pdata.get_blacklist()["muted-ids"][account_id]["reason"]} , till > {pdata.get_blacklist()["muted-ids"][account_id]["till"]} ,'
|
||||
if account_id in pdata.get_blacklist()["kick-vote-disabled"] and current_time < datetime.strptime(pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
if account_id in pdata.get_blacklist()[
|
||||
"kick-vote-disabled"] and current_time < datetime.strptime(
|
||||
pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"],
|
||||
"%Y-%m-%d %H:%M:%S"):
|
||||
isKickVoteDisabled = True
|
||||
extra_info += f', Kick vote disabled for > {pdata.get_blacklist()["kick-vote-disabled"][account_id]["reason"]} , till > {pdata.get_blacklist()["kick-vote-disabled"][account_id]["till"]} '
|
||||
|
||||
return {"extra": extra_info, "isBan": isBanned, "isMuted": isMuted, "isKickVoteDisabled": isKickVoteDisabled}
|
||||
return {"extra": extra_info, "isBan": isBanned, "isMuted": isMuted,
|
||||
"isKickVoteDisabled": isKickVoteDisabled}
|
||||
|
||||
|
||||
def unban_player(account_id):
|
||||
|
|
@ -229,6 +247,7 @@ def enable_kick_vote(account_id):
|
|||
logger.log(f'enabling kick vote for {account_id} , request from web')
|
||||
pdata.enable_kick_vote(account_id)
|
||||
|
||||
|
||||
# TODO take duration input
|
||||
|
||||
|
||||
|
|
@ -261,7 +280,8 @@ def update_server_config(config):
|
|||
|
||||
def do_action(action, value):
|
||||
if action == "message":
|
||||
_babase.pushcall(babase.Call(_babase.chatmessage, value), from_other_thread=True)
|
||||
_babase.pushcall(babase.Call(_babase.chatmessage, value),
|
||||
from_other_thread=True)
|
||||
elif action == "quit":
|
||||
_babase.pushcall(babase.Call(_babase.quit), from_other_thread=True)
|
||||
|
||||
|
|
|
|||
37
dist/ba_root/mods/plugins/character_chooser.py
vendored
37
dist/ba_root/mods/plugins/character_chooser.py
vendored
|
|
@ -29,27 +29,19 @@ Share this plugin with your server owner /admins to use it online
|
|||
|
||||
'''
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import _babase
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
||||
|
||||
from babase._error import print_exception, print_error, NotFoundError
|
||||
|
||||
from babase._error import print_error
|
||||
from babase._language import Lstr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
from typing import Any, List, Dict, Union, Sequence, Optional
|
||||
import weakref
|
||||
import os
|
||||
import json
|
||||
from bascenev1._lobby import ChangeMessage, PlayerReadyMessage
|
||||
from bascenev1 import _lobby
|
||||
from bascenev1lib.actor.spazappearance import *
|
||||
|
|
@ -78,8 +70,10 @@ def __init__(self, vpos: float, sessionplayer: bs.SessionPlayer,
|
|||
|
||||
app = babase.app
|
||||
|
||||
self.bakwas_chars = ["Lee", "Todd McBurton", "Zola", "Butch", "Witch", "warrior",
|
||||
"Middle-Man", "Alien", "OldLady", "Gladiator", "Wrestler", "Gretel", "Robot"]
|
||||
self.bakwas_chars = ["Lee", "Todd McBurton", "Zola", "Butch", "Witch",
|
||||
"warrior",
|
||||
"Middle-Man", "Alien", "OldLady", "Gladiator",
|
||||
"Wrestler", "Gretel", "Robot"]
|
||||
|
||||
# Load available player profiles either from the local config or
|
||||
# from the remote device.
|
||||
|
|
@ -152,7 +146,6 @@ def __init__(self, vpos: float, sessionplayer: bs.SessionPlayer,
|
|||
|
||||
|
||||
def _set_ready(self, ready: bool) -> None:
|
||||
|
||||
# pylint: disable=cyclic-import
|
||||
from bauiv1lib.profile import browser as pbrowser
|
||||
from babase._general import Call
|
||||
|
|
@ -199,14 +192,18 @@ def _set_ready(self, ready: bool) -> None:
|
|||
babase.InputType.JUMP_PRESS, babase.InputType.BOMB_PRESS,
|
||||
babase.InputType.PICK_UP_PRESS), self._do_nothing)
|
||||
self._sessionplayer.assigninput(
|
||||
(babase.InputType.UP_PRESS), Call(self.handlemessage, ChangeMessage('characterchooser', -1)))
|
||||
(babase.InputType.UP_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('characterchooser', -1)))
|
||||
self._sessionplayer.assigninput(
|
||||
(babase.InputType.DOWN_PRESS), Call(self.handlemessage, ChangeMessage('characterchooser', 1)))
|
||||
(babase.InputType.DOWN_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('characterchooser', 1)))
|
||||
self._sessionplayer.assigninput(
|
||||
(babase.InputType.BOMB_PRESS), Call(self.handlemessage, ChangeMessage('ready', 0)))
|
||||
(babase.InputType.BOMB_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('ready', 0)))
|
||||
|
||||
self._sessionplayer.assigninput(
|
||||
(babase.InputType.JUMP_PRESS, babase.InputType.PICK_UP_PRESS, babase.InputType.PUNCH_PRESS),
|
||||
(babase.InputType.JUMP_PRESS, babase.InputType.PICK_UP_PRESS,
|
||||
babase.InputType.PUNCH_PRESS),
|
||||
Call(self.handlemessage, ChangeMessage('ready', 2)))
|
||||
|
||||
# Store the last profile picked by this input for reuse.
|
||||
|
|
@ -314,7 +311,8 @@ def _update_text(self) -> None:
|
|||
if self.characterchooser:
|
||||
text = Lstr(value='${A}\n${B}',
|
||||
subs=[('${A}', text),
|
||||
('${B}', Lstr(value=""+self._character_names[self._character_index]))])
|
||||
('${B}', Lstr(value="" + self._character_names[
|
||||
self._character_index]))])
|
||||
self._text_node.scale = 0.8
|
||||
else:
|
||||
text = Lstr(value='${A} (${B})',
|
||||
|
|
@ -347,6 +345,7 @@ def _update_text(self) -> None:
|
|||
|
||||
self._text_node.text = text
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
def enable():
|
||||
_lobby.Chooser.__init__ = __init__
|
||||
|
|
|
|||
9
dist/ba_root/mods/plugins/color_explosion.py
vendored
9
dist/ba_root/mods/plugins/color_explosion.py
vendored
|
|
@ -4,18 +4,17 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1lib.actor import bomb
|
||||
from bascenev1lib.actor.bomb import BombFactory
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Callable
|
||||
from typing import Sequence
|
||||
|
||||
|
||||
def new_blast_init(
|
||||
|
|
@ -233,7 +232,6 @@ def new_blast_init(
|
|||
|
||||
# TNT throws splintery chunks.
|
||||
if self.blast_type == "tnt":
|
||||
|
||||
def emit_splinters() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
|
|
@ -248,7 +246,6 @@ def new_blast_init(
|
|||
|
||||
# Every now and then do a sparky one.
|
||||
if self.blast_type == "tnt" or random.random() < 0.1:
|
||||
|
||||
def emit_extra_sparks() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
|
|
|
|||
9
dist/ba_root/mods/plugins/colorfulmaps2.py
vendored
9
dist/ba_root/mods/plugins/colorfulmaps2.py
vendored
|
|
@ -2,12 +2,11 @@
|
|||
# Just edit Config before starting server
|
||||
# by: Lirik
|
||||
# Further edited/Fixed by:Freak
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import random
|
||||
from bascenev1._map import Map
|
||||
from random import choice
|
||||
|
||||
import bascenev1 as bs
|
||||
from bascenev1._map import Map
|
||||
|
||||
CONFIGS = {
|
||||
"Radius": 2.0,
|
||||
"Blinking": False,
|
||||
|
|
|
|||
794
dist/ba_root/mods/plugins/elPatronPowerups.py
vendored
794
dist/ba_root/mods/plugins/elPatronPowerups.py
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -5,16 +5,13 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import json
|
||||
import os
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from bascenev1lib.actor.spazappearance import Appearance
|
||||
from tools.file_handle import OpenJson
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
|
@ -46,8 +43,10 @@ def register_character(name: str, char: dict) -> None:
|
|||
t.fall_sounds = char['fall_sounds']
|
||||
t.style = char['style']
|
||||
|
||||
|
||||
def enable() -> None:
|
||||
path=os.path.join(_babase.env()["python_directory_user"],"custom_characters" + os.sep)
|
||||
path = os.path.join(_babase.env()["python_directory_user"],
|
||||
"custom_characters" + os.sep)
|
||||
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
|
|
|
|||
25
dist/ba_root/mods/plugins/wavedash.py
vendored
25
dist/ba_root/mods/plugins/wavedash.py
vendored
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import math
|
||||
import bascenev1lib
|
||||
from bascenev1lib.actor.spaz import Spaz
|
||||
|
||||
|
|
@ -22,7 +22,6 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class MikiWavedashTest:
|
||||
|
||||
class FootConnectMessage:
|
||||
"""Spaz started touching the ground"""
|
||||
|
||||
|
|
@ -79,7 +78,8 @@ class MikiWavedashTest:
|
|||
# Boost itself
|
||||
pos = self.node.position
|
||||
for i in range(6):
|
||||
self.node.handlemessage('impulse', pos[0], -0.1+pos[1]+i*0.1, pos[2],
|
||||
self.node.handlemessage('impulse', pos[0],
|
||||
-0.1 + pos[1] + i * 0.1, pos[2],
|
||||
0, 0, 0,
|
||||
boost_power * turn_power,
|
||||
boost_power * turn_power, 0, 0,
|
||||
|
|
@ -87,7 +87,6 @@ class MikiWavedashTest:
|
|||
|
||||
def new_spaz_init(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
|
||||
func(*args, **kwargs)
|
||||
|
||||
# args[0] = self
|
||||
|
|
@ -96,6 +95,7 @@ class MikiWavedashTest:
|
|||
args[0].grounded = 0
|
||||
|
||||
return wrapper
|
||||
|
||||
bascenev1lib.actor.spaz.Spaz.__init__ = new_spaz_init(
|
||||
bascenev1lib.actor.spaz.Spaz.__init__)
|
||||
|
||||
|
|
@ -106,9 +106,13 @@ class MikiWavedashTest:
|
|||
args[0].roller_material.add_actions(
|
||||
conditions=('they_have_material',
|
||||
bascenev1lib.gameutils.SharedObjects.get().footing_material),
|
||||
actions=(('message', 'our_node', 'at_connect', MikiWavedashTest.FootConnectMessage),
|
||||
('message', 'our_node', 'at_disconnect', MikiWavedashTest.FootDisconnectMessage)))
|
||||
actions=(('message', 'our_node', 'at_connect',
|
||||
MikiWavedashTest.FootConnectMessage),
|
||||
('message', 'our_node', 'at_disconnect',
|
||||
MikiWavedashTest.FootDisconnectMessage)))
|
||||
|
||||
return wrapper
|
||||
|
||||
bascenev1lib.actor.spazfactory.SpazFactory.__init__ = new_factory(
|
||||
bascenev1lib.actor.spazfactory.SpazFactory.__init__)
|
||||
|
||||
|
|
@ -121,7 +125,9 @@ class MikiWavedashTest:
|
|||
args[0].grounded -= 1
|
||||
|
||||
func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
bascenev1lib.actor.spaz.Spaz.handlemessage = new_handlemessage(
|
||||
bascenev1lib.actor.spaz.Spaz.handlemessage)
|
||||
|
||||
|
|
@ -130,5 +136,8 @@ class MikiWavedashTest:
|
|||
if args[0]._last_run_value < args[1] and args[1] > 0.8:
|
||||
MikiWavedashTest.wavedash(args[0])
|
||||
func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
bascenev1lib.actor.spaz.Spaz.on_run = new_on_run(bascenev1lib.actor.spaz.Spaz.on_run)
|
||||
|
||||
bascenev1lib.actor.spaz.Spaz.on_run = new_on_run(
|
||||
bascenev1lib.actor.spaz.Spaz.on_run)
|
||||
|
|
|
|||
63
dist/ba_root/mods/port.py
vendored
63
dist/ba_root/mods/port.py
vendored
|
|
@ -1,16 +1,19 @@
|
|||
# Usage: port_7_to_8.py <plugin-name> <client/server type of mod>
|
||||
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
def port(file_path):
|
||||
with open(file_path, "rb") as fin:
|
||||
print("Porting " + os.path.basename(file_path))
|
||||
content = fin.read().decode("utf-8")
|
||||
if "# ba_meta require api 8" in content:
|
||||
return
|
||||
content = content.replace("# ba_meta require api 7", "# ba_meta require api 8")
|
||||
content = content.replace("# ba_meta export game", "# ba_meta export bascenev1.GameActivity")
|
||||
content = content.replace("# ba_meta require api 7",
|
||||
"# ba_meta require api 8")
|
||||
content = content.replace("# ba_meta export game",
|
||||
"# ba_meta export bascenev1.GameActivity")
|
||||
|
||||
content = content.replace("user_agent_string", "legacy_user_agent_string")
|
||||
content = content.replace("_ba.", "_babase.")
|
||||
|
|
@ -18,9 +21,12 @@ def port(file_path):
|
|||
content = content.replace("ba.", "babase.")
|
||||
content = content.replace("import _ba\n", "import _babase")
|
||||
content = re.sub(r'\bimport _ba\b', "import _babase", content)
|
||||
content = re.sub(r'\bimport ba(\b|\.(\w+))', "import babase\nimport bauiv1 as bui\nimport bascenev1 as bs", content)
|
||||
content = re.sub(r'\bimport ba(\b|\.(\w+))',
|
||||
"import babase\nimport bauiv1 as bui\nimport bascenev1 as bs",
|
||||
content)
|
||||
content = content.replace("babase.app.ui", "bui.app.ui_v1")
|
||||
content = content.replace("babase.app.accounts_v1", "bui.app.classic.accounts")
|
||||
content = content.replace("babase.app.accounts_v1",
|
||||
"bui.app.classic.accounts")
|
||||
|
||||
###################################################################################
|
||||
# Comment out one of these as per your requirements, depending whether to
|
||||
|
|
@ -33,29 +39,34 @@ def port(file_path):
|
|||
content = content.replace("babase.getsound", "bui.getsound")
|
||||
content = content.replace("babase.gettexture", "bui.gettexture")
|
||||
content = content.replace("babase.getmesh", "bui.getmesh")
|
||||
content = content.replace("babase.getcollisionmesh", "bui.getcollisionmesh")
|
||||
content = content.replace("babase.getcollisionmesh",
|
||||
"bui.getcollisionmesh")
|
||||
else:
|
||||
## For transmission:
|
||||
content = content.replace("babase.screenmessage", "bs.broadcastmessage")
|
||||
content = content.replace("babase.getsound", "bs.getsound")
|
||||
content = content.replace("babase.getmesh", "bs.getmesh")
|
||||
content = content.replace("babase.getcollisionmesh", "bs.getcollisionmesh")
|
||||
content = content.replace("babase.getcollisionmesh",
|
||||
"bs.getcollisionmesh")
|
||||
###################################################################################
|
||||
content = content.replace("babase.open_url", "bui.open_url")
|
||||
content = content.replace("babase.IntSetting", "bs.IntSetting")
|
||||
content = content.replace("babase.IntChoiceSetting", "bs.IntChoiceSetting")
|
||||
content = content.replace("babase.FloatChoiceSetting", "bs.FloatChoiceSetting")
|
||||
content = content.replace("babase.FloatChoiceSetting",
|
||||
"bs.FloatChoiceSetting")
|
||||
content = content.replace("babase.BoolSetting", "bs.BoolSetting")
|
||||
content = content.replace("babase.Actor", "bs.Actor")
|
||||
content = content.replace("babase.Player", "bs.Player")
|
||||
content = content.replace("babase.PlayerDiedMessage", "bs.PlayerDiedMessage")
|
||||
content = content.replace("babase.PlayerDiedMessage",
|
||||
"bs.PlayerDiedMessage")
|
||||
content = content.replace("babase.time", "bs.time")
|
||||
content = content.replace("babase.Timer", "bs.Timer")
|
||||
content = content.replace("babase.newnode", "bs.newnode")
|
||||
content = content.replace("babase.Node", "bs.Node")
|
||||
content = content.replace("babase.emitfx", "bs.emitfx")
|
||||
content = content.replace("babase.animate", "bs.animate")
|
||||
content = content.replace("babase.FreeForAllSession", "bs.FreeForAllSession")
|
||||
content = content.replace("babase.FreeForAllSession",
|
||||
"bs.FreeForAllSession")
|
||||
content = content.replace("babase.DualTeamSession", "bs.DualTeamSession")
|
||||
content = content.replace("babase.MultiTeamSession", "bs.MultiTeamSession")
|
||||
content = content.replace("babase.TeamGameActivity", "bs.TeamGameActivity")
|
||||
|
|
@ -64,7 +75,8 @@ def port(file_path):
|
|||
content = content.replace("babase.Material", "bs.Material")
|
||||
content = content.replace("babase.WeakCall", "bs.WeakCall")
|
||||
content = content.replace("babase.DieMessage", "bs.DieMessage")
|
||||
content = content.replace("babase.OutOfBoundsMessage", "bs.OutOfBoundsMessage")
|
||||
content = content.replace("babase.OutOfBoundsMessage",
|
||||
"bs.OutOfBoundsMessage")
|
||||
content = content.replace("babase.DroppedMessage", "bs.DroppedMessage")
|
||||
content = content.replace("babase.HitMessage", "bs.HitMessage")
|
||||
content = content.replace("babase.NotFoundError", "bs.NotFoundError")
|
||||
|
|
@ -101,7 +113,8 @@ def port(file_path):
|
|||
content,
|
||||
flags=re.MULTILINE
|
||||
)
|
||||
content = re.sub("babase\.playsound\((.+?), (.+?), (.+?)\)", "\\1.play(\\2, \\3)", content)
|
||||
content = re.sub("babase\.playsound\((.+?), (.+?), (.+?)\)",
|
||||
"\\1.play(\\2, \\3)", content)
|
||||
content = re.sub(
|
||||
r'babase\.playsound\(([^,\n]+),\s*position=([^,\n]+)\)',
|
||||
r'\1.play(position=\2)',
|
||||
|
|
@ -109,22 +122,30 @@ def port(file_path):
|
|||
)
|
||||
content = re.sub("babase\.playsound\((.*)\)", "\\1.play()", content)
|
||||
|
||||
content = content.replace("babase.internal.add_transaction", "bui.app.plus.add_v1_account_transaction")
|
||||
content = content.replace("babase.internal.run_transaction", "bui.app.plus.run_v1_account_transaction")
|
||||
content = content.replace("_babase.add_transaction", "bui.app.plus.add_v1_account_transaction")
|
||||
content = content.replace("_babase.run_transactions", "bui.app.plus.run_v1_account_transactions")
|
||||
content = content.replace("babase.internal.add_transaction",
|
||||
"bui.app.plus.add_v1_account_transaction")
|
||||
content = content.replace("babase.internal.run_transaction",
|
||||
"bui.app.plus.run_v1_account_transaction")
|
||||
content = content.replace("_babase.add_transaction",
|
||||
"bui.app.plus.add_v1_account_transaction")
|
||||
content = content.replace("_babase.run_transactions",
|
||||
"bui.app.plus.run_v1_account_transactions")
|
||||
content = content.replace("_babase.InputType", "babase.InputType")
|
||||
content = content.replace("bastd.ui", "bauiv1lib")
|
||||
content = content.replace("bastd", "bascenev1lib")
|
||||
content = content.replace("timetype=", "")
|
||||
content = content.replace("babase.columnwidget", "bui.columnwidget")
|
||||
content = content.replace("_babase.get_chat_messages", "bs.get_chat_messages")
|
||||
content = content.replace("_babase.get_foreground_host_session","bs.get_foreground_host_session")
|
||||
content = re.sub(r'bs\.Timer\(([^)]*)\bTimeType\.REAL\b([^)]*)\)', r'babase.AppTimer(\1\2)', content)
|
||||
content = content.replace("_babase.get_chat_messages",
|
||||
"bs.get_chat_messages")
|
||||
content = content.replace("_babase.get_foreground_host_session",
|
||||
"bs.get_foreground_host_session")
|
||||
content = re.sub(r'bs\.Timer\(([^)]*)\bTimeType\.REAL\b([^)]*)\)',
|
||||
r'babase.AppTimer(\1\2)', content)
|
||||
print("Done porting to API 8 " + os.path.basename(file_path))
|
||||
with open(file_path, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def list_python_files(directory='.'):
|
||||
python_files = []
|
||||
|
||||
|
|
@ -135,10 +156,12 @@ def list_python_files(directory='.'):
|
|||
|
||||
return python_files
|
||||
|
||||
|
||||
def start():
|
||||
current_directory = os.getcwd()
|
||||
py_files = list_python_files(current_directory)
|
||||
for file in py_files:
|
||||
port(file)
|
||||
|
||||
|
||||
start()
|
||||
|
|
|
|||
7
dist/ba_root/mods/serverData/serverdata.py
vendored
7
dist/ba_root/mods/serverData/serverdata.py
vendored
|
|
@ -1,8 +1,10 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
import fcntl
|
||||
import _babase
|
||||
import os
|
||||
|
||||
import _babase
|
||||
|
||||
clients = {}
|
||||
cachedclients = []
|
||||
muted = False
|
||||
|
|
@ -10,9 +12,8 @@ coopmode = False
|
|||
ips = {}
|
||||
recents = []
|
||||
|
||||
|
||||
SERVER_DATA_PATH = os.path.join(
|
||||
_babase.env()["python_directory_user"], "serverData" + os.sep
|
||||
_babase.env()["python_directory_user"], "serverdata" + os.sep
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
9669
dist/ba_root/mods/serverdata/Chat Logs.log2022-12-07 11%3A38%3A04.373620
vendored
Normal file
9669
dist/ba_root/mods/serverdata/Chat Logs.log2022-12-07 11%3A38%3A04.373620
vendored
Normal file
File diff suppressed because it is too large
Load diff
11008
dist/ba_root/mods/serverdata/joining.log2022-12-12 11%3A36%3A33.942405
vendored
Normal file
11008
dist/ba_root/mods/serverdata/joining.log2022-12-12 11%3A36%3A33.942405
vendored
Normal file
File diff suppressed because it is too large
Load diff
9216
dist/ba_root/mods/serverdata/logs.log2023-04-07 23%3A51%3A33.875558
vendored
Normal file
9216
dist/ba_root/mods/serverdata/logs.log2023-04-07 23%3A51%3A33.875558
vendored
Normal file
File diff suppressed because it is too large
Load diff
8
dist/ba_root/mods/setting.py
vendored
8
dist/ba_root/mods/setting.py
vendored
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import json
|
||||
from functools import lru_cache
|
||||
|
||||
import json
|
||||
import _babase
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
SETTINGS_PATH = _babase.env().get("python_directory_user", "") + "/setting.json"
|
||||
|
||||
|
||||
|
|
@ -29,11 +29,13 @@ def get_settings_data() -> dict:
|
|||
with open(SETTINGS_PATH, mode="r", encoding="utf-8") as data:
|
||||
return json.load(data)
|
||||
|
||||
|
||||
def refresh_cache() -> None:
|
||||
get_settings_data.cache_clear()
|
||||
# lets cache it again
|
||||
get_settings_data()
|
||||
|
||||
|
||||
def commit(data: dict) -> None:
|
||||
"""Commits the data in setting file.
|
||||
|
||||
|
|
|
|||
33
dist/ba_root/mods/spazmod/hitmessage.py
vendored
33
dist/ba_root/mods/spazmod/hitmessage.py
vendored
|
|
@ -1,26 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs, setting
|
||||
|
||||
from stats.mystats import damage_data
|
||||
import bascenev1 as bs
|
||||
import setting
|
||||
from bascenev1lib.actor.popuptext import PopupText
|
||||
|
||||
our_settings = setting.get_settings_data()
|
||||
|
||||
|
||||
def handle_hit(mag, pos):
|
||||
if not mag: return
|
||||
# Send Screen Texts in enabled
|
||||
if our_settings['enableHitTexts']:
|
||||
try:
|
||||
if mag >= 110: PopupText("#PRO !",color=(1,0.2,0.2),scale=1.6,position=pos).autoretain()
|
||||
elif mag >= 93 and mag < 110: PopupText("GOOD ONE!",color=(1,0.3,0.1),scale=1.6,position=pos).autoretain()
|
||||
elif mag >= 63 and mag < 93: PopupText("OH! YEAH",color=(1,0.5,0.2),scale=1.6,position=pos).autoretain()
|
||||
elif mag >= 45 and mag < 63: PopupText("WTF!",color=(0.7,0.4,0.2),scale=1.6,position=pos).autoretain()
|
||||
elif mag > 30 and mag < 45: PopupText("!!!",color=(1,1,1),scale=1.6,position=pos).autoretain()
|
||||
except: pass
|
||||
if mag >= 110:
|
||||
PopupText("#PRO !", color=(1, 0.2, 0.2), scale=1.6,
|
||||
position=pos).autoretain()
|
||||
elif mag >= 93 and mag < 110:
|
||||
PopupText("GOOD ONE!", color=(1, 0.3, 0.1), scale=1.6,
|
||||
position=pos).autoretain()
|
||||
elif mag >= 63 and mag < 93:
|
||||
PopupText("OH! YEAH", color=(1, 0.5, 0.2), scale=1.6,
|
||||
position=pos).autoretain()
|
||||
elif mag >= 45 and mag < 63:
|
||||
PopupText("WTF!", color=(0.7, 0.4, 0.2), scale=1.6,
|
||||
position=pos).autoretain()
|
||||
elif mag > 30 and mag < 45:
|
||||
PopupText("!!!", color=(1, 1, 1), scale=1.6,
|
||||
position=pos).autoretain()
|
||||
except:
|
||||
pass
|
||||
return
|
||||
|
||||
|
||||
|
|
@ -30,4 +39,6 @@ class hit_message(bs.HitMessage):
|
|||
if hit_type == "punch":
|
||||
handle_hit(kwargs['magnitude'], kwargs['pos'])
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
bs.HitMessage = hit_message
|
||||
|
|
|
|||
16
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
16
dist/ba_root/mods/spazmod/modifyspaz.py
vendored
|
|
@ -1,15 +1,15 @@
|
|||
from spazmod import tag
|
||||
import setting
|
||||
from random import randint
|
||||
from spazmod import hitmessage
|
||||
|
||||
import _babase
|
||||
import setting
|
||||
from spazmod import tag
|
||||
|
||||
import bascenev1 as bs
|
||||
_setting = setting.get_settings_data()
|
||||
|
||||
_setting = setting.get_settings_data()
|
||||
|
||||
if _setting['enableeffects']:
|
||||
from spazmod import spaz_effects
|
||||
|
||||
spaz_effects.apply()
|
||||
|
||||
|
||||
|
|
@ -25,6 +25,7 @@ def update_name():
|
|||
stat[aid]['name'] = name
|
||||
mystats.dump_stats(stat)
|
||||
|
||||
|
||||
# all activites related to modify spaz by any how will be here
|
||||
|
||||
|
||||
|
|
@ -45,11 +46,9 @@ def main(spaz, node, player):
|
|||
|
||||
|
||||
def getCharacter(player, character):
|
||||
|
||||
if _setting["sameCharacterForTeam"]:
|
||||
|
||||
if "character" in player.team.sessionteam.customdata:
|
||||
|
||||
return player.team.sessionteam.customdata["character"]
|
||||
|
||||
return character
|
||||
|
|
@ -58,7 +57,8 @@ def getCharacter(player, character):
|
|||
def getRandomCharacter(otherthen):
|
||||
characters = list(babase.app.spaz_appearances.keys())
|
||||
invalid_characters = ["Snake Shadow", "Lee", "Zola", "Butch", "Witch",
|
||||
"Middle-Man", "Alien", "OldLady", "Wrestler", "Gretel", "Robot"]
|
||||
"Middle-Man", "Alien", "OldLady", "Wrestler",
|
||||
"Gretel", "Robot"]
|
||||
|
||||
while True:
|
||||
val = randint(0, len(characters) - 1)
|
||||
|
|
|
|||
69
dist/ba_root/mods/spazmod/spaz_effects.py
vendored
69
dist/ba_root/mods/spazmod/spaz_effects.py
vendored
|
|
@ -1,15 +1,16 @@
|
|||
from bascenev1lib.actor.playerspaz import *
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import bascenev1lib
|
||||
|
||||
import functools
|
||||
import random
|
||||
from typing import List, Sequence, Optional, Dict, Any
|
||||
|
||||
import setting
|
||||
from playersData import pdata
|
||||
from stats import mystats
|
||||
from typing import Sequence
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
import bascenev1lib
|
||||
from bascenev1lib.actor.playerspaz import *
|
||||
|
||||
_settings = setting.get_settings_data()
|
||||
|
||||
RANK_EFFECT_MAP = {
|
||||
|
|
@ -18,6 +19,8 @@ RANK_EFFECT_MAP = {
|
|||
3: ["metal"],
|
||||
4: ["iceground"],
|
||||
}
|
||||
|
||||
|
||||
def effect(repeat_interval=0):
|
||||
def _activator(method):
|
||||
@functools.wraps(method)
|
||||
|
|
@ -30,9 +33,13 @@ def effect(repeat_interval=0):
|
|||
self._activations = []
|
||||
else:
|
||||
raise
|
||||
effect_activation = bs.Timer(repeat_interval, babase.Call(_caller), repeat=repeat_interval > 0)
|
||||
|
||||
effect_activation = bs.Timer(repeat_interval, babase.Call(_caller),
|
||||
repeat=repeat_interval > 0)
|
||||
self._activations.append(effect_activation)
|
||||
|
||||
return _inner_activator
|
||||
|
||||
return _activator
|
||||
|
||||
|
||||
|
|
@ -41,16 +48,21 @@ def node(check_interval=0):
|
|||
@functools.wraps(method)
|
||||
def _inner_activator(self):
|
||||
node = method(self)
|
||||
|
||||
def _caller():
|
||||
if self is None or not self.is_alive() or not self.node.exists():
|
||||
node.delete()
|
||||
self._activations = []
|
||||
node_activation = bs.Timer(check_interval, babase.Call(_caller), repeat=check_interval > 0)
|
||||
|
||||
node_activation = bs.Timer(check_interval, babase.Call(_caller),
|
||||
repeat=check_interval > 0)
|
||||
try:
|
||||
self._activations.append(node_activation)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return _inner_activator
|
||||
|
||||
return _activator
|
||||
|
||||
|
||||
|
|
@ -84,16 +96,17 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
custom_effects = pdata.get_custom()['customeffects']
|
||||
|
||||
if account_id in custom_effects:
|
||||
self.effects = [custom_effects[account_id]] if type(custom_effects[account_id]) is str else custom_effects[account_id]
|
||||
self.effects = [custom_effects[account_id]] if type(
|
||||
custom_effects[account_id]) is str else custom_effects[
|
||||
account_id]
|
||||
else:
|
||||
# check if we have any effect for his rank.
|
||||
if _settings['enablestats']:
|
||||
stats = mystats.get_cached_stats()
|
||||
if account_id in stats and _settings['enableTop5effects']:
|
||||
rank = stats[account_id]["rank"]
|
||||
self.effects = RANK_EFFECT_MAP[rank] if rank in RANK_EFFECT_MAP else []
|
||||
|
||||
|
||||
self.effects = RANK_EFFECT_MAP[
|
||||
rank] if rank in RANK_EFFECT_MAP else []
|
||||
|
||||
if len(self.effects) == 0:
|
||||
return
|
||||
|
|
@ -119,10 +132,11 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
}
|
||||
|
||||
for effect in self.effects:
|
||||
trigger = self._effect_mappings[effect] if effect in self._effect_mappings else lambda: None
|
||||
trigger = self._effect_mappings[
|
||||
effect] if effect in self._effect_mappings else lambda: None
|
||||
activity = self._activity()
|
||||
if activity:
|
||||
with babase.Context(self._activity()):
|
||||
with activity.context:
|
||||
trigger()
|
||||
|
||||
@effect(repeat_interval=0.1)
|
||||
|
|
@ -151,8 +165,10 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
@effect(repeat_interval=0.04)
|
||||
def _add_sweat(self):
|
||||
velocity = 4.0
|
||||
calculate_position = lambda torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(-velocity, velocity) + node_velocity * multiplier
|
||||
calculate_position = lambda \
|
||||
torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(
|
||||
-velocity, velocity) + node_velocity * multiplier
|
||||
position = tuple(calculate_position(coordinate)
|
||||
for coordinate in self.node.torso_position)
|
||||
velocity = (
|
||||
|
|
@ -172,8 +188,10 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
@effect(repeat_interval=0.04)
|
||||
def _add_sweatground(self):
|
||||
velocity = 1.2
|
||||
calculate_position = lambda torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(-velocity, velocity) + node_velocity * multiplier
|
||||
calculate_position = lambda \
|
||||
torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(
|
||||
-velocity, velocity) + node_velocity * multiplier
|
||||
position = tuple(calculate_position(coordinate)
|
||||
for coordinate in self.node.torso_position)
|
||||
velocity = (
|
||||
|
|
@ -228,8 +246,10 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
dim_factor = 0.90
|
||||
|
||||
default_highlight = self.node.highlight
|
||||
shiny_highlight = tuple(channel * shine_factor for channel in default_highlight)
|
||||
dimmy_highlight = tuple(channel * dim_factor for channel in default_highlight)
|
||||
shiny_highlight = tuple(
|
||||
channel * shine_factor for channel in default_highlight)
|
||||
dimmy_highlight = tuple(
|
||||
channel * dim_factor for channel in default_highlight)
|
||||
animation = {
|
||||
0: default_highlight,
|
||||
3: dimmy_highlight,
|
||||
|
|
@ -344,8 +364,10 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
@effect(repeat_interval=0.25)
|
||||
def _add_fairydust(self):
|
||||
velocity = 2
|
||||
calculate_position = lambda torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(-velocity, velocity) + node_velocity * multiplier
|
||||
calculate_position = lambda \
|
||||
torso_position: torso_position - 0.25 + random.uniform(0, 0.5)
|
||||
calculate_velocity = lambda node_velocity, multiplier: random.uniform(
|
||||
-velocity, velocity) + node_velocity * multiplier
|
||||
position = tuple(calculate_position(coordinate)
|
||||
for coordinate in self.node.torso_position)
|
||||
velocity = (
|
||||
|
|
@ -361,5 +383,6 @@ class NewPlayerSpaz(PlayerSpaz):
|
|||
emit_type="fairydust",
|
||||
)
|
||||
|
||||
|
||||
def apply() -> None:
|
||||
bascenev1lib.actor.playerspaz.PlayerSpaz = NewPlayerSpaz
|
||||
|
|
|
|||
19
dist/ba_root/mods/spazmod/tag.py
vendored
19
dist/ba_root/mods/spazmod/tag.py
vendored
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
from playersData import pdata
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import setting
|
||||
import _babase
|
||||
from playersData import pdata
|
||||
from stats import mystats
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
sett = setting.get_settings_data()
|
||||
|
||||
|
||||
|
|
@ -25,7 +24,8 @@ def addtag(node, player):
|
|||
if role in p_roles:
|
||||
tag = roles[role]['tag']
|
||||
col = (
|
||||
0.7, 0.7, 0.7) if 'tagcolor' not in roles[role] else roles[role]['tagcolor']
|
||||
0.7, 0.7, 0.7) if 'tagcolor' not in roles[role] else \
|
||||
roles[role]['tagcolor']
|
||||
break
|
||||
if tag:
|
||||
Tag(node, tag, col)
|
||||
|
|
@ -65,7 +65,6 @@ class Tag(object):
|
|||
})
|
||||
self.node.connectattr('torso_position', mnode, 'input2')
|
||||
if '\\' in tag:
|
||||
|
||||
tag = tag.replace('\\d', ('\ue048'))
|
||||
tag = tag.replace('\\c', ('\ue043'))
|
||||
tag = tag.replace('\\h', ('\ue049'))
|
||||
|
|
@ -156,7 +155,8 @@ class HitPoint(object):
|
|||
'in_world': True,
|
||||
'shadow': shad,
|
||||
'flatness': 1.0,
|
||||
'color': (1, 1, 1) if int(prefix) >= 20 else (1.0, 0.2, 0.2),
|
||||
'color': (1, 1, 1) if int(
|
||||
prefix) >= 20 else (1.0, 0.2, 0.2),
|
||||
'scale': 0.01,
|
||||
'h_align': 'center'})
|
||||
m.connectattr('output', self._Text, 'position')
|
||||
|
|
@ -164,5 +164,6 @@ class HitPoint(object):
|
|||
def a():
|
||||
self._Text.delete()
|
||||
m.delete()
|
||||
|
||||
self.timer = bs.Timer(1.2, babase.Call(
|
||||
a))
|
||||
|
|
|
|||
22
dist/ba_root/mods/stats/mystats.py
vendored
22
dist/ba_root/mods/stats/mystats.py
vendored
|
|
@ -1,13 +1,12 @@
|
|||
import setting
|
||||
import _babase
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import threading
|
||||
import datetime
|
||||
|
||||
import urllib.request
|
||||
from bascenev1._activitytypes import *
|
||||
|
||||
import _babase
|
||||
import setting
|
||||
|
||||
damage_data = {}
|
||||
|
||||
|
|
@ -16,7 +15,8 @@ top3Name = []
|
|||
|
||||
our_settings = setting.get_settings_data()
|
||||
|
||||
base_path = os.path.join(_babase.env()['python_directory_user'], "stats" + os.sep)
|
||||
base_path = os.path.join(_babase.env()['python_directory_user'],
|
||||
"stats" + os.sep)
|
||||
statsfile = base_path + 'stats.json'
|
||||
cached_stats = {}
|
||||
statsDefault = {
|
||||
|
|
@ -35,7 +35,6 @@ statsDefault = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
seasonStartDate = None
|
||||
|
||||
|
||||
|
|
@ -52,9 +51,11 @@ def get_all_stats():
|
|||
stats = jsonData["stats"]
|
||||
seasonStartDate = datetime.datetime.strptime(
|
||||
jsonData["startDate"], "%d-%m-%Y")
|
||||
_babase.season_ends_in_days = our_settings["statsResetAfterDays"] - (
|
||||
_babase.season_ends_in_days = our_settings[
|
||||
"statsResetAfterDays"] - (
|
||||
datetime.datetime.now() - seasonStartDate).days
|
||||
if (datetime.datetime.now() - seasonStartDate).days >= our_settings["statsResetAfterDays"]:
|
||||
if (datetime.datetime.now() - seasonStartDate).days >= \
|
||||
our_settings["statsResetAfterDays"]:
|
||||
backupStatsFile()
|
||||
seasonStartDate = datetime.datetime.now()
|
||||
return statsDefault
|
||||
|
|
@ -68,7 +69,8 @@ def get_all_stats():
|
|||
|
||||
def backupStatsFile():
|
||||
shutil.copy(statsfile, statsfile.replace(
|
||||
".json", "") + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + ".json")
|
||||
".json", "") + str(
|
||||
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + ".json")
|
||||
|
||||
|
||||
def dump_stats(s: dict):
|
||||
|
|
|
|||
24
dist/ba_root/mods/tools/ServerUpdate.py
vendored
24
dist/ba_root/mods/tools/ServerUpdate.py
vendored
|
|
@ -1,12 +1,14 @@
|
|||
from playersData import pdata
|
||||
import time
|
||||
import _thread
|
||||
import urllib.request
|
||||
from efro.terminal import Clr
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
import requests
|
||||
from playersData import pdata
|
||||
|
||||
import babase
|
||||
import bascenev1
|
||||
from efro.terminal import Clr
|
||||
|
||||
VERSION = 71
|
||||
|
||||
|
|
@ -42,6 +44,7 @@ def postStatus():
|
|||
'bcsversion': VERSION}
|
||||
_thread.start_new_thread(postRequest, (link, data,))
|
||||
|
||||
|
||||
def postRequest(link, data):
|
||||
print(data)
|
||||
try:
|
||||
|
|
@ -54,11 +57,13 @@ def postRequest(link, data):
|
|||
def checkSpammer(data):
|
||||
def checkMaster(data):
|
||||
try:
|
||||
res = requests.post('https://bcsservers.ballistica.workers.dev/checkspammer',
|
||||
res = requests.post(
|
||||
'https://bcsservers.ballistica.workers.dev/checkspammer',
|
||||
json=data)
|
||||
except:
|
||||
pass
|
||||
# TODO handle response and kick player based on status
|
||||
|
||||
_thread.start_new_thread(checkMaster, (data,))
|
||||
return
|
||||
|
||||
|
|
@ -80,7 +85,8 @@ def checkChangelog():
|
|||
changelog = fetchChangelogs()
|
||||
if changelog == None:
|
||||
print(
|
||||
f'{Clr.BRED} UNABLE TO CHECK UPDATES , CHECK MANUALLY FROM URL {Clr.RST}', flush=True)
|
||||
f'{Clr.BRED} UNABLE TO CHECK UPDATES , CHECK MANUALLY FROM URL {Clr.RST}',
|
||||
flush=True)
|
||||
else:
|
||||
msg = ""
|
||||
avail = False
|
||||
|
|
@ -90,9 +96,11 @@ def checkChangelog():
|
|||
|
||||
if not avail:
|
||||
print(
|
||||
f'{Clr.BGRN}{Clr.WHT} YOU ARE ON LATEST VERSION {Clr.RST}', flush=True)
|
||||
f'{Clr.BGRN}{Clr.WHT} YOU ARE ON LATEST VERSION {Clr.RST}',
|
||||
flush=True)
|
||||
else:
|
||||
print(f'{Clr.BYLW}{Clr.BLU} UPDATES AVAILABLE {Clr.RST}', flush=True)
|
||||
print(f'{Clr.BYLW}{Clr.BLU} UPDATES AVAILABLE {Clr.RST}',
|
||||
flush=True)
|
||||
for log in changelog:
|
||||
if int(log) > VERSION:
|
||||
msg = changelog[log]["time"]
|
||||
|
|
|
|||
34
dist/ba_root/mods/tools/account.py
vendored
34
dist/ba_root/mods/tools/account.py
vendored
|
|
@ -1,13 +1,15 @@
|
|||
# ba_meta require api 8
|
||||
from __future__ import annotations
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import logging
|
||||
from efro.error import CommunicationError
|
||||
from playersData import pdata
|
||||
|
||||
import _bascenev1
|
||||
from playersdata import pdata
|
||||
|
||||
import babase
|
||||
import bacommon.cloud
|
||||
import bascenev1 as bs
|
||||
import bauiv1 as bui
|
||||
|
||||
STATUS_CHECK_INTERVAL_SECONDS = 2.0
|
||||
|
||||
|
|
@ -16,17 +18,21 @@ class AccountUtil:
|
|||
def __init__(self):
|
||||
self._proxyid: str | None = None
|
||||
self._proxykey: str | None = None
|
||||
bs.sign_out_v1()
|
||||
babase.app.cloud.send_message_cb(bacommon.cloud.LoginProxyRequestMessage(),
|
||||
plus = bui.app.plus
|
||||
plus.sign_out_v1()
|
||||
babase.app.cloud.send_message_cb(
|
||||
bacommon.cloud.LoginProxyRequestMessage(),
|
||||
on_response=babase.Call(self._on_proxy_request_response))
|
||||
|
||||
def _on_proxy_request_response(self, response: bacommon.cloud.LoginProxyRequestResponse | Exception) -> None:
|
||||
def _on_proxy_request_response(self,
|
||||
response: bacommon.cloud.LoginProxyRequestResponse | Exception) -> None:
|
||||
plus = bui.app.plus
|
||||
if isinstance(response, Exception):
|
||||
logging.error("error occured")
|
||||
logging.critical("Falling back to V1 account")
|
||||
bs.sign_in_v1('Local')
|
||||
plus.sign_in_v1('Local')
|
||||
return
|
||||
address = bs.get_master_server_address(
|
||||
address = plus.get_master_server_address(
|
||||
version=2) + response.url
|
||||
logging.debug("Copy this URL to your browser : " + address)
|
||||
self._proxyid = response.proxyid
|
||||
|
|
@ -47,11 +53,12 @@ class AccountUtil:
|
|||
) -> None:
|
||||
# For now, if anything goes wrong on the server-side, just abort
|
||||
# with a vague error message. Can be more verbose later if need be.
|
||||
plus = bui.app.plus
|
||||
if (isinstance(response, bacommon.cloud.LoginProxyStateQueryResponse)
|
||||
and response.state is response.State.FAIL):
|
||||
logging.error("error occured ..terminating login request")
|
||||
logging.critical("Falling back to V1 account")
|
||||
bs.sign_in_v1('Local')
|
||||
plus.sign_in_v1('Local')
|
||||
|
||||
# If we got a token, set ourself as signed in. Hooray!
|
||||
if (isinstance(response, bacommon.cloud.LoginProxyStateQueryResponse)
|
||||
|
|
@ -70,8 +77,9 @@ class AccountUtil:
|
|||
babase.Call(self._ask_for_status))
|
||||
|
||||
def _logged_in(self):
|
||||
plus = bui.app.plus
|
||||
logging.info("Logged in as: " +
|
||||
bs.get_v1_account_display_string())
|
||||
plus.get_v1_account_display_string())
|
||||
|
||||
|
||||
def updateOwnerIps():
|
||||
|
|
@ -84,4 +92,4 @@ def updateOwnerIps():
|
|||
profile = profiles[account_id]
|
||||
if "lastIP" in profile:
|
||||
ip = profile["lastIP"]
|
||||
_babase.append_owner_ip(ip)
|
||||
_bascenev1.append_owner_ip(ip)
|
||||
|
|
|
|||
5
dist/ba_root/mods/tools/corelib.py
vendored
5
dist/ba_root/mods/tools/corelib.py
vendored
|
|
@ -1,5 +1,8 @@
|
|||
import bascenev1
|
||||
import _babase
|
||||
|
||||
import bascenev1
|
||||
|
||||
|
||||
def set_speed(x):
|
||||
try:
|
||||
activity = bascenev1.get_foreground_host_activity()
|
||||
|
|
|
|||
BIN
dist/ba_root/mods/tools/corelib.so
vendored
BIN
dist/ba_root/mods/tools/corelib.so
vendored
Binary file not shown.
6
dist/ba_root/mods/tools/file_handle.py
vendored
6
dist/ba_root/mods/tools/file_handle.py
vendored
|
|
@ -8,15 +8,13 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["OpenJson", "JsonFile", "PathNotExistsError"]
|
||||
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from dataclasses import dataclass
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
from filelock import FileLock
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
|
|
|||
20
dist/ba_root/mods/tools/healthcheck.py
vendored
20
dist/ba_root/mods/tools/healthcheck.py
vendored
|
|
@ -3,14 +3,13 @@ Simple utility to monitor current CPU,Network,RAM usage.
|
|||
|
||||
Author: ChatGpt
|
||||
"""
|
||||
import asyncio
|
||||
from threading import Thread
|
||||
|
||||
import psutil
|
||||
|
||||
from . import logger
|
||||
|
||||
import asyncio
|
||||
import psutil
|
||||
|
||||
from threading import Thread
|
||||
|
||||
async def monitor_network():
|
||||
elapsed_time = 60
|
||||
|
|
@ -24,20 +23,23 @@ async def monitor_network():
|
|||
|
||||
# Calculate the upload and download speeds in bytes/sec
|
||||
# seconds
|
||||
upload_speed = (net_io_counters.bytes_sent - monitor_network.bytes_sent) / elapsed_time
|
||||
download_speed = (net_io_counters.bytes_recv - monitor_network.bytes_recv) / elapsed_time
|
||||
|
||||
upload_speed = (
|
||||
net_io_counters.bytes_sent - monitor_network.bytes_sent) / elapsed_time
|
||||
download_speed = (
|
||||
net_io_counters.bytes_recv - monitor_network.bytes_recv) / elapsed_time
|
||||
|
||||
# Convert the speeds to human-readable format
|
||||
upload_speed = f"{upload_speed / 1024:.2f} KB/s"
|
||||
download_speed = f"{download_speed / 1024:.2f} KB/s"
|
||||
|
||||
logger.log(f"CPU: {psutil.cpu_percent()}% RAM: {psutil.virtual_memory().percent}% Upload: {upload_speed} Download: {download_speed}")
|
||||
logger.log(
|
||||
f"CPU: {psutil.cpu_percent()}% RAM: {psutil.virtual_memory().percent}% Upload: {upload_speed} Download: {download_speed}")
|
||||
|
||||
# Update the counters
|
||||
monitor_network.bytes_sent = net_io_counters.bytes_sent
|
||||
monitor_network.bytes_recv = net_io_counters.bytes_recv
|
||||
|
||||
|
||||
async def reset_counters():
|
||||
while True:
|
||||
# Wait for 2+2 minutes
|
||||
|
|
@ -46,6 +48,7 @@ async def reset_counters():
|
|||
# Reset the network counters for each network interface separately
|
||||
psutil.net_io_counters(pernic=True)
|
||||
|
||||
|
||||
def main():
|
||||
# Initialize the counters
|
||||
net_io_counters = psutil.net_io_counters()
|
||||
|
|
@ -62,4 +65,3 @@ def main():
|
|||
# Schedule the coroutines in the event loop
|
||||
asyncio.run_coroutine_threadsafe(monitor_network(), loop=loop)
|
||||
asyncio.run_coroutine_threadsafe(reset_counters(), loop=loop)
|
||||
|
||||
|
|
|
|||
26
dist/ba_root/mods/tools/logger.py
vendored
26
dist/ba_root/mods/tools/logger.py
vendored
|
|
@ -4,30 +4,29 @@
|
|||
# (see https://ballistica.net/wiki/meta-tag-system)
|
||||
|
||||
from __future__ import annotations
|
||||
import requests
|
||||
import time
|
||||
import json
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import os
|
||||
import datetime
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import threading
|
||||
import setting
|
||||
import time
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import _babase
|
||||
import fcntl
|
||||
import requests
|
||||
import setting
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
SETTINGS = setting.get_settings_data()
|
||||
SERVER_DATA_PATH = os.path.join(
|
||||
_babase.env()["python_directory_user"], "serverData" + os.sep
|
||||
_babase.env()["python_directory_user"], "serverdata" + os.sep
|
||||
)
|
||||
|
||||
|
||||
if SETTINGS["discordbot"]["enable"]:
|
||||
from features import discord_bot
|
||||
|
||||
|
|
@ -107,7 +106,8 @@ class dumplogs(threading.Thread):
|
|||
if os.path.exists(log_path):
|
||||
if os.stat(log_path).st_size > 1000000:
|
||||
self.copy_file(
|
||||
log_path, log_path+str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
|
||||
log_path, log_path + str(
|
||||
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
|
||||
|
||||
self.write_file(log_path, self.msg)
|
||||
|
||||
|
|
|
|||
39
dist/ba_root/mods/tools/notification_manager.py
vendored
39
dist/ba_root/mods/tools/notification_manager.py
vendored
|
|
@ -1,19 +1,20 @@
|
|||
import time
|
||||
import shutil
|
||||
import random
|
||||
import string
|
||||
|
||||
import json
|
||||
import base64
|
||||
import ecdsa
|
||||
import json
|
||||
import os
|
||||
import _babase
|
||||
import random
|
||||
import shutil
|
||||
import string
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import _babase
|
||||
import ecdsa
|
||||
|
||||
vapidkeys = {}
|
||||
subscriptions = {}
|
||||
subscribed_players = {}
|
||||
PLAYERS_DATA_PATH = os.path.join(
|
||||
_babase.env()["python_directory_user"], "playersData" + os.sep
|
||||
_babase.env()["python_directory_user"], "playersdata" + os.sep
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -30,8 +31,10 @@ def get_vapid_keys():
|
|||
pk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)
|
||||
vk = pk.get_verifying_key()
|
||||
vapidkeys = {
|
||||
'private_key': base64.urlsafe_b64encode(pk.to_string()).rstrip(b'=').decode('utf-8'),
|
||||
'public_key': base64.urlsafe_b64encode(b'\x04' + vk.to_string()).rstrip(b'=').decode('utf-8')
|
||||
'private_key': base64.urlsafe_b64encode(pk.to_string()).rstrip(
|
||||
b'=').decode('utf-8'),
|
||||
'public_key': base64.urlsafe_b64encode(
|
||||
b'\x04' + vk.to_string()).rstrip(b'=').decode('utf-8')
|
||||
}
|
||||
f = open(".keys", "w")
|
||||
json.dump(vapidkeys, f)
|
||||
|
|
@ -45,7 +48,8 @@ def send_push_notification(subscription, payload):
|
|||
# Send the push notification using the subscription and payload
|
||||
|
||||
webpush(subscription_info=subscription, data=json.dumps(payload),
|
||||
vapid_private_key=get_vapid_keys()["private_key"], vapid_claims={
|
||||
vapid_private_key=get_vapid_keys()["private_key"],
|
||||
vapid_claims={
|
||||
'sub': 'mailto:{}'.format("test@ballistica.net"),
|
||||
})
|
||||
print("Push notification sent successfully")
|
||||
|
|
@ -74,7 +78,6 @@ def generate_random_string(length):
|
|||
|
||||
|
||||
def subscribe(sub, account_id, name):
|
||||
|
||||
id = get_subscriber_id(sub)
|
||||
if account_id in subscribed_players:
|
||||
if id not in subscribed_players[account_id]["subscribers"]:
|
||||
|
|
@ -89,7 +92,9 @@ def subscribe(sub, account_id, name):
|
|||
def player_joined(pb_id):
|
||||
now = datetime.now()
|
||||
if pb_id in subscribed_players:
|
||||
if "last_notification" in subscribed_players[pb_id] and (now - subscribed_players[pb_id]["last_notification"]).seconds < 15 * 60:
|
||||
if "last_notification" in subscribed_players[pb_id] and (
|
||||
now - subscribed_players[pb_id][
|
||||
"last_notification"]).seconds < 15 * 60:
|
||||
pass
|
||||
else:
|
||||
subscribed_players[pb_id]["last_notification"] = now
|
||||
|
|
@ -104,8 +109,10 @@ def player_joined(pb_id):
|
|||
"icon": "assets/icons/icon-96x96.png",
|
||||
"vibrate": [100, 50, 100],
|
||||
"requireInteraction": True,
|
||||
"data": {"dateOfArrival": datetime.now().strftime("%Y-%m-%d %H:%M:%S")},
|
||||
"actions": [{"action": "nothing", "title": "Launch Bombsquad"}],
|
||||
"data": {"dateOfArrival": datetime.now().strftime(
|
||||
"%Y-%m-%d %H:%M:%S")},
|
||||
"actions": [{"action": "nothing",
|
||||
"title": "Launch Bombsquad"}],
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
38
dist/ba_root/mods/tools/playlist.py
vendored
38
dist/ba_root/mods/tools/playlist.py
vendored
|
|
@ -2,24 +2,28 @@
|
|||
|
||||
# Thanks to Rikko for playlist fetch by code
|
||||
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _thread
|
||||
import time
|
||||
|
||||
import _babase
|
||||
import setting
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
import bauiv1 as bui
|
||||
from babase._general import Call
|
||||
from bascenev1._coopsession import CoopSession
|
||||
from bascenev1._dualteamsession import DualTeamSession
|
||||
# session change by smoothy
|
||||
from bascenev1._freeforallsession import FreeForAllSession
|
||||
from bascenev1._dualteamsession import DualTeamSession
|
||||
from bascenev1._coopsession import CoopSession
|
||||
|
||||
import time
|
||||
import _thread
|
||||
import setting
|
||||
from babase._general import Call
|
||||
settings = setting.get_settings_data()
|
||||
|
||||
_babase.app.classic.coop_session_args['max_players'] = 14
|
||||
_babase.app.classic.coop_session_args['campaign'] = "Default"
|
||||
_babase.app.classic.coop_session_args['level'] = "Onslaught Training"
|
||||
|
||||
|
||||
def set_playlist(content):
|
||||
if content is None:
|
||||
return
|
||||
|
|
@ -36,20 +40,24 @@ def set_playlist(content):
|
|||
def set_playlist_inline(playlist, newPLaylistType):
|
||||
session = bs.get_foreground_host_session()
|
||||
|
||||
if (isinstance(session,DualTeamSession) or isinstance(session,CoopSession)) and newPLaylistType=='ffa':
|
||||
if (isinstance(session, DualTeamSession) or isinstance(session,
|
||||
CoopSession)) and newPLaylistType == 'ffa':
|
||||
bs.get_foreground_host_session().end()
|
||||
_thread.start_new_thread(withDelay, (FreeForAllSession, playlist,))
|
||||
elif (isinstance(session,FreeForAllSession) or isinstance(session,CoopSession))and newPLaylistType=="teams":
|
||||
elif (isinstance(session, FreeForAllSession) or isinstance(session,
|
||||
CoopSession)) and newPLaylistType == "teams":
|
||||
bs.get_foreground_host_session().end()
|
||||
_thread.start_new_thread(withDelay, (DualTeamSession, playlist,))
|
||||
else:
|
||||
updatePlaylist(playlist)
|
||||
|
||||
def withDelay(session,playlist):
|
||||
|
||||
def withDelay(session, playlist):
|
||||
time.sleep(1)
|
||||
|
||||
_babase.pushcall(Call(updateSession,session,playlist),from_other_thread=True)
|
||||
_babase.pushcall(Call(updateSession, session, playlist),
|
||||
from_other_thread=True)
|
||||
|
||||
|
||||
def updateSession(session, playlist):
|
||||
bs.new_host_session(session)
|
||||
|
|
@ -58,7 +66,6 @@ def updateSession(session,playlist):
|
|||
|
||||
|
||||
def updatePlaylist(playlist):
|
||||
|
||||
session = bs.get_foreground_host_session()
|
||||
content = babase._playlist.filter_playlist(
|
||||
playlist,
|
||||
|
|
@ -69,6 +76,7 @@ def updatePlaylist(playlist):
|
|||
session._playlist = playlist
|
||||
set_next_map(session, playlist.pull_next())
|
||||
|
||||
|
||||
def set_next_map(session, game_map):
|
||||
session._next_game_spec = game_map
|
||||
with babase.Context(session):
|
||||
|
|
@ -86,8 +94,6 @@ def playlist(code):
|
|||
bui.app.plus.run_v1_account_transactions()
|
||||
|
||||
|
||||
|
||||
|
||||
def setPlaylist(para):
|
||||
if para.isdigit():
|
||||
playlist(para)
|
||||
|
|
|
|||
94
dist/ba_root/mods/tools/servercheck.py
vendored
94
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -1,24 +1,25 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
|
||||
from serverData import serverdata
|
||||
from playersData import pdata
|
||||
import _babase
|
||||
import urllib.request
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
import time
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _bascenev1
|
||||
from babase._general import Call
|
||||
import threading
|
||||
import setting
|
||||
import _thread
|
||||
from tools import logger
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
import urllib.request
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import _babase
|
||||
import _bascenev1
|
||||
import setting
|
||||
from features import profanity
|
||||
from playersData import pdata
|
||||
from serverData import serverdata
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
from babase._general import Call
|
||||
from tools import logger
|
||||
|
||||
blacklist = pdata.get_blacklist()
|
||||
|
||||
settings = setting.get_settings_data()
|
||||
|
|
@ -38,18 +39,23 @@ class checkserver(object):
|
|||
deviceClientMap = {}
|
||||
for ros in bs.get_game_roster():
|
||||
ip = _bascenev1.get_client_ip(ros["client_id"])
|
||||
device_id = _bascenev1.get_client_public_device_uuid(ros["client_id"])
|
||||
device_id = _bascenev1.get_client_public_device_uuid(
|
||||
ros["client_id"])
|
||||
if (device_id == None):
|
||||
device_id = _bascenev1.get_client_device_uuid(ros["client_id"])
|
||||
if device_id not in deviceClientMap:
|
||||
deviceClientMap[device_id] = [ros["client_id"]]
|
||||
else:
|
||||
deviceClientMap[device_id].append(ros["client_id"])
|
||||
if len(deviceClientMap[device_id]) >= settings['maxAccountPerIP']:
|
||||
bs.chatmessage(f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.", clients=[
|
||||
if len(deviceClientMap[device_id]) >= settings[
|
||||
'maxAccountPerIP']:
|
||||
bs.chatmessage(
|
||||
f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.",
|
||||
clients=[
|
||||
ros["client_id"]])
|
||||
bs.disconnect_client(ros["client_id"])
|
||||
logger.log(f'Player disconnected, reached max players per device || {ros["account_id"]}',
|
||||
logger.log(
|
||||
f'Player disconnected, reached max players per device || {ros["account_id"]}',
|
||||
"playerjoin")
|
||||
continue
|
||||
if ip not in ipClientMap:
|
||||
|
|
@ -57,10 +63,13 @@ class checkserver(object):
|
|||
else:
|
||||
ipClientMap[ip].append(ros["client_id"])
|
||||
if len(ipClientMap[ip]) >= settings['maxAccountPerIP']:
|
||||
_babase.chatmessage(f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.", clients=[
|
||||
_babase.chatmessage(
|
||||
f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.",
|
||||
clients=[
|
||||
ros["client_id"]])
|
||||
bs.disconnect_client(ros["client_id"])
|
||||
logger.log(f'Player disconnected, reached max players per IP address || {ros["account_id"]}',
|
||||
logger.log(
|
||||
f'Player disconnected, reached max players per IP address || {ros["account_id"]}',
|
||||
"playerjoin")
|
||||
continue
|
||||
newPlayers.append(ros['account_id'])
|
||||
|
|
@ -83,7 +92,8 @@ class checkserver(object):
|
|||
color=(1, 0, 0), transient=True,
|
||||
clients=[ros['client_id']])
|
||||
try:
|
||||
logger.log(f'{d_str} || { ros["account_id"] } || kicked by profanity check',
|
||||
logger.log(
|
||||
f'{d_str} || {ros["account_id"]} || kicked by profanity check',
|
||||
"sys")
|
||||
except:
|
||||
pass
|
||||
|
|
@ -105,7 +115,8 @@ class checkserver(object):
|
|||
if ros['account_id'] in serverdata.clients:
|
||||
on_player_join_server(ros['account_id'],
|
||||
serverdata.clients[
|
||||
ros['account_id']], ip, device_id)
|
||||
ros['account_id']], ip,
|
||||
device_id)
|
||||
else:
|
||||
# from local cache, then call on_player_join_server
|
||||
LoadProfile(ros['account_id'], ip, device_id).start()
|
||||
|
|
@ -129,7 +140,8 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
|||
if now - lastjoin < 15:
|
||||
joincount += 1
|
||||
if joincount > 2:
|
||||
_bs.broadcastmessage("Joining too fast , slow down dude", # its not possible now tho, network layer will catch it before reaching here
|
||||
_bs.broadcastmessage("Joining too fast , slow down dude",
|
||||
# its not possible now tho, network layer will catch it before reaching here
|
||||
color=(1, 0, 1), transient=True,
|
||||
clients=[clid])
|
||||
logger.log(f'{pbid} || kicked for joining too fast')
|
||||
|
|
@ -152,7 +164,8 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
|||
serverdata.recents = serverdata.recents[-20:]
|
||||
if check_ban(ip, device_id, pbid):
|
||||
_babase.chatmessage(
|
||||
'sad ,your account is flagged contact server owner for unban', clients=[clid])
|
||||
'sad ,your account is flagged contact server owner for unban',
|
||||
clients=[clid])
|
||||
bs.disconnect_client(clid)
|
||||
return
|
||||
if get_account_age(player_data["accountAge"]) < \
|
||||
|
|
@ -177,7 +190,10 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
|||
serverdata.clients[pbid]["verified"] = False
|
||||
serverdata.clients[pbid]["rejoincount"] = 1
|
||||
serverdata.clients[pbid]["lastJoin"] = time.time()
|
||||
if pbid in blacklist["kick-vote-disabled"] and current_time < datetime.strptime(blacklist["kick-vote-disabled"][pbid]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
if pbid in blacklist[
|
||||
"kick-vote-disabled"] and current_time < datetime.strptime(
|
||||
blacklist["kick-vote-disabled"][pbid]["till"],
|
||||
"%Y-%m-%d %H:%M:%S"):
|
||||
_babase.disable_kickvote(pbid)
|
||||
|
||||
serverdata.clients[pbid]["lastIP"] = ip
|
||||
|
|
@ -189,7 +205,8 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
|||
verify_account(pbid, player_data) # checked for spoofed ids
|
||||
logger.log(
|
||||
f'{pbid} ip: {serverdata.clients[pbid]["lastIP"]} , Device id: {device_id}')
|
||||
bs.broadcastmessage(settings["regularWelcomeMsg"] + " " + device_string,
|
||||
bs.broadcastmessage(
|
||||
settings["regularWelcomeMsg"] + " " + device_string,
|
||||
color=(0.60, 0.8, 0.6), transient=True,
|
||||
clients=[clid])
|
||||
if (settings["ballistica_web"]["enable"]):
|
||||
|
|
@ -217,20 +234,24 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
|||
def check_ban(ip, device_id, pbid, log=True):
|
||||
current_time = datetime.now()
|
||||
|
||||
if ip in blacklist["ban"]['ips'] and current_time < datetime.strptime(blacklist["ban"]["ips"][ip]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
if ip in blacklist["ban"]['ips'] and current_time < datetime.strptime(
|
||||
blacklist["ban"]["ips"][ip]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
msg = f' reason: matched IP | {blacklist["ban"]["ips"][ip]["reason"]} , Till : {blacklist["ban"]["ips"][ip]["till"]}'
|
||||
if log:
|
||||
logger.log(f'{pbid} | kicked > {msg}')
|
||||
return True
|
||||
return msg
|
||||
elif device_id in blacklist["ban"]["deviceids"] and current_time < datetime.strptime(blacklist["ban"]["deviceids"][device_id]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
elif device_id in blacklist["ban"][
|
||||
"deviceids"] and current_time < datetime.strptime(
|
||||
blacklist["ban"]["deviceids"][device_id]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
msg = f'reason: matched deviceId | {blacklist["ban"]["deviceids"][device_id]["reason"]}, Till : {blacklist["ban"]["deviceids"][device_id]["till"]}'
|
||||
if log:
|
||||
logger.log(
|
||||
f'{pbid} | kicked > {msg}')
|
||||
return True
|
||||
return msg
|
||||
elif pbid in blacklist["ban"]["ids"] and current_time < datetime.strptime(blacklist["ban"]["ids"][pbid]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
elif pbid in blacklist["ban"]["ids"] and current_time < datetime.strptime(
|
||||
blacklist["ban"]["ids"][pbid]["till"], "%Y-%m-%d %H:%M:%S"):
|
||||
msg = f'reason: matched ID | {blacklist["ban"]["ids"][pbid]["reason"]} , Till : {blacklist["ban"]["ids"][pbid]["till"]}'
|
||||
if log:
|
||||
logger.log(
|
||||
|
|
@ -319,7 +340,9 @@ class LoadProfile(threading.Thread):
|
|||
|
||||
def run(self):
|
||||
player_data = pdata.get_info(self.pbid)
|
||||
_babase.pushcall(Call(on_player_join_server, self.pbid, player_data, self.ip, self.device_id),
|
||||
_babase.pushcall(
|
||||
Call(on_player_join_server, self.pbid, player_data, self.ip,
|
||||
self.device_id),
|
||||
from_other_thread=True)
|
||||
|
||||
|
||||
|
|
@ -356,7 +379,8 @@ def save_age(age, pb_id, display_string):
|
|||
if get_account_age(age) < settings["minAgeToJoinInHours"]:
|
||||
msg = "New Accounts not allowed to play here , come back tmrw."
|
||||
logger.log(pb_id + "|| kicked > new account")
|
||||
_babase.pushcall(Call(kick_by_pb_id, pb_id, msg), from_other_thread=True)
|
||||
_babase.pushcall(Call(kick_by_pb_id, pb_id, msg),
|
||||
from_other_thread=True)
|
||||
|
||||
|
||||
def save_ids(ids, pb_id, display_string):
|
||||
|
|
@ -364,7 +388,8 @@ def save_ids(ids, pb_id, display_string):
|
|||
|
||||
if display_string not in ids:
|
||||
msg = "Spoofed Id detected , Goodbye"
|
||||
_babase.pushcall(Call(kick_by_pb_id, pb_id, msg), from_other_thread=True)
|
||||
_babase.pushcall(Call(kick_by_pb_id, pb_id, msg),
|
||||
from_other_thread=True)
|
||||
serverdata.clients[pb_id]["verified"] = False
|
||||
logger.log(
|
||||
pb_id + "|| kicked , for using spoofed id " + display_string)
|
||||
|
|
@ -375,7 +400,8 @@ def save_ids(ids, pb_id, display_string):
|
|||
def kick_by_pb_id(pb_id, msg):
|
||||
for ros in bs.get_game_roster():
|
||||
if ros['account_id'] == pb_id:
|
||||
_bs.broadcastmessage(msg, transient=True, clients=[ros['client_id']])
|
||||
_bs.broadcastmessage(msg, transient=True,
|
||||
clients=[ros['client_id']])
|
||||
bs.disconnect_client(ros['client_id'])
|
||||
|
||||
|
||||
|
|
|
|||
26
dist/ba_root/mods/tools/servercontroller.py
vendored
26
dist/ba_root/mods/tools/servercontroller.py
vendored
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
from typing import TYPE_CHECKING
|
||||
from efro.terminal import Clr
|
||||
import _babase
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import bascenev1 as bs
|
||||
from efro.terminal import Clr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
pass
|
||||
|
||||
|
||||
def _access_check_response(self, data) -> None:
|
||||
|
||||
if data is None:
|
||||
print('error on UDP port access check (internet down?)')
|
||||
else:
|
||||
|
|
@ -21,7 +21,8 @@ def _access_check_response(self, data) -> None:
|
|||
_babase.our_port = port
|
||||
if data['accessible']:
|
||||
# _fetch_public_servers()
|
||||
_babase.queue_chcker_timer = bs.AppTimer(8, babase.Call(simple_queue_checker), repeat=True)
|
||||
_babase.queue_chcker_timer = bs.AppTimer(8, babase.Call(
|
||||
simple_queue_checker), repeat=True)
|
||||
print(
|
||||
f'{Clr.SBLU}Master server access check of{addrstr}'
|
||||
f' udp port {port} succeeded.\n'
|
||||
|
|
@ -58,6 +59,7 @@ def _fetch_public_servers():
|
|||
)
|
||||
bui.app.plus.run_v1_account_transactions()
|
||||
|
||||
|
||||
def _on_public_party_response(result):
|
||||
if result is None:
|
||||
return
|
||||
|
|
@ -73,9 +75,12 @@ def _on_public_party_response(result):
|
|||
# aah sad , public party result dont include our own server
|
||||
if queue_id:
|
||||
_babase.our_queue_id = queue_id
|
||||
_babase.queue_chcker_timer = bs.timer(6, babase.Call(check_queue), repeat=True)
|
||||
_babase.queue_chcker_timer = bs.timer(6, babase.Call(check_queue),
|
||||
repeat=True)
|
||||
else:
|
||||
print("Something is wrong , why our server is not in public list.")
|
||||
|
||||
|
||||
def check_queue():
|
||||
bui.app.plus.add_v1_account_transaction(
|
||||
{'type': 'PARTY_QUEUE_QUERY', 'q': _babase.our_queue_id},
|
||||
|
|
@ -88,6 +93,7 @@ def check_queue():
|
|||
)
|
||||
bui.app.plus.run_v1_account_transactions()
|
||||
|
||||
|
||||
def on_update_response(response):
|
||||
allowed_to_join = response["c"]
|
||||
players_in_queue = response["e"]
|
||||
|
|
@ -98,10 +104,12 @@ def on_update_response(response):
|
|||
# looks good , yipee
|
||||
_babase.set_public_party_queue_enabled(True)
|
||||
return
|
||||
if not allowed_to_join and len(players_in_queue) > 1 and current_players < max_allowed_in_server:
|
||||
if not allowed_to_join and len(
|
||||
players_in_queue) > 1 and current_players < max_allowed_in_server:
|
||||
# something is wrong , lets disable queue for some time
|
||||
_babase.set_public_party_queue_enabled(False)
|
||||
|
||||
|
||||
def simple_queue_checker():
|
||||
max_allowed_in_server = _babase.app.server._config.max_party_size
|
||||
current_players = len(_babase.get_game_roster())
|
||||
|
|
@ -110,5 +118,3 @@ def simple_queue_checker():
|
|||
_babase.set_public_party_queue_enabled(False)
|
||||
else:
|
||||
_babase.set_public_party_queue_enabled(True)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue