updated mods to api 7

This commit is contained in:
Ayush Saini 2022-06-30 00:37:05 +05:30
parent de0199ad50
commit ee12aa92a0
21 changed files with 715 additions and 193 deletions

View file

@ -1,93 +1,137 @@
import ba,_ba
import ba
import _ba
from bastd.gameutils import SharedObjects from bastd.gameutils import SharedObjects
import random import random
from ba._gameactivity import GameActivity from ba._messages import DieMessage, DeathType, OutOfBoundsMessage, UNHANDLED
on_begin_original = ba._activity.Activity.on_begin
import random
def factory(random_col:bool):
act=_ba.get_foreground_host_activity()
if not isinstance(act,GameActivity):
return
m=_ba.get_foreground_host_activity().map.get_def_bound_box('area_of_interest_bounds')
part1=list(m)
part2=list(m)
half=(m[0]+m[3])/2
part1[3]=half
part2[0]=half
ba.timer(0.3,ba.Call(create_fly,part1,random_col))
ba.timer(1,ba.Call(create_fly,part2,random_col))
ba.timer(0.12,ba.Call(create_fly,part1,random_col))
ba.timer(0.88,ba.Call(create_fly,part2,random_col))
ba.timer(1.8,ba.Call(create_fly,part1,random_col))
ba.timer(3.3,ba.Call(create_fly,part2,random_col))
ba.timer(4.78,ba.Call(create_fly,part1,random_col))
ba.timer(2,ba.Call(create_fly,part2,random_col))
ba.timer(6.3,ba.Call(create_fly,part1,random_col))
ba.timer(3.3,ba.Call(create_fly,part2,random_col))
ba.timer(4.78,ba.Call(create_fly,part1,random_col))
ba.timer(2,ba.Call(create_fly,part2,random_col))
ba.timer(6.3,ba.Call(create_fly,part1,random_col))
ba.timer(3.5,ba.Call(create_fly,part2,random_col))
ba.timer(4.28,ba.Call(create_fly,part1,random_col))
ba.timer(2.2,ba.Call(create_fly,part2,random_col))
ba.timer(6.1,ba.Call(create_fly,part1,random_col))
def create_fly(points,random_col): def fireflies_generator(activity, count, random_color:False):
flies(points,random_col).autoretain() if random_color:
color=(random.uniform(0,1.2),random.uniform(0,1.2),random.uniform(0,1.2))
class flies(ba.Actor):
def __init__(self,m,random_col):
super().__init__()
shared = SharedObjects.get()
if random_col:
col=(random.uniform(0,1.2),random.uniform(0,1.2),random.uniform(0,1.2))
else: else:
col=(0.9,0.7,0.0) color=(0.9,0.7,0.0)
increment = count - len(activity.fireflies)
if increment > 0:
spawn_areas = _calculate_spawn_areas()
if not spawn_areas:
return
for _ in range(increment):
with ba.Context(activity):
firefly = FireFly(random.choice(spawn_areas), color)
activity.fireflies.append(firefly)
else:
for _ in range(abs(increment)):
firefly = activity.fireflies.pop()
try:
firefly.handlemessage(ba.DieMessage())
except AttributeError:
pass
firefly.timer = None
def _calculate_spawn_areas():
activity = _ba.get_foreground_host_activity()
if not isinstance(activity, ba.GameActivity):
return
aoi_bounds = activity.map.get_def_bound_box("area_of_interest_bounds")
# aoi_bounds = activity.map.get_def_bound_box("map_bounds")
first_half = list(aoi_bounds)
second_half = list(aoi_bounds)
midpoint_x = (aoi_bounds[0] + aoi_bounds[3]) / 2
first_half[3] = midpoint_x
second_half[0] = midpoint_x
spawn_areas = (first_half, second_half)
return spawn_areas
class FireFly(ba.Actor):
def __init__(self, area, color, *args, **kwargs):
super().__init__(*args, **kwargs)
self.area = area
self.color = color
initial_timer = random.uniform(0.5, 6)
self.timer = ba.Timer(initial_timer, self.on)
def on(self):
shared = SharedObjects.get()
self.mat = ba.Material() self.mat = ba.Material()
self.mat.add_actions( self.mat.add_actions(
actions=( actions=(
('modify_part_collision', 'collide', False), ('modify_part_collision', 'collide', False),
('modify_part_collision', 'physical', False), ('modify_part_collision', 'physical', False),
)) ))
self.node = ba.newnode(
'prop',
self.node = ba.newnode('prop',
delegate=self,
attrs={ attrs={
'model': ba.getmodel('bomb'), 'model': ba.getmodel('bomb'),
'position': (2,4,2), 'position': (2,4,2),
'body': 'capsule', 'body': 'capsule',
'shadow_size': 0.0, 'shadow_size': 0.0,
'color_texture':ba.gettexture('coin'), 'color_texture': random.choice([ba.gettexture(tex) for tex in ("egg1", "egg2", "egg3")]),
'reflection': 'soft', 'reflection': 'soft',
'reflection_scale': [1.5], 'reflection_scale': [1.5],
'materials':[shared.object_material,self.mat] 'materials': (shared.object_material, self.mat)
}) })
ba.animate(self.node,'model_scale',{0:0,1:0.19,5:0.10,10:0.0},loop=True) ba.animate(
ba.animate_array(self.node,'position',3,self.generateKeys(m),loop=True) self.node,
'model_scale',
{0:0, 1:0.23, 5:0.15, 10:0.0},
loop=True,
)
ba.animate_array(
self.node,
'position',
3,
self.generate_keys(self.area),
loop=True
)
self.light=ba.newnode('light',owner=self.node,attrs={'intensity':0.6, self.light = ba.newnode(
'light',
owner=self.node,
attrs={
'intensity':0.6,
'height_attenuated':True, 'height_attenuated':True,
'radius':0.2, 'radius':0.2,
'color':col}) 'color':self.color
ba.animate(self.light,'radius',{0:0.0,20:0.4,70:0.1,100:0.3,150:0},loop=True) })
ba.animate(
self.light,
'radius',
{0:0.0, 20:0.4 ,70:0.1 ,100:0.3 ,150:0},
loop=True
)
self.node.connectattr('position', self.light, 'position') self.node.connectattr('position', self.light, 'position')
def off(self):
death_secs = random.uniform(0.5, 3)
with ba.Context(self._activity()):
ba.animate(
self.node,
'model_scale',
{0: self.node.model_scale, death_secs: 0}
)
ba.animate(
self.light,
'radius',
{0:self.light.radius, death_secs:0}
)
ba.timer(death_secs, self.node.delete)
def handlemessage(self, msg): def handlemessage(self, msg):
if isinstance(msg, ba.DieMessage): if isinstance(msg, ba.DieMessage):
self.off()
pass elif isinstance(msg, OutOfBoundMessage):
# self.node.delete() self.handlemessage(ba.DieMessage(how=OutOfBoundMessage))
else: else:
super().handlemessage(msg) return super().handlemessage(msg)
def generateKeys(self,m):
def generate_keys(self,m):
keys = {} keys = {}
t = 0 t = 0
last_x = random.randrange(int(m[0]),int(m[3])) last_x = random.randrange(int(m[0]),int(m[3]))
last_y = random.randrange(int(m[1]),int(m[4])) last_y = random.randrange(int(m[1]),int(m[4]))
if int(m[2]) == int(m[5]): if int(m[2]) == int(m[5]):
@ -95,23 +139,30 @@ class flies(ba.Actor):
else: else:
last_z = random.randrange(int(m[2]),int(m[5])) last_z = random.randrange(int(m[2]),int(m[5]))
for i in range(0,7): for i in range(0,7):
x=self.generateRandom(int(m[0]),int(m[3]),last_x) x = self.generate_random(int(m[0]),int(m[3]),last_x)
last_x = x last_x = x
y=self.generateRandom(int(m[1]),int(m[4]),last_y) y = self.generate_random(int(m[1]),int(m[4]),last_y)
last_y = y last_y = y
z=self.generateRandom(int(m[2]),int(m[5]),last_z) z = self.generate_random(int(m[2]),int(m[5]),last_z)
last_z = z last_z = z
keys[t] = (x, abs(y), z) keys[t] = (x, abs(y), z)
t += 30 t += 30
return keys return keys
def generateRandom(self,a,b,z):
def generate_random(self, a, b, z):
if a == b: if a == b:
return a return a
while True: while True:
n = random.randrange(a,b) n = random.randrange(a,b)
if abs(z-n) < 6: if abs(z-n) < 6:
return n return n
def on_begin(self, *args, **kwargs) -> None:
self.fireflies = []
return on_begin_original(self, *args, **kwargs)
ba._activity.Activity.fireflies_generator = fireflies_generator
ba._activity.Activity.on_begin = on_begin

17
dist/ba_root/mods/features/map_fun.py vendored Normal file
View file

@ -0,0 +1,17 @@
import _ba
import random
def decorate_map():
try:
activity = _ba.get_foreground_host_activity()
activity.fireflies_generator(20,True)
activity.map.node.reflection = "powerup"
activity.map.node.reflection_scale = [4]
activity.globalsnode.tint = (0.5,0.7,1)
# activity.map.node.color = random.choices([(0.8,0.3,0.3),(0.6,0.5,0.7),(0.3,0.8,0.5)])[0]
m = 5
s = 5000
ba.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)
activity.map.background.reflection = "soft"
except:
pass

View file

@ -0,0 +1,10 @@
{
"customtag": {
"pb-id": "smoothy",
"pb-45": "something",
"pb-IF4TVWwZUQ==": "proowner"
},
"customeffects": {
"pb-IF4TVWwZUQ==": "spark"
}
}

View file

@ -120,7 +120,6 @@ def add_profile(
"spamCount": 0, "spamCount": 0,
"lastSpam": time.time(), "lastSpam": time.time(),
"totaltimeplayer": 0, "totaltimeplayer": 0,
"lastseen": 0,
} }
CacheData.profiles=profiles CacheData.profiles=profiles
commit_profiles() commit_profiles()
@ -131,6 +130,16 @@ def add_profile(
serverdata.clients[account_id]["verified"] = False serverdata.clients[account_id]["verified"] = False
serverdata.clients[account_id]["rejoincount"] = 1 serverdata.clients[account_id]["rejoincount"] = 1
serverdata.clients[account_id]["lastJoin"] = time.time() serverdata.clients[account_id]["lastJoin"] = time.time()
cid = 113
for ros in _ba.get_game_roster():
if ros['account_id'] == account_id:
cid = ros['client_id']
serverdata.clients[account_id]["lastIP"] = _ba.get_client_ip(cid)
device_id = _ba.get_client_public_device_uuid(cid)
if(device_id==None):
device_id = _ba.get_client_device_uuid(cid)
serverdata.clients[account_id]["deviceUUID"] = device_id
def update_display_string(account_id: str, display_string: str) -> None: def update_display_string(account_id: str, display_string: str) -> None:

View file

@ -25,5 +25,78 @@
"lastseen": 0, "lastseen": 0,
"spamCount": 4, "spamCount": 4,
"lastSpam": 1637912278.8745685 "lastSpam": 1637912278.8745685
},
"pb-IF4eUxk5KA==": {
"display_string": [
"\ue063HeySmoothy"
],
"profiles": [],
"name": "\ue063HeySmoothy",
"isBan": false,
"isMuted": false,
"accountAge": "2022-05-29 21:53:44",
"registerOn": 1655022106.4740922,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1655022106.4740927,
"totaltimeplayer": 0,
"lastseen": 0,
"warnCount": 0,
"lastWarned": 1655552812.9632144,
"verified": true,
"rejoincount": 1,
"lastJoin": 1655552812.963215,
"cMsgCount": 0,
"lastMsgTime": 1655406931.728448,
"lastMsg": "ok",
"cSameMsg": 0,
"lastIP": "axj~}j~~n`ai",
"deviceUUID": "eedccec9b0c17d3716b936981bb753c3872d905c"
},
"pb-IF4RU2ECAg==": {
"display_string": [
"\ue030PC452402"
],
"profiles": [],
"name": "\ue030PC452402",
"isBan": false,
"isMuted": false,
"accountAge": "2022-06-04 01:42:22",
"registerOn": 1655407521.4853234,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1655407521.4853249,
"totaltimeplayer": 0,
"warnCount": 0,
"lastWarned": 1655407521.4853408,
"verified": true,
"rejoincount": 2,
"lastJoin": 1655407536.1110733,
"lastIP": "axj~}j~~n`ai",
"deviceUUID": "\u0003\u0005^\u0005VFYYULL\u0007Z\u0005L@QU\u0004L\u0015QZ\u0002L\u0016XX"
},
"pb-IF43U2cIVw==": {
"display_string": "\ue063Smoothy",
"profiles": [],
"name": "\ue063Smoothy",
"isBan": false,
"isMuted": false,
"accountAge": "2022-06-23 22:27:13",
"registerOn": 1656442709.8344862,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1656442709.8344867,
"totaltimeplayer": 0,
"warnCount": 0,
"lastWarned": 1656527532.2340264,
"verified": true,
"rejoincount": 0,
"lastJoin": 1656527777.355527,
"lastIP": "axj~}m~}jdai",
"deviceUUID": "c49fafb7d66d14198924c1b9dcc59e23fb838042",
"cMsgCount": 0,
"lastMsgTime": 1656525491.3282282,
"lastMsg": "/end",
"cSameMsg": 0
} }
} }

View file

@ -0,0 +1,102 @@
{
"pb-IF4TVWwZUQ=9=": {
"display_string": "\ue030PC295588",
"profiles": [],
"name": "\ue030PC295588",
"isBan": false,
"isMuted": false,
"totaltimeplayer": 0,
"lastseen": 0,
"spamCount": 0,
"lastSpam": 1637911682.2054627
},
"pb-IF5XUm9eAg==": {
"display_string": [
"\ue030PC402015"
],
"profiles": [],
"name": "\ue030PC402015",
"isBan": false,
"isMuted": false,
"accountAge": "2021-11-12 20:30:30",
"registerOn": 1636801177.809589,
"canStartKickVote": true,
"totaltimeplayer": 0,
"lastseen": 0,
"spamCount": 4,
"lastSpam": 1637912278.8745685
},
"pb-IF4eUxk5KA==": {
"display_string": [
"\ue063HeySmoothy"
],
"profiles": [],
"name": "\ue063HeySmoothy",
"isBan": false,
"isMuted": false,
"accountAge": "2022-05-29 21:53:44",
"registerOn": 1655022106.4740922,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1655022106.4740927,
"totaltimeplayer": 0,
"lastseen": 0,
"warnCount": 0,
"lastWarned": 1655552812.9632144,
"verified": true,
"rejoincount": 1,
"lastJoin": 1655552812.963215,
"cMsgCount": 0,
"lastMsgTime": 1655406931.728448,
"lastMsg": "ok",
"cSameMsg": 0,
"lastIP": "axj~}j~~n`ai",
"deviceUUID": "eedccec9b0c17d3716b936981bb753c3872d905c"
},
"pb-IF4RU2ECAg==": {
"display_string": [
"\ue030PC452402"
],
"profiles": [],
"name": "\ue030PC452402",
"isBan": false,
"isMuted": false,
"accountAge": "2022-06-04 01:42:22",
"registerOn": 1655407521.4853234,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1655407521.4853249,
"totaltimeplayer": 0,
"warnCount": 0,
"lastWarned": 1655407521.4853408,
"verified": true,
"rejoincount": 2,
"lastJoin": 1655407536.1110733,
"lastIP": "axj~}j~~n`ai",
"deviceUUID": "\u0003\u0005^\u0005VFYYULL\u0007Z\u0005L@QU\u0004L\u0015QZ\u0002L\u0016XX"
},
"pb-IF43U2cIVw==": {
"display_string": "\ue063Smoothy",
"profiles": [],
"name": "\ue063Smoothy",
"isBan": false,
"isMuted": false,
"accountAge": "2022-06-23 22:27:13",
"registerOn": 1656442709.8344862,
"canStartKickVote": true,
"spamCount": 0,
"lastSpam": 1656442709.8344867,
"totaltimeplayer": 0,
"warnCount": 0,
"lastWarned": 1656527532.2340264,
"verified": true,
"rejoincount": 0,
"lastJoin": 1656527777.355527,
"lastIP": "axj~}m~}jdai",
"deviceUUID": "c49fafb7d66d14198924c1b9dcc59e23fb838042",
"cMsgCount": 0,
"lastMsgTime": 1656525491.3282282,
"lastMsg": "/end",
"cSameMsg": 0
}
}

View file

@ -1,22 +1,40 @@
{ {
"owner": { "owner": {
"tag": "\\cowner\\c", "tagcolor": [1, "tag": "\\cowner\\c",
"tagcolor": [
1,
0.6, 0.6,
0.4 0.4
], ],
"commands": ["ALL"], "commands": [
"ids": ["pb-IF48VWkBFQ", "pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE", "pb-IF4TVWwZUQ==", "pb-IF4SVW9dEg==", "pb-IF5XUm9eAg=="] "ALL"
],
"ids": [
"pb-IF48VWkBFQ",
"pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE",
"pb-IF4TVWwZUQ==",
"pb-IF4SVW9dEg==",
"pb-IF5XUm9eAg=="
]
}, },
"admin": { "admin": {
"tag": "\ue043admin\ue043", "tagcolor": [1, "tag": "\ue043admin\ue043",
"tagcolor": [
1,
1, 1,
1 1
], ],
"commands": ["createrole"], "commands": [
"ids": ["pb-IF4TVWwZUQ=="] "createrole"
],
"ids": [
"pb-IF4TVWwZUQ=="
]
}, },
"vip": { "vip": {
"tag": "vip", "tagcolor": [1, "tag": "vip",
"tagcolor": [
1,
1, 1,
1 1
], ],
@ -24,7 +42,9 @@
"ids": [] "ids": []
}, },
"smoothy": { "smoothy": {
"tag": "smoothy", "tagcolor": [1, "tag": "smoothy",
"tagcolor": [
1,
1, 1,
1 1
], ],
@ -32,7 +52,9 @@
"ids": [] "ids": []
}, },
"pros": { "pros": {
"tag": "pros", "tagcolor": [1, "tag": "pros",
"tagcolor": [
1,
1, 1,
1 1
], ],
@ -40,19 +62,33 @@
"ids": [] "ids": []
}, },
"top5": { "top5": {
"tag": "top5", "tagcolor": [1, "tag": "top5",
"tagcolor": [
1,
1, 1,
1 1
], ],
"commands": [], "commands": [],
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="] "ids": [
"pb-IF4VAk4a",
"pb-IF4eUxk5KA==",
"pb-IF43U2cIVw=="
]
}, },
"bypass-warn": { "bypass-warn": {
"tag": "", "tagcolor": [1, "tag": "",
"tagcolor": [
1,
1, 1,
1 1
], ],
"commands": [], "commands": [],
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="] "ids": [
"pb-IF5XUm9eAg==",
"pb-IF43VUwlAg==",
"pb-IF4iVUc5Cg==",
"pb-IF4vNnMJ",
"pb-IF4TVWwZUQ=="
]
} }
} }

View file

@ -0,0 +1,94 @@
{
"owner": {
"tag": "\\cowner\\c",
"tagcolor": [
1,
0.6,
0.4
],
"commands": [
"ALL"
],
"ids": [
"pb-IF48VWkBFQ",
"pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE",
"pb-IF4TVWwZUQ==",
"pb-IF4SVW9dEg==",
"pb-IF5XUm9eAg=="
]
},
"admin": {
"tag": "\ue043admin\ue043",
"tagcolor": [
1,
1,
1
],
"commands": [
"createrole"
],
"ids": [
"pb-IF4TVWwZUQ=="
]
},
"vip": {
"tag": "vip",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"smoothy": {
"tag": "smoothy",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"pros": {
"tag": "pros",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": []
},
"top5": {
"tag": "top5",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": [
"pb-IF4VAk4a",
"pb-IF4eUxk5KA==",
"pb-IF43U2cIVw=="
]
},
"bypass-warn": {
"tag": "",
"tagcolor": [
1,
1,
1
],
"commands": [],
"ids": [
"pb-IF5XUm9eAg==",
"pb-IF43VUwlAg==",
"pb-IF4iVUc5Cg==",
"pb-IF4vNnMJ",
"pb-IF4TVWwZUQ=="
]
}
}

View file

@ -1,4 +1,4 @@
# ba_meta require api 6 # ba_meta require api 7
''' '''
Character Chooser by Mr.Smoothy Character Chooser by Mr.Smoothy

View file

@ -6,7 +6,7 @@ tests since they are widely used in live client and server code.
license : MIT, see LICENSE for more details. license : MIT, see LICENSE for more details.
""" """
# ba_meta require api 6 # ba_meta require api 7
# (see https://ballistica.net/wiki/meta-tag-system) # (see https://ballistica.net/wiki/meta-tag-system)
from __future__ import annotations from __future__ import annotations

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# coding: utf-8 # coding: utf-8
# ba_meta require api 6 # ba_meta require api 7
from typing import Optional, Any, Dict, List, Type, Sequence from typing import Optional, Any, Dict, List, Type, Sequence
from ba._gameactivity import GameActivity from ba._gameactivity import GameActivity
import ba,_ba import ba,_ba

View file

@ -1,6 +1,6 @@
"""Define a simple example plugin.""" """Define a simple example plugin."""
# ba_meta require api 6 # ba_meta require api 7
from __future__ import annotations from __future__ import annotations

View file

@ -0,0 +1,127 @@
# This plugin developed fro Bombsquad Server, and I don't know how to make UI
# Just edit Config before starting server
# by: Lirik
# Further edited/Fixed by:Freak
# ba_meta require api 7
import ba
import random
from random import choice
CONFIGS = {
"Radius": 2.0,
"Blinking": False,
"AdaptivePos": True,
"IgnoreOnMaps": [],
"Colors": {
"Intensity": 0.8,
"Animate": True,
"Random": True,
"LeftSide": (1, 0, 1),
"RightSide": (0, 0, 1),
}
}
def get_random_color():
"""Fetches random color every time for our nodes"""
choices = [0, 1, 2, 3]
return (choice(choices), choice(choices), choice(choices))
def get_colors():
"""Fucntion for getting colors for our light node based on configs"""
if CONFIGS["Colors"]["Random"]:
return get_random_color(), get_random_color()
return CONFIGS["Colors"]["LeftSide"], CONFIGS["Colors"]["RightSide"]
# Add more perfect positions for all maps
def get_adaptive_pos(name: str) -> tuple:
"""Fuction for getting pecfect positions for the current map
Args:
name (str): Name of the map
Returns:
[tuple]: tuple containing left and right position respectively
"""
adaptive = {"Crag Castle": ((-6, 7, -7), (6, 7, -7))}
if name in adaptive and CONFIGS["AdaptivePos"]:
return adaptive[name]
return (-10, 7, -3), (10, 7, -3)
def Map___init__(func):
"""Redefined method for ba.Map"""
def wrapper(self, vr_overlay_offset=None):
func(self, vr_overlay_offset)
name = self.getname()
if name in CONFIGS["IgnoreOnMaps"]:
return
left_color, right_color = get_colors()
left_pos, right_pos = get_adaptive_pos(name)
self.left_light = ba.newnode(
"light",
attrs={
"position": left_pos,
"radius": CONFIGS["Radius"],
"intensity": CONFIGS["Colors"]["Intensity"],
"color": left_color,
"volume_intensity_scale": 10,
},
)
self.right_light = ba.newnode(
"light",
attrs={
"position": right_pos,
"radius": CONFIGS["Radius"],
"intensity": CONFIGS["Colors"]["Intensity"],
"color": right_color,
"volume_intensity_scale": 10,
},
)
ba.animate(
self.left_light,
"radius",
{0: 0, 1.5: 0.5, 3: CONFIGS["Radius"]},
loop=True if CONFIGS["Blinking"] else False,
)
ba.animate(
self.right_light,
"radius",
{0: 0, 1.5: 0.5, 3: CONFIGS["Radius"]},
loop=True if CONFIGS["Blinking"] else False,
)
if CONFIGS["Colors"]["Animate"]:
ba.animate_array(
self.left_light,
"color",
3,
{
0: get_random_color(),
1: get_random_color(),
2: get_random_color(),
3: get_random_color(),
4: get_random_color(),
5: get_random_color(),
},
loop=True,
)
return wrapper
# ba_meta export plugin
class MapColor(ba.Plugin):
def on_app_running(self):
ba.Map.__init__ = Map___init__(ba.Map.__init__)

View file

@ -1,4 +1,4 @@
# ba_meta require api 6 # ba_meta require api 7
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import base64 import base64

View file

@ -1,6 +1,6 @@
"""Module to update `setting.json`.""" """Module to update `setting.json`."""
# ba_meta require api 6 # ba_meta require api 7
# (see https://ballistica.net/wiki/meta-tag-system) # (see https://ballistica.net/wiki/meta-tag-system)
from __future__ import annotations from __future__ import annotations

View file

@ -4,7 +4,7 @@
""" """
# ba_meta require api 6 # ba_meta require api 7
from __future__ import annotations from __future__ import annotations

View file

@ -6,14 +6,15 @@
}, },
"textonmap": { "textonmap": {
"top watermark": "Welcome to server \nip 192.168.0.1", "top watermark": "Welcome to server \nip 192.168.0.1",
"bottom left watermark": "Owner : <owner-name> \nEditor : <bablu>\nScripts : BCS1.3.3", "bottom left watermark": "Owner : <owner-name> \nEditor : <bablu>\nScripts : BCS1.7",
"center highlights":{ "center highlights":{
"color":[1,0,0], "color":[1,0,0],
"randomColor":true, "randomColor":true,
"msg":[ "msg":[
"message 1", "type end to start end vote",
"message 2", "start msg with prefix .(dot) to send in game popup msg",
"message 3" "start msg with prefix ,(comma) to send msg to teammates",
"BombSquad Community Server - BCS"
] ]
} }
}, },
@ -29,6 +30,7 @@
"fireflies":true, "fireflies":true,
"fireflies_random_color":false "fireflies_random_color":false
}, },
"colorfullMap":true,
"playlists":{ "playlists":{
"default":12345, "default":12345,
"team":12345, "team":12345,
@ -44,7 +46,7 @@
"enable":true "enable":true
}, },
"colorful_explosions":{ "colorful_explosions":{
"enable":false "enable":true
}, },
"ballistica_web": { "ballistica_web": {
"enable":false "enable":false

View file

@ -1,6 +1,6 @@
"""Module to handle operations with file.""" """Module to handle operations with file."""
# ba_meta require api 6 # ba_meta require api 7
# (see https://ballistica.net/wiki/meta-tag-system) # (see https://ballistica.net/wiki/meta-tag-system)

View file

@ -1,6 +1,6 @@
"""Module to Keeps the log of multiple things.""" """Module to Keeps the log of multiple things."""
# ba_meta require api 6 # ba_meta require api 7
# (see https://ballistica.net/wiki/meta-tag-system) # (see https://ballistica.net/wiki/meta-tag-system)
from __future__ import annotations from __future__ import annotations

View file

@ -1,4 +1,4 @@
# ba_meta require api 6 # ba_meta require api 7
# Thanks to Rikko for playlist fetch by code # Thanks to Rikko for playlist fetch by code

View file

@ -147,6 +147,7 @@ def on_player_join_server(pbid, player_data):
if(device_id==None): if(device_id==None):
device_id = _ba.get_client_device_uuid(cid) device_id = _ba.get_client_device_uuid(cid)
serverdata.clients[pbid]["deviceUUID"] = device_id serverdata.clients[pbid]["deviceUUID"] = device_id
logger.log("ip:"+serverdata.clients[pbid]["lastIP"]+",Device id"+device_id)
_ba.screenmessage(settings["regularWelcomeMsg"] + " " + d_st, _ba.screenmessage(settings["regularWelcomeMsg"] + " " + d_st,
color=(0.60, 0.8, 0.6), transient=True, color=(0.60, 0.8, 0.6), transient=True,
clients=[cid]) clients=[cid])
@ -279,7 +280,7 @@ def my_acc_age(pb_id):
def save_age(age, pb_id, display_string): def save_age(age, pb_id, display_string):
pdata.add_profile(pb_id, display_string, display_string, age) _ba.pushcall(Call(pdata.add_profile,pb_id, display_string,display_string, age), from_other_thread=True)
time.sleep(2) time.sleep(2)
thread2 = FetchThread( thread2 = FetchThread(
target=get_device_accounts, target=get_device_accounts,