[ci] auto-format

This commit is contained in:
BroBordd 2025-08-10 13:02:22 +00:00 committed by github-actions[bot]
parent bba1a27837
commit 99611b9ae6
8 changed files with 1960 additions and 1387 deletions

View file

@ -46,11 +46,13 @@ from bauiv1lib.ingamemenu import InGameMenuWindow as igm
from babase import Plugin, InputType as IT
from math import sqrt, dist
class Camera:
__doc__ = 'A simple camera.'
__ins__ = None
__lst__ = None
__yes__ = False
def __init__(s) -> None:
c = s.__class__
if c.__yes__:
@ -59,7 +61,8 @@ class Camera:
return
c.__ins__ = s
c.__yes__ = True
if c.__lst__: SCM(False)
if c.__lst__:
SCM(False)
s.stage = 0
p = (0, 1, 0)
s.tex = 'achievementCrossHair'
@ -130,7 +133,8 @@ class Camera:
'h_align': h
}
)
if b: s.kids.append(n)
if b:
s.kids.append(n)
return n
"""Create a dot"""
def dot(s, p, b=True, tex='black'):
@ -147,7 +151,8 @@ class Camera:
'materials': [s.M],
}
)
if b: s.kids.append(n)
if b:
s.kids.append(n)
return n
"""Draw a line"""
def line(s, p1, p2, i=2, tex='black'):
@ -167,7 +172,8 @@ class Camera:
p = s.getpos()
s.p1 = (p[0]-0.01, p[1], p[2])
s.okay.append(s.dot(s.p1, b=False))
s.okay.append(s.tip(f'Camera position\n{tuple([round(i,2) for i in s.p1])}',s.p1,b=False))
s.okay.append(
s.tip(f'Camera position\n{tuple([round(i, 2) for i in s.p1])}', s.p1, b=False))
else:
[i.delete() for i in s.kids]
s.kids.clear()
@ -207,7 +213,8 @@ class Camera:
s.line(bl, br, m, **j)
s.line(br, tr, m, **j)
s.tip(f'Your display\n{r[0]}x{r[1]} px\n{tuple([round(i,2) for i in p2])}',tr,'right')
s.tip(
f'Your display\n{r[0]}x{r[1]} px\n{tuple([round(i, 2) for i in p2])}', tr, 'right')
s.stage = 2
s.overlay.press(3)
tick(0.25, animate(s.node, 'mesh_scale', {0: 0.5, 0.1: 0.2, 0.2: 0.5}).delete)
@ -237,19 +244,25 @@ class Camera:
def reset(s):
s.__class__.__yes__ = False
me = getme()
if not me: return
if not me:
return
me.resetinput()
with ga().context: me.actor.connect_controls_to_player()
with ga().context:
me.actor.connect_controls_to_player()
[i.delete() for i in (s.kids+s.okay)]
"""Manage movement"""
def manage(s, a, lr=0):
if lr: s.llr = a; return
if lr:
s.llr = a
return
s.lud = a
"""Move"""
def move(s):
m = getme(1)
if (not m) or m._dead: s.destroy()
try: p = s.getpos()
if (not m) or m._dead:
s.destroy()
try:
p = s.getpos()
except:
s.overlay.destroy()
return
@ -264,9 +277,12 @@ class Camera:
s.loop(i)
"""Keep elevating"""
def loop(s, i):
if s.mode != i: return
try: p = list(s.node.position)
except: return
if s.mode != i:
return
try:
p = list(s.node.position)
except:
return
p[1] += s.step if i else -s.step
s.node.position = tuple(p)
teck(s.wait, lambda: s.loop(i))
@ -284,8 +300,10 @@ class Camera:
def done(s, talk=True):
s.overlay.press(1)
s.overlay.destroy()
try: p = s.node.position
except: return
try:
p = s.node.position
except:
return
with ga().context:
gbs('laser').play(position=p)
tick(0.2, animate(s.node, 'mesh_scale', {0: 0.5, 0.08: 1, 0.2: 0}).delete)
@ -300,9 +318,13 @@ class Camera:
nice('Applied!')
elif talk:
note('Incomplete camera setup\nNo changes applied.')
if s.__class__.__ins__ == s: s.__class__.__ins__ = None
if s.__class__.__ins__ == s:
s.__class__.__ins__ = None
"""Controls overlay"""
class Overlay:
__lst__ = None
"""Place nodes"""
@ -403,7 +425,9 @@ class Overlay:
new = [x, y, z]
for i in range(3):
c = s.colors[[1, 0, 2][i]]
if s.old[i] == new[i]: s.pset(i,c[0]); continue
if s.old[i] == new[i]:
s.pset(i, c[0])
continue
t = s.pos[i]
t.text = str(round(new[i], 5))
s.pset(i, c[1])
@ -417,30 +441,39 @@ class Overlay:
s.nub[1].position = (p[0]+lr*d, p[1]+ud*d)
"""Fade"""
def fade(s, i=0):
if str(ga()) != s.__class__.__lst__: return
if str(ga()) != s.__class__.__lst__:
return
mem = s.nodes()
[tick(1, animate(n, 'opacity', {0: i, 0.5: abs(i-0.7)}).delete) for n in mem]
"""Destroy overlay"""
def destroy(s):
if s.dead: return
if s.dead:
return
s.dead = True
with ga().context:
tick(0.2, lambda: s.fade(0.7))
tick(2, lambda: [n.delete() for n in s.nodes()])
# Mini tools
note = lambda t, b=False: (push(t,color=(1,1,0)),gs('block').play() if b else None)
nice = lambda t: (push(t,color=(0,1,0)),gs('dingSmallHigh').play())
SCM = lambda b: (setattr(Camera,'__lst__',b),SSCM(b))
scale = lambda v,s: (v[0]*s,v[1]*s,v[2]*s)
cross = lambda a,b: (a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0])
sub = lambda a,b: (a[0]-b[0],a[1]-b[1],a[2]-b[2])
add = lambda a,b: (a[0]+b[0],a[1]+b[1],a[2]+b[2])
def note(t, b=False): return (push(t, color=(1, 1, 0)), gs('block').play() if b else None)
def nice(t): return (push(t, color=(0, 1, 0)), gs('dingSmallHigh').play())
def SCM(b): return (setattr(Camera, '__lst__', b), SSCM(b))
def scale(v, s): return (v[0]*s, v[1]*s, v[2]*s)
def cross(a, b): return (a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0])
def sub(a, b): return (a[0]-b[0], a[1]-b[1], a[2]-b[2])
def add(a, b): return (a[0]+b[0], a[1]+b[1], a[2]+b[2])
def getme(actor=0):
for p in ga().players:
if p.sessionplayer.inputdevice.client_id == -1:
return p.actor if actor else p
def LN(d): me = getme(); [me.assigninput(getattr(IT, k), d[k]) for k in d]
def RESUME():
u = APP.ui_v1
c = APP.classic
@ -448,26 +481,35 @@ def RESUME():
u.clear_main_window()
[z() for z in c.main_menu_resume_callbacks]
c.main_menu_resume_callbacks.clear()
def norm(v):
a, b, c = v
l = sqrt(a**2+b**2+c**2)
return (0, 0, 0) if l == 0 else (a/l, b/l, c/l)
def var(s, v=None):
c = APP.config
s = 'cam_'+s
if v is None: return c.get(s,v)
if v is None:
return c.get(s, v)
c[s] = v
c.commit()
# brobord collide grass
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
has_settings_ui = lambda s: True
show_settings_ui = lambda s, src: s.ui(source=src)
def has_settings_ui(s): return True
def show_settings_ui(s, src): return s.ui(source=src)
col = (0.18, 0.18, 0.18)
def __init__(s):
o = igm._refresh_in_game
def e(f, *a, **k):
r = o(f, *a, **k)
b = bw(
@ -506,7 +548,8 @@ class byBordd(Plugin):
parent=gsw('overlay_stack'),
scale_origin_stack_offset=off
)
s.back = lambda b=True: (cw(w,transition=['out_right','out_scale'][bool(source) and b]),gs('swish').play() if b else None)
s.back = lambda b=True: (
cw(w, transition=['out_right', 'out_scale'][bool(source) and b]), gs('swish').play() if b else None)
cw(w, on_outside_click_call=s.back)
b = Camera.__yes__
t = [
@ -561,17 +604,26 @@ class byBordd(Plugin):
nice('Resetored original settings!')
"""Copy last"""
def copy(s):
if not CIS(): note('Unsupported!',True); return
if not CIS():
note('Unsupported!', True)
return
g = s.gather()
if not g[1]: note('Apply something first!',True); return
if not g[1]:
note('Apply something first!', True)
return
g = [tuple([round(i, 2) for i in j]) for j in g]
COPY(f'from _babase import set_camera_manual as SCM, set_camera_target as SCT, set_camera_position as SCP; SCM(True); SCP(*{g[0]}); SCT(*{g[1]})')
COPY(
f'from _babase import set_camera_manual as SCM, set_camera_target as SCT, set_camera_position as SCP; SCM(True); SCP(*{g[0]}); SCT(*{g[1]})')
nice('Copied command!\nPaste it in dev console anytime to load config!')
"""Load last"""
def load(s):
g = s.gather()
if not g[1]: note('Apply something first!',True); return
if Camera.__yes__: note('Stop camera first!',True); return
if not g[1]:
note('Apply something first!', True)
return
if Camera.__yes__:
note('Stop camera first!', True)
return
SCM(True)
SCP(*g[0])
SCT(*g[1])
@ -579,8 +631,13 @@ class byBordd(Plugin):
"""Start camera"""
def start(s):
a = ga()
if not a: note('Only mapping requires you to be the host!\nYou still can load previous config though',True); return
if not getme(): note('Join the game first!',True); return
if not a:
note('Only mapping requires you to be the host!\nYou still can load previous config though', True)
return
if not getme():
note('Join the game first!', True)
return
s.back(False)
RESUME() if s.main else None
with a.context: Camera()
with a.context:
Camera()

File diff suppressed because it is too large Load diff

View file

@ -44,6 +44,7 @@ from bascenev1 import (
get_game_roster as GGR
)
class Finder:
COL1 = (0, 0.3, 0.3)
COL2 = (0, 0.55, 0.55)
@ -56,6 +57,7 @@ class Finder:
MEM = []
BST = []
SL = None
def __init__(s, src):
s.thr = []
s.ikids = []
@ -232,10 +234,12 @@ class Finder:
maxwidth=170,
h_align='center'
) if c.SL is None else 0
def hl(s, _, p):
[tw(t, color=s.COL3) for t in s.kids]
tw(s.kids[_], color=s.COL4)
s.info(p)
def info(s, p):
[_.delete() for _ in s.ikids]
s.ikids.clear()
@ -270,10 +274,12 @@ class Finder:
textcolor=s.COL4,
oac=Call(CON, i['a'], i['p'], False)
))
def copy(s, t):
s.ding(1, 1)
TIP('Copied to clipboard!')
COPY(t)
def plys(s):
z = []
me = app.plus.get_v1_account_name()
@ -285,24 +291,30 @@ class Finder:
ds = p['display_string']
0 if ds in me else z.append((ds, a))
return sorted(z, key=lambda _: _[0].startswith('\ue030Server'))
def snd(s, t):
l = gs(t)
l.play()
teck(uf(0.14, 0.18), l.stop)
return l
def bye(s):
s.s1.stop()
ocw(s.p, transition='out_scale')
l = s.snd('laser')
f = lambda: teck(0.01,f) if s.p else l.stop()
def f(): return teck(0.01, f) if s.p else l.stop()
f()
def ding(s, i, j):
a = ['Small', '']
x, y = a[i], a[j]
s.snd('ding'+x)
teck(0.1, gs('ding'+y).play)
def fresh(s):
if s.busy: BTW("Still busy!"); return
if s.busy:
BTW("Still busy!")
return
TIP('Fetching servers...')
s.ding(1, 0)
s.busy = True
@ -316,6 +328,7 @@ class Finder:
callback=s.kang,
)
p.run_v1_account_transactions()
def kang(s, r):
c = s.__class__
c.MEM = r['l']
@ -325,6 +338,7 @@ class Finder:
s.thr.append(t)
t.start()
teck(s.MAX*4, s.join)
def join(s):
c = s.__class__
[t.join() for t in s.thr]
@ -335,8 +349,11 @@ class Finder:
TIP(f'Loaded {len(c.MEM)} servers!')
s.ding(0, 1)
s.busy = False
def find(s):
if s.busy: BTW("Still busy!"); return
if s.busy:
BTW("Still busy!")
return
c = s.__class__
if not c.MEM:
BTW('Fetch some servers first!')
@ -356,16 +373,23 @@ class Finder:
s.ci = s.lr = 0
c.BST = c.MEM[:top]
s.cycle()
def cycle(s):
_ = s.__class__.BST[s.ci]
s.ca = _['a']
CON(s.ca, _['p'], False)
s.wait()
def wait(s, i=5):
r = GGR()
if (r != s.lr) and r: s.__class__.BST[s.ci]['roster'] = s.lr = r; return s.next()
if not i: s.__class__.BST[s.ci]['roster'] = []; return s.next()
if (r != s.lr) and r:
s.__class__.BST[s.ci]['roster'] = s.lr = r
return s.next()
if not i:
s.__class__.BST[s.ci]['roster'] = []
return s.next()
teck(0.1, Call(s.wait, i-1))
def next(s):
s.ci += 1
if s.ci >= len(s.__class__.BST):
@ -373,18 +397,22 @@ class Finder:
teck(0.5, s.yay)
return
s.cycle()
def yay(s):
TIP('Cycle finished!')
s.ding(0, 1)
s.busy = False
zw('squad_button').activate()
teck(0.3, byBordd.up)
def ping(s, _):
sock = ping = None
a, p = _['a'], _['p']
sock = socket(IPT(a), SOCK_DGRAM)
try: sock.connect((a,p))
except: ping = None
try:
sock.connect((a, p))
except:
ping = None
else:
st = time()
sock.settimeout(s.MAX)
@ -393,7 +421,8 @@ class Finder:
try:
sock.send(b'\x0b')
r = sock.recv(10)
except: r = None
except:
r = None
if r == b'\x0c':
yes = True
break
@ -403,6 +432,7 @@ class Finder:
_['ping'] = ping
sock.close()
# Patches
bw = lambda *, oac=None, **k: obw(
texture=gt('white'),
@ -432,22 +462,29 @@ cw = lambda *,size=None,oac=None,**k: (p:=ocw(
))
# Global
BTW = lambda t: (push(t,color=(1,1,0)),gs('block').play())
TIP = lambda t: push(t,Finder.COL3)
def BTW(t): return (push(t, color=(1, 1, 0)), gs('block').play())
def TIP(t): return push(t, Finder.COL3)
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
BTN = None
@classmethod
def up(c):
c.BTN.activate() if c.BTN.exists() else None
def __init__(s):
from bauiv1lib import party
p = party.PartyWindow
a = '__init__'
o = getattr(p, a)
setattr(p, a, lambda z, *a, **k: (o(z, *a, **k), s.make(z))[0])
def make(s, z):
sz = (80, 30)
p = z._root_widget

View file

@ -16,12 +16,15 @@ from bascenev1 import (
newnode
)
class Path:
def __init__(s, node, holder=None):
if node.body == 'crate': return
if node.body == 'crate':
return
s.node, s.kids = node, []
s.me = holder
s.spy()
def spy(s):
n = s.node
if not n.exists():
@ -29,7 +32,8 @@ class Path:
s.kids.clear()
return
[_.delete() for _ in s.kids]; s.kids.clear()
[_.delete() for _ in s.kids]
s.kids.clear()
ip = n.position
iv = n.velocity
@ -81,6 +85,8 @@ class Path:
# brobord collide grass
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
def __init__(s):
_ = __import__('bascenev1lib').actor.bomb.Bomb

View file

@ -69,8 +69,10 @@ from ast import (
Name
)
class PlugTools(TAB):
KEY = 'PT_BY'
def __init__(s):
s.bys = META()
s.bad = []
@ -79,6 +81,7 @@ class PlugTools(TAB):
s.eye = look()
s.e = False
s.spy()
def spy(s):
b = 0
for _ in s.bys.copy():
@ -87,10 +90,12 @@ class PlugTools(TAB):
push(f'Plugin {_} suddenly disappeared!\nAnd so, was removed from list.', color=(1, 1, 0))
gs('block').play()
s.eye = look()
if s.hl() == _: s.hl(None)
if s.hl() == _:
s.hl(None)
b = 1
sp = app.plugins.plugin_specs.get(_, 0)
if not sp: continue
if not sp:
continue
p = app.plugins
if getattr(sp, 'enabled', False):
o = s.sp.plugin
@ -100,8 +105,10 @@ class PlugTools(TAB):
p.plugin_specs.pop(o)
del s.sp.plugin, o
collect()
try: reload(modules[NAM(_,0)])
except: pass
try:
reload(modules[NAM(_, 0)])
except:
pass
continue
if MT(_) != s.mem[_] and _ not in s.bad:
s.bad.append(_)
@ -120,7 +127,8 @@ class PlugTools(TAB):
nu = []
if df:
for dd in df:
try: _ = kang(dd)
try:
_ = kang(dd)
except:
eye.remove(dd)
continue
@ -132,12 +140,16 @@ class PlugTools(TAB):
b = 1
if nu:
l = len(nu)
push(f"Found {l} new plugin{['s',''][l==1]}:\n{', '.join(nu)}\nSee what to do with {['it','them'][l!=1]}",color=(1,1,0))
push(f"Found {l} new plugin{['s', ''][l == 1]}:\n{', '.join(nu)}\nSee what to do with {['it', 'them'][l != 1]}", color=(
1, 1, 0))
gs('dingSmallHigh').play()
if b:
try: s.request_refresh()
except RuntimeError: pass
try:
s.request_refresh()
except RuntimeError:
pass
teck(0.1, s.spy)
@override
def refresh(s):
# Preload
@ -231,7 +243,8 @@ class PlugTools(TAB):
for i in range(5):
for j in range(2):
k = j*5+i+s.i*10
if k >= len(s.bys): break
if k >= len(s.bys):
break
t = s.bys[k]
tw = GSW(t)
s.button(
@ -253,7 +266,8 @@ class PlugTools(TAB):
call=s.prev,
disabled=s.i == 0
)
if s.height <= 100: return
if s.height <= 100:
return
# Expanded logs
t = s.logs
h = 25
@ -273,7 +287,9 @@ class PlugTools(TAB):
xf = 0
for i in range(z):
p[0] += [l*sk, 0][i == 0]
if xf: xf = 0; continue
if xf:
xf = 0
continue
j = t[i]
k = t[i+1] if (i+1) < z else j
if j == '\\' and k == 'n':
@ -288,13 +304,16 @@ class PlugTools(TAB):
v_align='top',
scale=sk
)
def hl(s, i=None):
i and deek()
c = app.config
if i is None: return c.get(s.KEY,None)
if i is None:
return c.get(s.KEY, None)
c[s.KEY] = i
c.commit()
s.request_refresh()
def _load(s):
h = ['load', 'reload'][s.e]
ex, er = s.load()
@ -309,10 +328,12 @@ class PlugTools(TAB):
s.request_refresh()
return
s.logs = 'No errors'
if ex is False: return
if ex is False:
return
push(h.title()+'ed '+s.by, color=(0, 1, 0))
gs('gunCocking').play()
s.request_refresh()
def load(s):
_ = s.by
if _ in s.bad:
@ -326,25 +347,35 @@ class PlugTools(TAB):
p.active_plugins.remove(o)
del s.sp.plugin
collect()
try: m = reload(modules[NAM(_,0)])
try:
m = reload(modules[NAM(_, 0)])
except KeyError:
gs('block').play()
push(f"{s.by} is malformed!\nAre you sure there's no errors?", color=(1, 1, 0))
return (False, 0)
except Exception as ex: return (ex,ERR())
else: m = __import__(NAM(_,0))
try: cls = getattr(m,_.split('.',1)[1])
except Exception as ex: return (ex,ERR())
try: ins = cls()
except Exception as ex: return (ex,ERR())
try: ins.on_app_running()
except Exception as ex: return (ex,ERR())
except Exception as ex:
return (ex, ERR())
else:
m = __import__(NAM(_, 0))
try:
cls = getattr(m, _.split('.', 1)[1])
except Exception as ex:
return (ex, ERR())
try:
ins = cls()
except Exception as ex:
return (ex, ERR())
try:
ins.on_app_running()
except Exception as ex:
return (ex, ERR())
s.sp = PluginSpec(class_path=_, loadable=True)
s.sp.enabled = True
s.sp.plugin = ins
p.plugin_specs[_] = s.sp
p.active_plugins.append(ins)
return (0, 0)
def metadata(s):
f = PAT(s.sp.class_path)
info = []
@ -409,21 +440,30 @@ class PlugTools(TAB):
info.append("File Exists: No")
push('\n'.join(info))
gs('powerup01').play()
def next(s):
deek()
s.i += 1
s.request_refresh()
def prev(s):
deek()
s.i -= 1
s.request_refresh()
MT = lambda _: stat(PAT(_))
GSW = lambda s: sw(s,suppress_warning=True)
NAM = lambda _,py=1: _.split('.',1)[0]+['','.py'][py]
PAT = lambda _: join(ROOT,NAM(_))
def MT(_): return stat(PAT(_))
def GSW(s): return sw(s, suppress_warning=True)
def NAM(_, py=1): return _.split('.', 1)[0]+['', '.py'][py]
def PAT(_): return join(ROOT, NAM(_))
ROOT = env()['python_directory_user']
META = lambda: app.meta.scanresults.exports_by_name('babase.Plugin')
def META(): return app.meta.scanresults.exports_by_name('babase.Plugin')
def look():
python_files = []
try:
@ -437,6 +477,8 @@ def look():
except PermissionError:
pass
return python_files
def kang(file_path):
with open(file_path, 'r', encoding='utf-8') as f:
source_code = f.read()
@ -460,11 +502,15 @@ def kang(file_path):
(isinstance(base, Attribute) and base.attr == 'Plugin' and isinstance(base.value, Name) and base.value.id == 'babase'):
return f"{filename_without_ext}.{node.name}"
return None
deek = lambda: gs('deek').play()
def deek(): return gs('deek').play()
# brobord collide grass
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
def __init__(s):
C = PlugTools

View file

@ -41,17 +41,23 @@ from bauiv1 import (
Call
)
class Power(TAB):
def __init__(s):
s.j = [None,None,None]; s.ji = 1
s.j = [None, None, None]
s.ji = 1
[setattr(s, _, None) for _ in 'cpnh']
[setattr(s, _, {}) for _ in ['rr', 'hi']]
[setattr(s, _, []) for _ in ['cm', 'og', 'r', 'ls']]
[setattr(s, _, 0) for _ in ['ii', 'eii', 'ci', 're', 'ri', 'eri', 'li', 'lii']]
teck(3, s.spy)
def rf(s):
try: s.request_refresh()
except RuntimeError: pass
try:
s.request_refresh()
except RuntimeError:
pass
def spy(s):
_ = 0
r = ROST()
@ -79,23 +85,30 @@ class Power(TAB):
s.og = ng
ls = ng[-1]
ch = s.cm[0][1] if len(s.cm) else 0
if ch and ls == s.cm[0][0]: s.cm[0] = (ls,ch+1)
else: s.cm.insert(0,(ls,1))
if s.ci: s.ci += 1
if ch and ls == s.cm[0][0]:
s.cm[0] = (ls, ch+1)
else:
s.cm.insert(0, (ls, 1))
if s.ci:
s.ci += 1
_ = 1
_ and s.rf()
teck(0.1, s.spy)
@override
def refresh(s):
sf = s.width / 1605.3
zf = s.height / 648
x = -s.width/2
T, B = s.text, s.button
if len(s.r) and s.ri >= len(s.r): s.ri = len(s.r) - 1
if len(s.r) and s.eri >= len(s.r): s.eri = len(s.r) - 1
if len(s.r) and s.ri >= len(s.r):
s.ri = len(s.r) - 1
if len(s.r) and s.eri >= len(s.r):
s.eri = len(s.r) - 1
if s.j[0] == 'JRejoin' and s.ji <= s.re:
s.ji = s.re + 1
push('Job time cannot be less than rejoin time\nwhen job is JRejoin. Updated job time to '+str(s.ji),color=(1,1,0))
push('Job time cannot be less than rejoin time\nwhen job is JRejoin. Updated job time to ' +
str(s.ji), color=(1, 1, 0))
if s.height > 100:
B(
cs(sc.UP_ARROW),
@ -121,8 +134,10 @@ class Power(TAB):
scale=1 if w < (290*sf) else (290*sf)/w
)
for i, z in enumerate(s.rr.items()):
if i < s.eri: continue
if i>=(s.eri+7): break
if i < s.eri:
continue
if i >= (s.eri+7):
break
n, g = z
c, p = g
w = GSW(n)
@ -159,7 +174,8 @@ class Power(TAB):
'Players',
size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 140*zf),
call=Call(push,'\n'.join([' '.join([f'{i}={j}' for i,j in _.items()]) for _ in s.p]) if s.p else ''),
call=Call(push, '\n'.join(
[' '.join([f'{i}={j}' for i, j in _.items()]) for _ in s.p]) if s.p else ''),
disabled=bb or (not s.p)
)
B(
@ -199,7 +215,8 @@ class Power(TAB):
pos=(x + 311 * sf, 606*zf),
disabled=not s.h,
label_scale=1 if w < 390 * sf else (390 * sf)/w,
call=Call(push,f"{t}\nHosted on build {getattr(s.h,'build_number','0')}" if t.strip() else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
call=Call(push, f"{t}\nHosted on build {getattr(s.h, 'build_number', '0')}" if t.strip(
) else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
)
w = GSW(a)
B(
@ -250,7 +267,8 @@ class Power(TAB):
str(s.re or 0.1),
size=(131 * sf, 35*zf),
pos=(x + 444 * sf, 454*zf),
call=Call(push,f"Rejoins after {s.re or 0.1} second{['','s'][s.re!=1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
call=Call(
push, f"Rejoins after {s.re or 0.1} second{['', 's'][s.re != 1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
)
B(
'-',
@ -272,8 +290,10 @@ class Power(TAB):
style='bright'
)
for i, e in enumerate(s.hi.items()):
if i < s.eii: continue
if i >= (s.eii+9): break
if i < s.eii:
continue
if i >= (s.eii+9):
break
g, v = e
_, a = g
n, p = v
@ -374,8 +394,10 @@ class Power(TAB):
pos=(x+1320 * sf, 330 * zf)
)
for i, g in enumerate(s.cm):
if i < s.ci: continue
if i >= s.ci+15: break
if i < s.ci:
continue
if i >= s.ci+15:
break
i = i - s.ci
m, _ = g
sn, ms = m.split(': ', 1)
@ -446,8 +468,10 @@ class Power(TAB):
pos=(x+875*sf, 232*zf)
)
for _, g in enumerate(s.ls):
if _ < s.li: continue
if _ >= s.li+16: break
if _ < s.li:
continue
if _ >= s.li+16:
break
_ = _ - s.li
l, t = g
B(
@ -490,8 +514,10 @@ class Power(TAB):
scale=1 if w < (200*sf) else (200*sf)/w
)
for i, z in enumerate(s.rr.items()):
if i < s.ri: continue
if i>=(s.ri+3): break
if i < s.ri:
continue
if i >= (s.ri+3):
break
n, g = z
c, p = g
w = GSW(n)
@ -522,7 +548,8 @@ class Power(TAB):
'Players',
size=(120 * sf, 27),
pos=(x + 287 * sf, s.height-62),
call=Call(push,'\n'.join([' '.join([f'{i}={j}' for i,j in _.items()]) for _ in s.p]) if s.p else ''),
call=Call(push, '\n'.join(
[' '.join([f'{i}={j}' for i, j in _.items()]) for _ in s.p]) if s.p else ''),
disabled=bb or (not s.p)
)
B(
@ -611,7 +638,8 @@ class Power(TAB):
pos=(x + 732 * sf, s.height-34),
disabled=not s.h,
label_scale=1 if w < 290 * sf else (290 * sf)/w,
call=Call(push,f"{t}\nHosted on build {getattr(s.h,'build_number','0')}" if t.strip() else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
call=Call(push, f"{t}\nHosted on build {getattr(s.h, 'build_number', '0')}" if t.strip(
) else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
)
w = GSW(a)
B(
@ -662,7 +690,8 @@ class Power(TAB):
str(s.re or 0.1),
size=(50 * sf, 27),
pos=(x + 1035 * sf, s.height-62),
call=Call(push,f"Rejoins after {s.re or 0.1} second{['','s'][s.re!=1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
call=Call(
push, f"Rejoins after {s.re or 0.1} second{['', 's'][s.re != 1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
)
B(
'-',
@ -678,8 +707,10 @@ class Power(TAB):
style='bright'
)
for i, e in enumerate(s.hi.items()):
if i < s.ii: continue
if i >= (s.ii+3): break
if i < s.ii:
continue
if i >= (s.ii+3):
break
g, v = e
_, a = g
n, p = v
@ -734,16 +765,21 @@ class Power(TAB):
pos=(x + 1469 * sf, s.height-90),
size=(130 * sf, 27)
)
def log(s, t):
s.ls.append((t, NOW()))
if s.lii < 99:
s.lii += 1
if s.li == s.lii-17: s.li += 1
else: s.ls.pop(0)
if s.li == s.lii-17:
s.li += 1
else:
s.ls.pop(0)
s.rf()
def mv(s, a, i):
setattr(s, a, getattr(s, a)+i)
s.rf()
def job(s, f, j):
s.j = j
s.lf = f
@ -751,38 +787,62 @@ class Power(TAB):
if f is not None:
s._job(f)
push('Job started', color=(1, 1, 0))
else: push('Job stopped',color=(1,1,0))
else:
push('Job stopped', color=(1, 1, 0))
s.rf()
def _job(s, f):
if f != s.lf: return
if f != s.lf:
return
s.log(f'[{s.lii:02}] [{s.j[0]}] {s.hd}')
f(); teck(s.ji or 0.1,Call(s._job,f))
f()
teck(s.ji or 0.1, Call(s._job, f))
def prv(s, c, p, n):
s.c, s.p, s.n = c, p, n
s.rf()
def chk(s, pn):
y = 0
for n, g in s.rr.items():
c, p = g
if n == pn: y = 1
if n == pn:
y = 1
else:
for _ in p:
if pn in [_['name'],_['name_full']]: y = 1
if y: s.prv(c,p,n); break
if pn in [_['name'], _['name_full']]:
y = 1
if y:
s.prv(c, p, n)
break
HAS = app.ui_v1.has_main_window
SAVE = app.classic.save_ui_state
KICK = lambda f: DISC(f())
FORCE = lambda: teck(0.7 if HAS() else 0.1,lambda: 0 if HAS() else app.classic.return_to_main_menu_session_gracefully())
def KICK(f): return DISC(f())
def FORCE(): return teck(0.7 if HAS() else 0.1, lambda: 0 if HAS()
else app.classic.return_to_main_menu_session_gracefully())
JOIN = lambda *a: (SAVE() or 1) and CON(*a)
GSW = lambda s: sw(s,suppress_warning=True)
REJOIN = lambda a,p,f: ((LEAVE() if getattr(HOST(),'name','') else 0) or 1) and teck(f() or 0.1,Call(JOIN,a,p,False))
COPY = lambda s: ((CST(s) or 1) if CIS() else push('Clipboard not supported!')) and push('Copied!',color=(0,1,0))
NOW = lambda: DT.now().strftime("%H:%M:%S")
def GSW(s): return sw(s, suppress_warning=True)
def REJOIN(a, p, f): return ((LEAVE() if getattr(HOST(), 'name', '') else 0)
or 1) and teck(f() or 0.1, Call(JOIN, a, p, False))
def COPY(s): return ((CST(s) or 1) if CIS() else push(
'Clipboard not supported!')) and push('Copied!', color=(0, 1, 0))
def NOW(): return DT.now().strftime("%H:%M:%S")
# brobord collide grass
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
def __init__(s):
C = Power

View file

@ -66,6 +66,7 @@ from threading import Thread
from os import listdir as ls
from struct import unpack
class Replay:
VER = '2.5'
COL1 = (0.18, 0.18, 0.18)
@ -73,10 +74,13 @@ class Replay:
COL3 = (0, 1, 0)
COL4 = (0, 1, 1)
BUSY = False
@classmethod
def BUS(c, b=None):
if b is None: return c.BUSY
if b is None:
return c.BUSY
c.BUSY = b
def __init__(s, source=None):
s.sl = s.rn = s.buf = None
s.ohno = False
@ -85,7 +89,8 @@ class Replay:
src=source.get_screen_space_center(),
p=GOS(),
size=(400, 500),
oac=lambda:(ocw(s.p,transition='out_scale' if source and source.exists() else 'out_left'),s.snd('laser'),s.trs.stop())
oac=lambda: (ocw(s.p, transition='out_scale' if source and source.exists()
else 'out_left'), s.snd('laser'), s.trs.stop())
)
s.trs = s.snd('powerup01')
s.tw(
@ -133,25 +138,36 @@ class Replay:
oac=Call(s.con, [s.show, s.copy, s.play][_]),
icon=gt(['folder', 'file', 'nextLevelIcon'][_])
)
if _ == 2: s.psrc = b
if _ == 2:
s.psrc = b
def snd(s, t):
h = gs(t)
h.play()
teck(uf(0.14, 0.17), h.stop)
return h
def get(s):
return join(s.rd, s.rn)
def copy(s):
s.snd('dingSmallHigh')
COPY(s.get())
push('Copied replay path to clipboard!', color=s.COL3)
def show(s):
gs('ding').play()
push(s.get(), color=s.COL3)
def con(s, f):
if s.sl is None: BTW('Select a replay!'); return
if ON(): BTW('A replay is already running!'); return
if s.sl is None:
BTW('Select a replay!')
return
if ON():
BTW('A replay is already running!')
return
return f()
def hl(s, i, n):
if s.sl == i:
s.psrc = s.kids[i]
@ -161,11 +177,14 @@ class Replay:
s.rn = n
[otw(_, color=s.COL2) for _ in s.kids]
otw(s.kids[i], color=s.COL3)
def play(s):
if s.BUS(): return
if s.BUS():
return
s.BUS(True)
gs('deek').play()
s.load()
def load(s):
src = s.psrc.get_screen_space_center()
if s.psrc.get_widget_type() == 'text':
@ -209,20 +228,27 @@ class Replay:
teck(0.5, Thread(target=s.calc).start)
teck(0.5, s.fpar)
s.spy(s.calc2)
def fpar(s):
a, b = s.par
teck(0.1, s.fpar) if (a != b) and (not s.ohno) else 0
if not a: return
if not a:
return
p = a/b*100
t = '\u2588'*int(p)+'\u2591'*int(100-p)
if not s.ohno:
try:
otw(s.tpar, text=t)
otw(s.tpar2, text=f'{a} of {b} bytes read')
except: return
except:
return
def calc(s):
try: s.buf = GMS(s._h,s.get(),s.par)
except: s.buf = 0
try:
s.buf = GMS(s._h, s.get(), s.par)
except:
s.buf = 0
def calc2(s, t):
otw(s.st, text='Starting...' if t else 'Wait what?')
otw(s.tpar2, text=f'result was {t} milleseconds') if t else t
@ -231,6 +257,7 @@ class Replay:
otw(s.tpar, text='pybrp returned zero duration, error?\nclosing this window in 5 seconds')
otw(s.tpar2, text='')
teck(1 if t else 5, Call(s._play, t))
def spy(s, f, i=60):
if not i:
s.buf = None
@ -242,6 +269,7 @@ class Replay:
f(b)
return
teck(0.5, Call(s.spy, f, i-1))
def _play(s, t):
if t == 0:
BTW("Couldn't load replay!")
@ -279,6 +307,7 @@ class Replay:
**k
)
class Player:
TICK = 0.01
COL0 = (0.5, 0, 0)
@ -299,6 +328,7 @@ class Player:
COL15 = (1, 1, 1)
COL16 = (0.1, 0.2, 0.4)
COL17 = (1, 1.7, 2)
def __init__(s, path, duration):
s.path = path
s.du = duration
@ -329,6 +359,7 @@ class Player:
s.sp = 1
s.foc()
s.play()
def mkhd(s):
f = s.hdkids.append
s.tex = ['\u25bc', '\u25b2']
@ -357,9 +388,11 @@ class Player:
texture=gt('white'),
opacity=0.4
))
def killhd(s):
[_.delete() for _ in s.hdkids]
s.hdkids.clear()
def mkui(s):
s.up = True
f = s.kids.append
@ -560,6 +593,7 @@ class Player:
maxwidth=ix-20
)
f(s.ok3)
def mkcamui(s):
f = s.camkids.append
x, y = (19, 100)
@ -684,6 +718,7 @@ class Player:
maxwidth=205,
max_height=40
))
def zoom(s, i):
n = round(s.camz+i*0.05, 2)
if s.camz == 1 and not s.gay:
@ -698,6 +733,7 @@ class Player:
s.camz = n
otw(s.ztw, text=f'x{round(0.5**(n-1), 2)}' if n != 1 else 'x1.0' if s.gay else 'auto')
s.zom()
def look(s):
s.killui()
s.killhd()
@ -709,20 +745,26 @@ class Player:
s.mksnui()
s.mksnb()
s.mksni()
def _look(s, x, y):
o = s.caml or GCT()
sk = 0.7*s.camz
s.caml = n = (o[0]+x*sk, o[1]+y*sk, o[2])
0 if s.snma else otw(s.snt, text=str(RND(n)))
s.camp = GCP()
if s.camz != 1: s.gay = True
if s.camz != 1:
s.gay = True
s.camz = 1
def foc(s):
s.tfoc = tock(0.01, s.focus, repeat=True)
def focus(s):
SCT(*s.caml) if s.caml else 0
def zom(s):
if s.camz == 1 and not s.gay: return
if s.camz == 1 and not s.gay:
return
z = s.camz
tx, ty, tz = GCT()
px, py, pz = s.camp
@ -730,16 +772,20 @@ class Player:
npy = ty+(py-ty)*z
npz = tz+(pz-tz)*z
SCP(npx, npy, npz)
def fockill(s):
s.tfoc = None
def snsave(s):
s.snbye()
def snbye(s):
s.killsn()
s.mkui()
s.mkhd()
s.fkek(0, 0.1)
s.pro()
def mksns(s):
x, y = res()
sz = 50
@ -759,6 +805,7 @@ class Player:
))
for i in range(a)
for j in range(b)]
def mksnui(s):
f = s.snuikids.append
f(iw(
@ -879,10 +926,13 @@ class Player:
position=(x/2-k, y/2+[k-h, -k+h*0.3][j]),
size=(3, h*1.1)
))
def killsnui(s):
[_.delete() for _ in s.snuikids]
def snhide(s):
if getattr(s,'snbusy',0): return
if getattr(s, 'snbusy', 0):
return
s.snma = not s.snma
s.snbusy = True
if s.snma:
@ -893,6 +943,7 @@ class Player:
obw(s.snbtn, texture=gt('white'))
s.snanim(36, 7, 1)
iw(s.sni, opacity=0)
def mksni(s):
s.sni = iw(
parent=s.p,
@ -903,6 +954,7 @@ class Player:
texture=gt('white')
)
s.snkids.append(s.sni)
def mksnb(s):
s.snbtn = s.bw(
p=s.p,
@ -914,6 +966,7 @@ class Player:
oac=s.snhide
)
s.snkids.append(s.snbtn)
def snanim(s, a, b, i):
a += (163/35)*i
b += 0.2*i
@ -930,11 +983,14 @@ class Player:
obw(s.snbtn, label='Cinema Mode')
return
teck(0.004, Call(s.snanim, a, b, i))
def killsn(s):
s.killsnui()
[_.delete() for _ in s.snkids]
def all(s):
return s.trash()+s.hdkids+s.snkids
def sntar(s):
s.caml = None
otw(s.snt, text='players')
@ -942,6 +998,7 @@ class Player:
s.camz = 1
s.gay = False
SCM(False)
def sncancel(s):
s.caml = s.camlo
s.camp = s.campo
@ -950,6 +1007,7 @@ class Player:
SCM(True)
SCP(*s.camp)
s.snbye()
def cam(s):
if s.camon:
s.camon = False
@ -959,6 +1017,7 @@ class Player:
else:
s.camon = True
s.mkcamui()
def camr(s):
SCM(False)
s.caml = None
@ -966,27 +1025,35 @@ class Player:
s.camz = 1
otw(s.ltw, text='players')
otw(s.ztw, text='auto')
def fcam(s, i=0, a=0.1):
if i > 0.4 or i < 0:
if a < 0: s.cambg.delete()
if a < 0:
s.cambg.delete()
return
if not s.cambg.exists():
return
if not s.cambg.exists(): return
iw(s.cambg, opacity=i)
iw(s.cambg2, opacity=i)
teck(0.02, Call(s.fcam, i+a, a))
def rloop(s):
s.loop()
s.fixps()
s.hm('Replay', f'Version {Replay.VER} BETA', s.COL12, s.COL13)
def killui(s):
s.up = s.camon = False
[_.delete() for _ in s.trash()]
s.kids.clear()
s.camkids.clear()
def trash(s):
return s.kids+s.camkids
def kek(s):
if getattr(s,'kekbusy',0): return
if getattr(s, 'kekbusy', 0):
return
s.kekbusy = True
if getattr(s, 'tbye', 0) and getattr(s, 'frbro', 0):
s.frbro = s.tbye = False
@ -1003,11 +1070,15 @@ class Player:
s.mkui()
s.pro()
teck(0.21, Call(setattr, s, 'kekbusy', 0))
def fkek(s, i=0, a=0.1):
if i > 0.4 or i < 0: return
if not s.bg.exists(): return
if i > 0.4 or i < 0:
return
if not s.bg.exists():
return
iw(s.bg, opacity=i)
teck(0.02, Call(s.fkek, i+a, a))
def hm(s, t1, t2, c1, c2):
if getattr(s, 'tbye', 0) and getattr(s, 'frbro', 0):
s.frbro = s.tbye = False
@ -1017,53 +1088,70 @@ class Player:
otw(s.ok3, text=t2, color=c2)
s.fok()
s.okt = tock(1.5, s.unhm)
def unhm(s):
s.fok(0.7, -0.1)
[otw(_, text='') for _ in [s.ok2, s.ok3] if _.exists()]
def fok(s, i=0, a=0.1):
if i > 0.7 or i < 0: return
if not s.ok.exists(): return
if i > 0.7 or i < 0:
return
if not s.ok.exists():
return
iw(s.ok, opacity=i)
teck(0.02, Call(s.fok, i+a, a))
def toggle(s, dry=False, shut=False):
if not dry: s.ps = not s.ps
if not dry:
s.ps = not s.ps
t = cs(getattr(sc, ['PAUSE', 'PLAY'][s.ps]+'_BUTTON'))
otw(s.tt, text=t)
if not dry:
if not shut: s.hm(['Resume','Pause'][s.ps],basename(s.path)+f' of {getsize(s.path)} bytes',s.COL6,s.COL7)
if not shut:
s.hm(['Resume', 'Pause'][s.ps], basename(s.path) +
f' of {getsize(s.path)} bytes', s.COL6, s.COL7)
if s.ps:
s.stop()
PAUSE()
else:
s.play()
RESUME()
def fixps(s):
if not s.ps: return
if not s.ps:
return
s.toggle(shut=True)
teck(0.02, Call(s.toggle, shut=True))
def clock(s):
t = time()
r = t - s.rt
s.rt = t
s.rn += r * s.sp
def boost(s, i):
n = GET()+i
SET(n)
s.sp = 2**n
h = 'Snail Mode' if s.sp == 0.0625 else 'Slow Motion' if s.sp < 1 else 'Quake Pro' if s.sp == 16 else 'Fast Motion' if s.sp > 1 else 'Normal Speed'
s.hm(h, f'Current exponent: x{s.sp}', s.COL2, s.COL3)
def play(s):
s.rt = time()
s.clock()
s.ptplay()
s.clt = tock(s.TICK, s.clock, repeat=True)
def stop(s):
s.clt = None
s.ptkill()
def ptkill(s):
s.pt = None
def ptplay(s):
s.pt = tock(s.TICK, s.pro, repeat=True)
def seek(s, i):
h = ['Forward by', 'Rewind by'][i == -1]
i = i * s.sp
@ -1079,6 +1167,7 @@ class Player:
s.fixps()
i = abs(round(i, 2))
s.hm('Seek', h+f" {i} second{['s', ''][i == 1]}", s.COL4, s.COL5)
def jump(s, p):
t = s.ds * p
s.st = s.rn-t
@ -1086,11 +1175,15 @@ class Player:
SEEK(t)
s.rt = time()
s.fixps()
def bye(s):
if getattr(s,'frbro',0): s._bye(); return
if getattr(s, 'frbro', 0):
s._bye()
return
s.hm('Exit', 'Press again to confirm', s.COL0, s.COL1)
s.frbro = True
s.tbye = tock(1.5, Call(setattr, s, 'frbro', False))
def _bye(s):
fade(0, time=0.75, endcall=Call(fade, 1, time=0.75))
gs('deek').play()
@ -1099,17 +1192,22 @@ class Player:
s.fockill()
s.tbye = None
SCM(False)
def pro(s):
t = s.rn-s.st
if s.rn-s.st >= s.ds: s.loop()
if s.rn-s.st >= s.ds:
s.loop()
x, y = s.nbp
p = (t/s.ds)*s.px
try:
iw(s.nb, position=(x+p, y))
otw(s.ct, text=FOR(t))
except ReferenceError: pass
except ReferenceError:
pass
def replay(s):
SEEK(-10**10)
def loop(s):
s.st = s.rn = 0
s.replay()
@ -1123,68 +1221,104 @@ class Player:
**k
)
# Tools
BYE = lambda: app.classic.return_to_main_menu_session_gracefully(reset_ui=False)
BTW = lambda t: (gs('block').play() or 1) and push(t,color=(1,1,0))
GOS = lambda: gsw('overlay_stack')
FOR = lambda t: strftime('%H:%M:%S',gmtime(t))
SCL = lambda a,b,c=None: ((s:=app.ui_v1.uiscale), a if s is UIS.SMALL else b if s is UIS.MEDIUM else (c or b))[1]
RND = lambda t: type(t)([round(_,1) for _ in t])
def BYE(): return app.classic.return_to_main_menu_session_gracefully(reset_ui=False)
def BTW(t): return (gs('block').play() or 1) and push(t, color=(1, 1, 0))
def GOS(): return gsw('overlay_stack')
def FOR(t): return strftime('%H:%M:%S', gmtime(t))
def SCL(a, b, c=None): return ((s := app.ui_v1.uiscale),
a if s is UIS.SMALL else b if s is UIS.MEDIUM else (c or b))[1]
def RND(t): return type(t)([round(_, 1) for _ in t])
# pybrp
Z = lambda _:[0]*_
G_FREQS = lambda:[
def Z(_): return [0]*_
def G_FREQS(): return [
101342, 9667, 3497, 1072, 0, 3793, *Z(2), 2815, 5235, *Z(3), 3570, *Z(3),
1383, *Z(3), 2970, *Z(2), 2857, *Z(8), 1199, *Z(30),
1494, 1974, *Z(12), 1351, *Z(122), 1475, *Z(65)
]
CMD_NAMES=lambda:{0:'BaseTimeStep',1:'StepSceneGraph',2:'AddSceneGraph',3:'RemoveSceneGraph',4:'AddNode',5:'NodeOnCreate',6:'SetForegroundScene',7:'RemoveNode',8:'AddMaterial',9:'RemoveMaterial',10:'AddMaterialComponent',11:'AddTexture',12:'RemoveTexture',13:'AddMesh',14:'RemoveMesh',15:'AddSound',16:'RemoveSound',17:'AddCollisionMesh',18:'RemoveCollisionMesh',19:'ConnectNodeAttribute',20:'NodeMessage',21:'SetNodeAttrFloat',22:'SetNodeAttrInt32',23:'SetNodeAttrBool',24:'SetNodeAttrFloats',25:'SetNodeAttrInt32s',26:'SetNodeAttrString',27:'SetNodeAttrNode',28:'SetNodeAttrNodeNull',29:'SetNodeAttrNodes',30:'SetNodeAttrPlayer',31:'SetNodeAttrPlayerNull',32:'SetNodeAttrMaterials',33:'SetNodeAttrTexture',34:'SetNodeAttrTextureNull',35:'SetNodeAttrTextures',36:'SetNodeAttrSound',37:'SetNodeAttrSoundNull',38:'SetNodeAttrSounds',39:'SetNodeAttrMesh',40:'SetNodeAttrMeshNull',41:'SetNodeAttrMeshes',42:'SetNodeAttrCollisionMesh',43:'SetNodeAttrCollisionMeshNull',44:'SetNodeAttrCollisionMeshes',45:'PlaySoundAtPosition',46:'PlaySound',47:'EmitBGDynamics',48:'EndOfFile',49:'DynamicsCorrection',50:'ScreenMessageBottom',51:'ScreenMessageTop',52:'AddData',53:'RemoveData',54:'CameraShake'}
def CMD_NAMES(): return {0: 'BaseTimeStep', 1: 'StepSceneGraph', 2: 'AddSceneGraph', 3: 'RemoveSceneGraph', 4: 'AddNode', 5: 'NodeOnCreate', 6: 'SetForegroundScene', 7: 'RemoveNode', 8: 'AddMaterial', 9: 'RemoveMaterial', 10: 'AddMaterialComponent', 11: 'AddTexture', 12: 'RemoveTexture', 13: 'AddMesh', 14: 'RemoveMesh', 15: 'AddSound', 16: 'RemoveSound', 17: 'AddCollisionMesh', 18: 'RemoveCollisionMesh', 19: 'ConnectNodeAttribute', 20: 'NodeMessage', 21: 'SetNodeAttrFloat', 22: 'SetNodeAttrInt32', 23: 'SetNodeAttrBool', 24: 'SetNodeAttrFloats', 25: 'SetNodeAttrInt32s', 26: 'SetNodeAttrString', 27: 'SetNodeAttrNode', 28: 'SetNodeAttrNodeNull',
29: 'SetNodeAttrNodes', 30: 'SetNodeAttrPlayer', 31: 'SetNodeAttrPlayerNull', 32: 'SetNodeAttrMaterials', 33: 'SetNodeAttrTexture', 34: 'SetNodeAttrTextureNull', 35: 'SetNodeAttrTextures', 36: 'SetNodeAttrSound', 37: 'SetNodeAttrSoundNull', 38: 'SetNodeAttrSounds', 39: 'SetNodeAttrMesh', 40: 'SetNodeAttrMeshNull', 41: 'SetNodeAttrMeshes', 42: 'SetNodeAttrCollisionMesh', 43: 'SetNodeAttrCollisionMeshNull', 44: 'SetNodeAttrCollisionMeshes', 45: 'PlaySoundAtPosition', 46: 'PlaySound', 47: 'EmitBGDynamics', 48: 'EndOfFile', 49: 'DynamicsCorrection', 50: 'ScreenMessageBottom', 51: 'ScreenMessageTop', 52: 'AddData', 53: 'RemoveData', 54: 'CameraShake'}
class _H:
class _N:
def __init__(self):
self.l, self.r, self.p, self.f = -1, -1, 0, 0
def __init__(self):
gf, self.nodes = G_FREQS(), [self._N()for _ in range(511)]
for i in range(256):self.nodes[i].f=gf[i]
for i in range(256):
self.nodes[i].f = gf[i]
nc = 256
while nc < 511:
s1, s2 = -1, -1
i = 0
while self.nodes[i].p!=0:i+=1
s1=i;i+=1
while self.nodes[i].p!=0:i+=1
s2=i;i+=1
while self.nodes[i].p != 0:
i += 1
s1 = i
i += 1
while self.nodes[i].p != 0:
i += 1
s2 = i
i += 1
while i < nc:
if self.nodes[i].p == 0:
if self.nodes[s1].f > self.nodes[s2].f:
if self.nodes[i].f<self.nodes[s1].f:s1=i
elif self.nodes[i].f<self.nodes[s2].f:s2=i
if self.nodes[i].f < self.nodes[s1].f:
s1 = i
elif self.nodes[i].f < self.nodes[s2].f:
s2 = i
i += 1
self.nodes[nc].f = self.nodes[s1].f+self.nodes[s2].f
self.nodes[s1].p = self.nodes[s2].p = nc-255
self.nodes[nc].r, self.nodes[nc].l = s1, s2
nc += 1
def decompress(self, src):
if not src:return b''
if not src:
return b''
rem, comp = src[0] & 15, src[0] >> 7
if not comp:return src
if not comp:
return src
out, ptr, l = bytearray(), src[1:], len(src)
bl=((l-1)*8)-rem;bit=0
bl = ((l-1)*8)-rem
bit = 0
while bit < bl:
m_bit=(ptr[bit>>3]>>(bit&7))&1;bit+=1
m_bit = (ptr[bit >> 3] >> (bit & 7)) & 1
bit += 1
if m_bit:
n = 510
while n >= 256:
if bit>=bl:raise ValueError("Incomplete Huffman code")
p_bit=(ptr[bit>>3]>>(bit&7))&1;bit+=1
if bit >= bl:
raise ValueError("Incomplete Huffman code")
p_bit = (ptr[bit >> 3] >> (bit & 7)) & 1
bit += 1
n = self.nodes[n].l if p_bit == 0 else self.nodes[n].r
out.append(n)
else:
if bit+8>bl:break
if bit+8 > bl:
break
bi, b_in_b = bit >> 3, bit & 7
val = ptr[bi]if b_in_b == 0 else (ptr[bi] >> b_in_b) | (ptr[bi+1] << (8-b_in_b))
out.append(val&255);bit+=8
out.append(val & 255)
bit += 8
return bytes(out)
def GMS(_h, brp_path, par):
total_ms = 0
with open(brp_path, 'rb') as f:
@ -1192,7 +1326,8 @@ def GMS(_h, brp_path, par):
par[1] = f.tell()
f.seek(6)
while True:
if par: par[0] = f.tell()
if par:
par[0] = f.tell()
b_data = f.read(1)
if not b_data:
break
@ -1220,20 +1355,26 @@ def GMS(_h, brp_path, par):
if sub_data and sub_data[0] == 0:
total_ms += sub_data[1]
sub_off += 2 + sub_size
if par: par[0] = par[1]
if par:
par[0] = par[1]
return total_ms
# brobord collide grass
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
def __init__(s):
from bauiv1lib.ingamemenu import InGameMenuWindow as m
a = '_refresh_in_game'; o = getattr(m,a)
a = '_refresh_in_game'
o = getattr(m, a)
setattr(m, a, lambda v, *a, **k: (s.mk(v), o(v, *a, **k))[1])
from bauiv1lib.watch import WatchWindow as n
b = '__init__'; p = getattr(n,b)
b = '__init__'
p = getattr(n, b)
setattr(n, b, lambda v, *a, **k: (p(v, *a, **k), s.mk(v, 1))[0])
def mk(s, v, i=0):
if i:
x = v._width/2+SCL(v._scroll_width*-0.5+93, 0)+100
@ -1248,4 +1389,3 @@ class byBordd(Plugin):
size=(140, 50) if i else (90, 35),
oac=lambda: Replay(source=s.b)
)

View file

@ -19,8 +19,11 @@ from bascenev1 import (
# ba_meta require api 9
# ba_meta export babase.Plugin
class byBordd(Plugin):
__init__ = lambda s: (setattr(s,'la',None),z(5,s.ear))[1]
def __init__(s): return (setattr(s, 'la', None), z(5, s.ear))[1]
def ear(s):
a = gcm()
if a and s.la != a[-1]:
@ -28,4 +31,3 @@ class byBordd(Plugin):
push(a[-1], (1, 1, 1), True)
s.la = a[-1]
z(0.1, s.ear)