mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
bug fix , v2 account , node.changerotation, _ba.enable_2d_mode
This commit is contained in:
parent
b110f8a12a
commit
66df21cd2e
12 changed files with 366 additions and 92 deletions
2
dist/ba_data/python/ba/_meta.py
vendored
2
dist/ba_data/python/ba/_meta.py
vendored
|
|
@ -305,7 +305,7 @@ class DirectoryScan:
|
|||
|
||||
# If we find a module requiring a different api version, warn
|
||||
# and ignore.
|
||||
if required_api is not None and required_api <= CURRENT_API_VERSION:
|
||||
if required_api is not None and required_api < CURRENT_API_VERSION:
|
||||
self.results.warnings += (
|
||||
f'Warning: {subpath} requires api {required_api} but'
|
||||
f' we are running {CURRENT_API_VERSION}; ignoring module.')
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ def QuickAccess(msg, client_id):
|
|||
name = i.getname(True)
|
||||
|
||||
for i in ba.internal.get_foreground_host_session().sessionplayers:
|
||||
if i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
||||
if hasattr(i, 'sessionteam') and i.sessionteam and teamid == i.sessionteam.id and i.inputdevice.client_id != client_id:
|
||||
_ba.screenmessage(name + ":" + msg[1:], clients=[i.inputdevice.client_id],
|
||||
color=(0.3, 0.6, 0.3), transient=True)
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ def QuickAccess(msg, client_id):
|
|||
return None
|
||||
msgAr.insert(int(len(msgAr) / 2), "\n")
|
||||
for player in _ba.get_foreground_host_activity().players:
|
||||
if player.sessionplayer.inputdevice.client_id == client_id:
|
||||
if player.sessionplayer.inputdevice.client_id == client_id and player.actor.exists() and hasattr(player.actor.node,"position"):
|
||||
pos = player.actor.node.position
|
||||
with _ba.Context(_ba.get_foreground_host_activity()):
|
||||
popuptext.PopupText(" ".join(msgAr), (pos[0], pos[1] + 1, pos[2])).autoretain()
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ def invi(arguments):
|
|||
activity = _ba.get_foreground_host_activity()
|
||||
|
||||
for i in activity.players:
|
||||
if i.actor.exists() and i.actor.node.torso_model != None:
|
||||
body = i.actor.node
|
||||
if body.torso_model != None:
|
||||
body.head_model = None
|
||||
body.torso_model = None
|
||||
body.upper_arm_model = None
|
||||
|
|
|
|||
|
|
@ -17,11 +17,9 @@ def send(msg, clientid):
|
|||
def clientid_to_myself(clientid):
|
||||
"""Return Player Index Of Self Player"""
|
||||
|
||||
session = ba.internal.get_foreground_host_session()
|
||||
|
||||
for i in range(len(session.sessionplayers)):
|
||||
if session.sessionplayers[i].inputdevice.client_id == clientid:
|
||||
return int(session.sessionplayers[i].id)
|
||||
for i in _ba.get_foreground_host_activity().players:
|
||||
if i.sessionplayer.inputdevice.client_id == clientid:
|
||||
return i
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
16
dist/ba_root/mods/custom_hooks.py
vendored
16
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -18,7 +18,7 @@ import time
|
|||
import os
|
||||
import ba
|
||||
import _ba
|
||||
|
||||
import logging
|
||||
from ba import _hooks
|
||||
from bastd.activity import dualteamscore, multiteamscore, drawscore
|
||||
from bastd.activity.coopscore import CoopScoreScreen
|
||||
|
|
@ -72,7 +72,7 @@ def playerspaz_init(playerspaz: ba.Player, node: ba.Node, player: ba.Player):
|
|||
|
||||
def bootstraping():
|
||||
"""Bootstarps the server."""
|
||||
print("Bootstraping mods..")
|
||||
logging.warning("Bootstraping mods...")
|
||||
# server related
|
||||
_ba.set_server_device_name(settings["HostDeviceName"])
|
||||
_ba.set_server_name(settings["HostName"])
|
||||
|
|
@ -83,7 +83,17 @@ def bootstraping():
|
|||
_thread.start_new_thread(mystats.refreshStats, ())
|
||||
pdata.load_cache()
|
||||
_thread.start_new_thread(pdata.dump_cache, ())
|
||||
|
||||
if(settings["useV2Account"]):
|
||||
from tools import account
|
||||
if(ba.internal.get_v1_account_state()=='signed_in' and ba.internal.get_v1_account_type()=='V2'):
|
||||
logging.debug("Account V2 is active")
|
||||
else:
|
||||
ba.internal.sign_out_v1()
|
||||
logging.warning("Account V2 login started ...wait")
|
||||
account.AccountUtil()
|
||||
else:
|
||||
ba.app.accounts_v2.set_primary_credentials(None)
|
||||
ba.internal.sign_in_v1('Local')
|
||||
# import plugins
|
||||
if settings["elPatronPowerups"]["enable"]:
|
||||
from plugins import elPatronPowerups
|
||||
|
|
|
|||
BIN
dist/ba_root/mods/maps/BridgitMash.so
vendored
BIN
dist/ba_root/mods/maps/BridgitMash.so
vendored
Binary file not shown.
BIN
dist/ba_root/mods/maps/BridgitParallelo.so
vendored
BIN
dist/ba_root/mods/maps/BridgitParallelo.so
vendored
Binary file not shown.
178
dist/ba_root/mods/maps/WoodenFloor.py
vendored
178
dist/ba_root/mods/maps/WoodenFloor.py
vendored
|
|
@ -5,13 +5,41 @@ from typing import TYPE_CHECKING
|
|||
import ba,_ba
|
||||
from bastd.gameutils import SharedObjects
|
||||
from bastd.actor.playerspaz import PlayerSpaz
|
||||
import copy
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, List, Dict
|
||||
|
||||
|
||||
class mapdefs:
|
||||
points = {}
|
||||
# noinspection PyDictCreation
|
||||
boxes = {}
|
||||
boxes['area_of_interest_bounds'] = (0.0, 1.185751251, 0.4326226188) + (
|
||||
0.0, 0.0, 0.0) + (29.8180273, 11.57249038, 18.89134176)
|
||||
boxes['edge_box'] = (-0.103873591, 0.4133341891, 0.4294651013) + (
|
||||
0.0, 0.0, 0.0) + (22.48295719, 1.290242794, 8.990252454)
|
||||
points['ffa_spawn1'] = (-0.08015551329, 0.02275111462,
|
||||
-4.373674593) + (8.895057015, 1.0, 0.444350722)
|
||||
points['ffa_spawn2'] = (-0.08015551329, 0.02275111462,
|
||||
4.076288941) + (8.895057015, 1.0, 0.444350722)
|
||||
points['flag1'] = (-10.99027878, 0.05744967453, 0.1095578275)
|
||||
points['flag2'] = (11.01486398, 0.03986567039, 0.1095578275)
|
||||
points['flag_default'] = (-0.1001374046, 0.04180340146, 0.1095578275)
|
||||
boxes['goal1'] = (12.22454533, 1.0,
|
||||
0.1087926362) + (0.0, 0.0, 0.0) + (2.0, 2.0, 12.97466313)
|
||||
boxes['goal2'] = (-12.15961605, 1.0,
|
||||
0.1097860203) + (0.0, 0.0, 0.0) + (2.0, 2.0, 13.11856424)
|
||||
boxes['map_bounds'] = (0.0, 1.185751251, 0.4326226188) + (0.0, 0.0, 0.0) + (
|
||||
42.09506485, 22.81173179, 29.76723155)
|
||||
points['powerup_spawn1'] = (5.414681236, 0.9515026107, -5.037912441)
|
||||
points['powerup_spawn2'] = (-5.555402285, 0.9515026107, -5.037912441)
|
||||
points['powerup_spawn3'] = (5.414681236, 0.9515026107, 5.148223181)
|
||||
points['powerup_spawn4'] = (-5.737266365, 0.9515026107, 5.148223181)
|
||||
points['spawn1'] = (-10.03866341, 0.02275111462, 0.0) + (0.5, 1.0, 4.0)
|
||||
points['spawn2'] = (9.823107149, 0.01092306765, 0.0) + (0.5, 1.0, 4.0)
|
||||
points['tnt1'] = (-0.08421587483, 0.9515026107, -0.7762602271)
|
||||
class WoodenFloor(ba.Map):
|
||||
"""Stadium map for football games."""
|
||||
from bastd.mapdata import football_stadium as defs
|
||||
defs = mapdefs
|
||||
defs.points['spawn1'] = (-12.03866341, 0.02275111462, 0.0) + (0.5, 1.0, 4.0)
|
||||
defs.points['spawn2'] = (12.823107149, 0.01092306765, 0.0) + (0.5, 1.0, 4.0)
|
||||
name = 'Wooden Floor'
|
||||
|
|
@ -80,6 +108,152 @@ class WoodenFloor(ba.Map):
|
|||
zpos = (point.z - box_position[2]) / box_scale[2]
|
||||
return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5
|
||||
|
||||
def map_extend(self):
|
||||
pass
|
||||
# p=[-6,-4.3,-2.6,-0.9,0.8,2.5,4.2,5.9]
|
||||
# q=[-4,-2.3,-0.6,1.1,2.8,4.5,6.2]
|
||||
# for i in p:
|
||||
# for j in q:
|
||||
# self.create_ramp(i,j)
|
||||
|
||||
# self.create_ramp(10.9)
|
||||
# self.ground()
|
||||
|
||||
def ground(self):
|
||||
shared = SharedObjects.get()
|
||||
self._real_wall_material=ba.Material()
|
||||
|
||||
self._real_wall_material.add_actions(
|
||||
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', True),
|
||||
('modify_part_collision', 'physical', True)
|
||||
|
||||
))
|
||||
self.mat = ba.Material()
|
||||
self.mat.add_actions(
|
||||
|
||||
actions=( ('modify_part_collision','physical',False),
|
||||
('modify_part_collision','collide',False))
|
||||
)
|
||||
spaz_collide_mat=ba.Material()
|
||||
spaz_collide_mat.add_actions(
|
||||
conditions=('they_have_material',shared.player_material),
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', True),
|
||||
( 'call','at_connect',ba.Call(self._handle_player_collide )),
|
||||
),
|
||||
)
|
||||
pos=(0,0.1,-5)
|
||||
self.main_region=ba.newnode('region',attrs={'position': pos,'scale': (21,0.001,20),'type': 'box','materials': [shared.footing_material,self._real_wall_material,spaz_collide_mat]})
|
||||
|
||||
|
||||
def create_ramp_111(self,x,z):
|
||||
|
||||
# print("creating pad ar x "+str(x)+" and z"+str(z))
|
||||
|
||||
try:
|
||||
_ba.prop_axis(1,0,0)
|
||||
except:
|
||||
pass
|
||||
shared = SharedObjects.get()
|
||||
self._real_wall_material=ba.Material()
|
||||
|
||||
self._real_wall_material.add_actions(
|
||||
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', True),
|
||||
('modify_part_collision', 'physical', True)
|
||||
|
||||
))
|
||||
self.mat = ba.Material()
|
||||
self.mat.add_actions(
|
||||
|
||||
actions=( ('modify_part_collision','physical',False),
|
||||
('modify_part_collision','collide',False))
|
||||
)
|
||||
spaz_collide_mat=ba.Material()
|
||||
# spaz_collide_mat.add_actions(
|
||||
# conditions=('they_have_material',shared.player_material),
|
||||
# actions=(
|
||||
# ('modify_part_collision', 'collide', True),
|
||||
# ( 'call','at_connect',ba.Call(self._handle_player_pad_collide,real )),
|
||||
# ),
|
||||
# )
|
||||
pos=(x,0,z)
|
||||
ud_1_r=ba.newnode('region',attrs={'position': pos,'scale': (1.5,1,1.5),'type': 'box','materials': [shared.footing_material,self._real_wall_material ]})
|
||||
|
||||
node = ba.newnode('prop',
|
||||
owner=ud_1_r,
|
||||
attrs={
|
||||
'model':ba.getmodel('image1x1'),
|
||||
'light_model':ba.getmodel('powerupSimple'),
|
||||
'position':(2,7,2),
|
||||
'body':'puck',
|
||||
'shadow_size':0.0,
|
||||
'velocity':(0,0,0),
|
||||
'color_texture':ba.gettexture('tnt'),
|
||||
'model_scale':1.5,
|
||||
'reflection_scale':[1.5],
|
||||
'materials':[self.mat, shared.object_material,shared.footing_material],
|
||||
|
||||
'density':9000000000
|
||||
})
|
||||
mnode = ba.newnode('math',
|
||||
owner=ud_1_r,
|
||||
attrs={
|
||||
'input1': (0, 0.6, 0),
|
||||
'operation': 'add'
|
||||
})
|
||||
|
||||
|
||||
|
||||
ud_1_r.connectattr('position', mnode, 'input2')
|
||||
mnode.connectattr('output', node, 'position')
|
||||
|
||||
|
||||
# base / bottom ====================================
|
||||
|
||||
# pos=(0.0, 2.004164695739746, -3.3991328477859497)
|
||||
# self.ud_2_r=ba.newnode('region',attrs={'position': pos,'scale': (2,1,2),'type': 'box','materials': [shared.footing_material,self._real_wall_material,spaz_collide_mat ]})
|
||||
|
||||
# self.node2 = ba.newnode('prop',
|
||||
# owner=self.ud_2_r,
|
||||
# attrs={
|
||||
# 'model':ba.getmodel('bridgitLevelBottom'),
|
||||
# 'light_model':ba.getmodel('powerupSimple'),
|
||||
# 'position':(2,7,2),
|
||||
# 'body':'puck',
|
||||
# 'shadow_size':0.0,
|
||||
# 'velocity':(0,0,0),
|
||||
# 'color_texture':ba.gettexture('bridgitLevelColor'),
|
||||
|
||||
# 'reflection_scale':[1.5],
|
||||
# 'materials':[self.mat, shared.object_material,shared.footing_material],
|
||||
|
||||
# 'density':9000000000
|
||||
# })
|
||||
# mnode = ba.newnode('math',
|
||||
# owner=self.ud_2_r,
|
||||
# attrs={
|
||||
# 'input1': (0, -1.8, 0),
|
||||
# 'operation': 'add'
|
||||
# })
|
||||
|
||||
# self.ud_2_r.connectattr('position', mnode, 'input2')
|
||||
# mnode.connectattr('output', self.node2, 'position')
|
||||
|
||||
# /// region to stand long bar ===============
|
||||
|
||||
|
||||
# pos=(-9.67+loc,0.1,0+z_marg)
|
||||
# self.left_region=ba.newnode('region',attrs={'position': pos,'scale': (2.4,0.7,3.2),'type': 'box','materials': [shared.footing_material,self._real_wall_material,spaz_collide_mat ]})
|
||||
|
||||
# pos=(-5.67+loc,0.1,0+z_marg)
|
||||
# self.center_region=ba.newnode('region',attrs={'position': pos,'scale': (8,0.7,1),'type': 'box','materials': [shared.footing_material,self._real_wall_material,spaz_collide_mat ]})
|
||||
# pos=(-1.3+loc,0.1,0+z_marg)
|
||||
# self.right_region=ba.newnode('region',attrs={'position': pos,'scale': (2.4,0.7,3.2),'type': 'box','materials': [shared.footing_material,self._real_wall_material,spaz_collide_mat ]})
|
||||
|
||||
|
||||
def _handle_player_collide(self):
|
||||
try:
|
||||
|
|
|
|||
4
dist/ba_root/mods/setting.json
vendored
4
dist/ba_root/mods/setting.json
vendored
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"whitelist": false,
|
||||
|
||||
"useV2Account": false,
|
||||
"ChatCommands": {
|
||||
"BrodcastCommand": true
|
||||
},
|
||||
"textonmap": {
|
||||
"top watermark": "Welcome to server \nip 192.168.0.1",
|
||||
"bottom left watermark": "Owner : <owner-name> \nEditor : <bablu>\nScripts : BCS1.7",
|
||||
"bottom left watermark": "Owner : <owner-name> \nEditor : <bablu>\nScripts : BCS1.7.10",
|
||||
"center highlights":{
|
||||
"color":[1,0,0],
|
||||
"randomColor":true,
|
||||
|
|
|
|||
1
dist/ba_root/mods/spazmod/effects.py
vendored
1
dist/ba_root/mods/spazmod/effects.py
vendored
|
|
@ -248,6 +248,7 @@ class Effect(ba.Actor):
|
|||
ba.animate_array(self.scorchNode,"color",3,{0:self.scorchNode.color,500:color}, timetype=tt, timeformat=tf)
|
||||
else:
|
||||
self.scorchTimer = None
|
||||
if hasattr(self,"scorchNode"):
|
||||
self.scorchNode.delete()
|
||||
self.handlemessage(ba.DieMessage())
|
||||
|
||||
|
|
|
|||
91
dist/ba_root/mods/tools/account.py
vendored
Normal file
91
dist/ba_root/mods/tools/account.py
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
# ba_meta require api 6
|
||||
from __future__ import annotations
|
||||
|
||||
import ba
|
||||
import bacommon.cloud
|
||||
import logging
|
||||
from efro.error import CommunicationError
|
||||
|
||||
|
||||
|
||||
STATUS_CHECK_INTERVAL_SECONDS = 2.0
|
||||
|
||||
class AccountUtil:
|
||||
def __init__(self):
|
||||
self._proxyid: str | None = None
|
||||
self._proxykey: str | None = None
|
||||
if(ba.internal.get_v1_account_state() == 'signed_out'):
|
||||
ba.app.cloud.send_message_cb(bacommon.cloud.LoginProxyRequestMessage(),
|
||||
on_response=ba.Call(self._on_proxy_request_response))
|
||||
else:
|
||||
logging.error("Signout old account first")
|
||||
def _on_proxy_request_response(self, response: bacommon.cloud.LoginProxyRequestResponse | Exception) -> None:
|
||||
if isinstance(response, Exception):
|
||||
logging.error("error occured")
|
||||
logging.critical("Falling back to V1 account")
|
||||
ba.internal.sign_in_v1('Local')
|
||||
return
|
||||
address = ba.internal.get_master_server_address(
|
||||
version=2) + response.url
|
||||
logging.debug("copy this url to your browser : " +address)
|
||||
self._proxyid = response.proxyid
|
||||
self._proxykey = response.proxykey
|
||||
ba.timer(STATUS_CHECK_INTERVAL_SECONDS,
|
||||
ba.Call(self._ask_for_status))
|
||||
|
||||
def _ask_for_status(self) -> None:
|
||||
assert self._proxyid is not None
|
||||
assert self._proxykey is not None
|
||||
ba.app.cloud.send_message_cb(
|
||||
bacommon.cloud.LoginProxyStateQueryMessage(
|
||||
proxyid=self._proxyid, proxykey=self._proxykey),
|
||||
on_response=ba.Call(self._got_status))
|
||||
|
||||
def _got_status(
|
||||
self, response: bacommon.cloud.LoginProxyStateQueryResponse | Exception
|
||||
) -> 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.
|
||||
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")
|
||||
ba.internal.sign_in_v1('Local')
|
||||
|
||||
# If we got a token, set ourself as signed in. Hooray!
|
||||
if (isinstance(response, bacommon.cloud.LoginProxyStateQueryResponse)
|
||||
and response.state is response.State.SUCCESS):
|
||||
assert response.credentials is not None
|
||||
ba.app.accounts_v2.set_primary_credentials(response.credentials)
|
||||
logging.info("Logged in as: "+ba.internal.get_v1_account_display_string())
|
||||
# As a courtesy, tell the server we're done with this proxy
|
||||
# so it can clean up (not a huge deal if this fails)
|
||||
assert self._proxyid is not None
|
||||
try:
|
||||
ba.app.cloud.send_message_cb(
|
||||
bacommon.cloud.LoginProxyCompleteMessage(
|
||||
proxyid=self._proxyid),
|
||||
on_response=ba.Call(self._proxy_complete_response))
|
||||
except CommunicationError:
|
||||
pass
|
||||
except Exception:
|
||||
logging.warning(
|
||||
'Unexpected error sending login-proxy-complete message',
|
||||
exc_info=True)
|
||||
return
|
||||
|
||||
# If we're still waiting, ask again soon.
|
||||
if (isinstance(response, Exception)
|
||||
or response.state is response.State.WAITING):
|
||||
ba.timer(STATUS_CHECK_INTERVAL_SECONDS,
|
||||
ba.Call(self._ask_for_status))
|
||||
|
||||
# ba_meta export plugin
|
||||
# class AccountV2(ba.Plugin):
|
||||
# def __init__(self):
|
||||
# if(ba.internal.get_v1_account_state()=='signed_in' and ba.internal.get_v1_account_type()=='V2'):
|
||||
# logging.debug("Account V2 is active")
|
||||
# else:
|
||||
# ba.internal.sign_out_v1()
|
||||
# logging.warning("Account V2 login started ...wait")
|
||||
# AccountUtil()
|
||||
BIN
dist/bombsquad_headless
vendored
BIN
dist/bombsquad_headless
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue