mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
added some hooks and user custom tag , effects
This commit is contained in:
parent
be7e8c63de
commit
91af4a8027
12 changed files with 131 additions and 4 deletions
2
dist/ba_data/python/ba/_activitytypes.py
vendored
2
dist/ba_data/python/ba/_activitytypes.py
vendored
|
|
@ -168,6 +168,8 @@ class ScoreScreenActivity(Activity[EmptyPlayer, EmptyTeam]):
|
|||
from bastd.actor.text import Text
|
||||
from ba import _language
|
||||
super().on_begin()
|
||||
import custom_hooks as chook
|
||||
chook.score_screen_on_begin(self._stats)
|
||||
|
||||
# Pop up a 'press any button to continue' statement after our
|
||||
# min-view-time show a 'press any button to continue..'
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_app.py
vendored
2
dist/ba_data/python/ba/_app.py
vendored
|
|
@ -279,6 +279,8 @@ class App:
|
|||
from bastd import maps as stdmaps
|
||||
from bastd.actor import spazappearance
|
||||
from ba._enums import TimeType
|
||||
import custom_hooks
|
||||
custom_hooks.on_app_launch()
|
||||
|
||||
cfg = self.config
|
||||
|
||||
|
|
|
|||
8
dist/ba_data/python/ba/_hooks.py
vendored
8
dist/ba_data/python/ba/_hooks.py
vendored
|
|
@ -308,6 +308,7 @@ def party_invite_revoke(invite_id: str) -> None:
|
|||
transition='out_right')
|
||||
|
||||
import privateserver as pvt
|
||||
import custom_hooks as chooks
|
||||
def filter_chat_message(msg: str, client_id: int) -> Optional[str]:
|
||||
"""Intercept/filter chat messages.
|
||||
|
||||
|
|
@ -316,9 +317,10 @@ def filter_chat_message(msg: str, client_id: int) -> Optional[str]:
|
|||
Should filter and return the string to be displayed, or return None
|
||||
to ignore the message.
|
||||
"""
|
||||
pvt.handlechat(msg,client_id);
|
||||
del client_id # Unused by default.
|
||||
return msg
|
||||
pvt.handlechat(msg,client_id)
|
||||
return chooks.filter_chat_message(msg,client_id)
|
||||
|
||||
|
||||
|
||||
|
||||
def local_chat_message(msg: str) -> None:
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class PlayerSpaz(Spaz):
|
|||
self.last_player_held_by: Optional[ba.Player] = None
|
||||
self._player = player
|
||||
self._drive_player_position()
|
||||
import custom_hooks
|
||||
custom_hooks.playerspaz_init(self._player)
|
||||
|
||||
# Overloads to tell the type system our return type based on doraise val.
|
||||
|
||||
|
|
|
|||
16
dist/ba_root/mods/custom_hooks.py
vendored
16
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
|
||||
|
||||
def filter_chat_message(msg,client_id):
|
||||
|
||||
return msg
|
||||
|
||||
def on_app_launch():
|
||||
#something
|
||||
|
||||
def score_screen_on_begin(_stats):
|
||||
#stats
|
||||
|
||||
def playerspaz_init(player):
|
||||
#add tag,rank,effect
|
||||
|
||||
10
dist/ba_root/mods/playersData/custom.json
vendored
Normal file
10
dist/ba_root/mods/playersData/custom.json
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"customtag":{
|
||||
"pb-id":"smoothy",
|
||||
"pb-45":"something"
|
||||
},
|
||||
"customeffects":{
|
||||
"pb-id":"ice",
|
||||
"pb-id":"scorch",
|
||||
}
|
||||
}
|
||||
51
dist/ba_root/mods/playersData/pdata.py
vendored
51
dist/ba_root/mods/playersData/pdata.py
vendored
|
|
@ -1,7 +1,7 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
roles={}
|
||||
data={}
|
||||
|
||||
custom={}
|
||||
|
||||
def roles():
|
||||
global roles
|
||||
|
|
@ -86,4 +86,53 @@ def commit():
|
|||
f=open("roles.json",'w')
|
||||
json.dump(roles,f,indent=4)
|
||||
f.close()
|
||||
#======================= CUSTOM EFFECTS/TAGS ===============
|
||||
|
||||
|
||||
def custom():
|
||||
global custom
|
||||
if custom=={}:
|
||||
f=open("custom.json","r")
|
||||
dat=json.loads(f.read())
|
||||
custom=dat
|
||||
f.close()
|
||||
return custom
|
||||
|
||||
|
||||
|
||||
def set_effect(effect,id):
|
||||
global custom
|
||||
_custom=custom()
|
||||
_custom['customeffects'][id]=effect
|
||||
custom=_custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def set_tag(tag,id):
|
||||
global custom
|
||||
_custom=custom()
|
||||
_custom['customtag'][id]=tag
|
||||
custom=_custom
|
||||
commit_c()
|
||||
|
||||
def remove_effect(id):
|
||||
global custom
|
||||
_custom=custom()
|
||||
_custom['customeffects'].pop(id)
|
||||
custom=_custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def remove_tag(id):
|
||||
global custom
|
||||
_custom=custom()
|
||||
_custom['customtag'].pop(id)
|
||||
custom=_custom
|
||||
commit_c()
|
||||
|
||||
|
||||
def commit_c():
|
||||
global custom
|
||||
f=open("custom.json",'w')
|
||||
json.dump(custom,f,indent=4)
|
||||
f.close()
|
||||
|
|
|
|||
5
dist/ba_root/mods/spaz/modifyspaz.py
vendored
Normal file
5
dist/ba_root/mods/spaz/modifyspaz.py
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
0
dist/ba_root/mods/stats/mystats.json
vendored
0
dist/ba_root/mods/stats/mystats.json
vendored
0
dist/ba_root/mods/tools/Log.py
vendored
0
dist/ba_root/mods/tools/Log.py
vendored
39
dist/ba_root/mods/tools/Logger.py
vendored
Normal file
39
dist/ba_root/mods/tools/Logger.py
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
import ba,_ba
|
||||
import datetime;
|
||||
import os
|
||||
# ct stores current time
|
||||
|
||||
|
||||
|
||||
path=_ba.env()['python_directory_user']
|
||||
serverdata=os.path.join(path,"serverData" + os.sep)
|
||||
class log(object):
|
||||
def __init__(self,msg,type='sys'):
|
||||
ct = datetime.datetime.now()
|
||||
msg=ct+msg
|
||||
|
||||
if type=='chat':
|
||||
|
||||
f=open(serverdata+"Chat Logs.log","a+")
|
||||
|
||||
|
||||
|
||||
elif type=='playerjoin':
|
||||
f.open(serverdata+"joining.log","a+")
|
||||
|
||||
|
||||
elif type=='chatcmnd':
|
||||
f.open(serverdata+"cmndusage.log","a+")
|
||||
|
||||
else:
|
||||
f=open(serverdata+"logs.log","a+")
|
||||
|
||||
f.write(msg)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue