mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2026-08-15 13:03:08 +00:00
[ci] apply-plugin-metadata-and-formatting
This commit is contained in:
parent
c0a6e8e4e5
commit
ebfad79f51
4 changed files with 515 additions and 438 deletions
|
|
@ -2426,6 +2426,48 @@
|
|||
"md5sum": "d8002dfc93be74d71f8e6e4aacfe6fd1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"better_camera_shake": {
|
||||
"description": "This plugin makes the camera only shake when an explosion hits a player character, begone excessive camera shaking!",
|
||||
"external_url": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "DinoWattz",
|
||||
"email": "",
|
||||
"discord": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"1.0.0": null
|
||||
}
|
||||
},
|
||||
"enhanced_effects": {
|
||||
"description": "Explosions affect character colors, slow-mo tnt, fair colored shields, a trippy background screen and maybe more in the future!",
|
||||
"external_url": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "DinoWattz",
|
||||
"email": "",
|
||||
"discord": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"1.0.0": null
|
||||
}
|
||||
},
|
||||
"sleep_on_afk": {
|
||||
"description": "Staying idle for 40 seconds will make your character fall asleep, they need rest too..",
|
||||
"external_url": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "DinoWattz",
|
||||
"email": "",
|
||||
"discord": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"1.0.0": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,356 +26,363 @@ plugman = dict(
|
|||
)
|
||||
|
||||
# Camera shake only on player impact
|
||||
|
||||
|
||||
def new__init__(
|
||||
self,
|
||||
*,
|
||||
position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
blast_radius: float = 2.0,
|
||||
blast_type: str = 'normal',
|
||||
source_player: bs.Player | None = None,
|
||||
hit_type: str = 'explosion',
|
||||
hit_subtype: str = 'normal',
|
||||
):
|
||||
"""Instantiate with given values."""
|
||||
self,
|
||||
*,
|
||||
position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
blast_radius: float = 2.0,
|
||||
blast_type: str = 'normal',
|
||||
source_player: bs.Player | None = None,
|
||||
hit_type: str = 'explosion',
|
||||
hit_subtype: str = 'normal',
|
||||
):
|
||||
"""Instantiate with given values."""
|
||||
|
||||
# bah; get off my lawn!
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
# bah; get off my lawn!
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
|
||||
super(type(self), self).__init__()
|
||||
super(type(self), self).__init__()
|
||||
|
||||
shared = SharedObjects.get()
|
||||
factory = BombFactory.get()
|
||||
shared = SharedObjects.get()
|
||||
factory = BombFactory.get()
|
||||
|
||||
self.blast_type = blast_type
|
||||
self._source_player = source_player
|
||||
self.hit_type = hit_type
|
||||
self.hit_subtype = hit_subtype
|
||||
self.radius = blast_radius
|
||||
self.blast_type = blast_type
|
||||
self._source_player = source_player
|
||||
self.hit_type = hit_type
|
||||
self.hit_subtype = hit_subtype
|
||||
self.radius = blast_radius
|
||||
|
||||
# Set our position a bit lower so we throw more things upward.
|
||||
rmats = (factory.blast_material, shared.attack_material)
|
||||
self.node = bs.newnode(
|
||||
'region',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'position': (position[0], position[1] - 0.1, position[2]),
|
||||
'scale': (self.radius, self.radius, self.radius),
|
||||
'type': 'sphere',
|
||||
'materials': rmats,
|
||||
},
|
||||
)
|
||||
# Set our position a bit lower so we throw more things upward.
|
||||
rmats = (factory.blast_material, shared.attack_material)
|
||||
self.node = bs.newnode(
|
||||
'region',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'position': (position[0], position[1] - 0.1, position[2]),
|
||||
'scale': (self.radius, self.radius, self.radius),
|
||||
'type': 'sphere',
|
||||
'materials': rmats,
|
||||
},
|
||||
)
|
||||
|
||||
bs.timer(0.05, self.node.delete)
|
||||
bs.timer(0.05, self.node.delete)
|
||||
|
||||
# Throw in an explosion and flash.
|
||||
evel = (velocity[0], max(-1.0, velocity[1]), velocity[2])
|
||||
explosion = bs.newnode(
|
||||
'explosion',
|
||||
attrs={
|
||||
'position': position,
|
||||
'velocity': evel,
|
||||
'radius': self.radius,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
if self.blast_type == 'ice':
|
||||
explosion.color = (0, 0.05, 0.4)
|
||||
# Throw in an explosion and flash.
|
||||
evel = (velocity[0], max(-1.0, velocity[1]), velocity[2])
|
||||
explosion = bs.newnode(
|
||||
'explosion',
|
||||
attrs={
|
||||
'position': position,
|
||||
'velocity': evel,
|
||||
'radius': self.radius,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
if self.blast_type == 'ice':
|
||||
explosion.color = (0, 0.05, 0.4)
|
||||
|
||||
bs.timer(1.0, explosion.delete)
|
||||
bs.timer(1.0, explosion.delete)
|
||||
|
||||
if self.blast_type != 'ice':
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(1.0 + random.random() * 4),
|
||||
emit_type='tendrils',
|
||||
tendril_type='thin_smoke',
|
||||
)
|
||||
if self.blast_type != 'ice':
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 4),
|
||||
count=int(1.0 + random.random() * 4),
|
||||
emit_type='tendrils',
|
||||
tendril_type='ice' if self.blast_type == 'ice' else 'smoke',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
emit_type='distortion',
|
||||
spread=1.0 if self.blast_type == 'tnt' else 2.0,
|
||||
tendril_type='thin_smoke',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 4),
|
||||
emit_type='tendrils',
|
||||
tendril_type='ice' if self.blast_type == 'ice' else 'smoke',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
emit_type='distortion',
|
||||
spread=1.0 if self.blast_type == 'tnt' else 2.0,
|
||||
)
|
||||
|
||||
# And emit some shrapnel.
|
||||
if self.blast_type == 'ice':
|
||||
# And emit some shrapnel.
|
||||
if self.blast_type == 'ice':
|
||||
|
||||
def emit() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=30,
|
||||
spread=2.0,
|
||||
scale=0.4,
|
||||
chunk_type='ice',
|
||||
emit_type='stickers',
|
||||
)
|
||||
def emit() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=30,
|
||||
spread=2.0,
|
||||
scale=0.4,
|
||||
chunk_type='ice',
|
||||
emit_type='stickers',
|
||||
)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
|
||||
elif self.blast_type == 'sticky':
|
||||
elif self.blast_type == 'sticky':
|
||||
|
||||
def emit() -> None:
|
||||
def emit() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
spread=0.7,
|
||||
chunk_type='slime',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.5,
|
||||
spread=0.7,
|
||||
chunk_type='slime',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=15,
|
||||
scale=0.6,
|
||||
chunk_type='slime',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=20,
|
||||
scale=0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(6.0 + random.random() * 12),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
|
||||
elif self.blast_type == 'impact':
|
||||
|
||||
def emit() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.8,
|
||||
chunk_type='metal',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.4,
|
||||
chunk_type='metal',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=20,
|
||||
scale=0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(8.0 + random.random() * 15),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
|
||||
else: # Regular or land mine bomb shrapnel.
|
||||
|
||||
def emit() -> None:
|
||||
if self.blast_type != 'tnt':
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
spread=0.7,
|
||||
chunk_type='slime',
|
||||
chunk_type='rock',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.5,
|
||||
spread=0.7,
|
||||
chunk_type='slime',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=15,
|
||||
scale=0.6,
|
||||
chunk_type='slime',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=20,
|
||||
scale=0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(6.0 + random.random() * 12),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
chunk_type='rock',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=30,
|
||||
scale=1.0 if self.blast_type == 'tnt' else 0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(18.0 + random.random() * 20),
|
||||
scale=1.0 if self.blast_type == 'tnt' else 0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
# TNT throws splintery chunks.
|
||||
if self.blast_type == 'tnt':
|
||||
|
||||
elif self.blast_type == 'impact':
|
||||
|
||||
def emit() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.8,
|
||||
chunk_type='metal',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.4,
|
||||
chunk_type='metal',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=20,
|
||||
scale=0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(8.0 + random.random() * 15),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
|
||||
else: # Regular or land mine bomb shrapnel.
|
||||
|
||||
def emit() -> None:
|
||||
if self.blast_type != 'tnt':
|
||||
def emit_splinters() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
chunk_type='rock',
|
||||
count=int(20.0 + random.random() * 25),
|
||||
scale=0.8,
|
||||
spread=1.0,
|
||||
chunk_type='splinter',
|
||||
)
|
||||
|
||||
bs.timer(0.01, emit_splinters)
|
||||
|
||||
# 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,
|
||||
velocity=velocity,
|
||||
count=int(4.0 + random.random() * 8),
|
||||
scale=0.5,
|
||||
chunk_type='rock',
|
||||
count=int(10.0 + random.random() * 20),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=30,
|
||||
scale=1.0 if self.blast_type == 'tnt' else 0.7,
|
||||
chunk_type='spark',
|
||||
emit_type='stickers',
|
||||
)
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(18.0 + random.random() * 20),
|
||||
scale=1.0 if self.blast_type == 'tnt' else 0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
|
||||
# TNT throws splintery chunks.
|
||||
if self.blast_type == 'tnt':
|
||||
bs.timer(0.02, emit_extra_sparks)
|
||||
|
||||
def emit_splinters() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(20.0 + random.random() * 25),
|
||||
scale=0.8,
|
||||
spread=1.0,
|
||||
chunk_type='splinter',
|
||||
)
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
|
||||
bs.timer(0.01, emit_splinters)
|
||||
lcolor = (0.6, 0.6, 1.0) if self.blast_type == 'ice' else (1, 0.3, 0.1)
|
||||
light = bs.newnode(
|
||||
'light',
|
||||
attrs={
|
||||
'position': position,
|
||||
'volume_intensity_scale': 10.0,
|
||||
'color': lcolor,
|
||||
},
|
||||
)
|
||||
|
||||
# Every now and then do a sparky one.
|
||||
if self.blast_type == 'tnt' or random.random() < 0.1:
|
||||
scl = random.uniform(0.6, 0.9)
|
||||
scorch_radius = light_radius = self.radius
|
||||
if self.blast_type == 'tnt':
|
||||
light_radius *= 1.4
|
||||
scorch_radius *= 1.15
|
||||
scl *= 3.0
|
||||
|
||||
def emit_extra_sparks() -> None:
|
||||
bs.emitfx(
|
||||
position=position,
|
||||
velocity=velocity,
|
||||
count=int(10.0 + random.random() * 20),
|
||||
scale=0.8,
|
||||
spread=1.5,
|
||||
chunk_type='spark',
|
||||
)
|
||||
iscale = 1.6
|
||||
bs.animate(
|
||||
light,
|
||||
'intensity',
|
||||
{
|
||||
0: 2.0 * iscale,
|
||||
scl * 0.02: 0.1 * iscale,
|
||||
scl * 0.025: 0.2 * iscale,
|
||||
scl * 0.05: 17.0 * iscale,
|
||||
scl * 0.06: 5.0 * iscale,
|
||||
scl * 0.08: 4.0 * iscale,
|
||||
scl * 0.2: 0.6 * iscale,
|
||||
scl * 2.0: 0.00 * iscale,
|
||||
scl * 3.0: 0.0,
|
||||
},
|
||||
)
|
||||
bs.animate(
|
||||
light,
|
||||
'radius',
|
||||
{
|
||||
0: light_radius * 0.2,
|
||||
scl * 0.05: light_radius * 0.55,
|
||||
scl * 0.1: light_radius * 0.3,
|
||||
scl * 0.3: light_radius * 0.15,
|
||||
scl * 1.0: light_radius * 0.05,
|
||||
},
|
||||
)
|
||||
bs.timer(scl * 3.0, light.delete)
|
||||
|
||||
bs.timer(0.02, emit_extra_sparks)
|
||||
# Make a scorch that fades over time.
|
||||
scorch = bs.newnode(
|
||||
'scorch',
|
||||
attrs={
|
||||
'position': position,
|
||||
'size': scorch_radius * 0.5,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
if self.blast_type == 'ice':
|
||||
scorch.color = (1, 1, 1.5)
|
||||
|
||||
# It looks better if we delay a bit.
|
||||
bs.timer(0.05, emit)
|
||||
bs.animate(scorch, 'presence', {3.000: 1, 13.000: 0})
|
||||
bs.timer(13.0, scorch.delete)
|
||||
|
||||
lcolor = (0.6, 0.6, 1.0) if self.blast_type == 'ice' else (1, 0.3, 0.1)
|
||||
light = bs.newnode(
|
||||
'light',
|
||||
attrs={
|
||||
'position': position,
|
||||
'volume_intensity_scale': 10.0,
|
||||
'color': lcolor,
|
||||
},
|
||||
)
|
||||
if self.blast_type == 'ice':
|
||||
factory.hiss_sound.play(position=light.position)
|
||||
|
||||
scl = random.uniform(0.6, 0.9)
|
||||
scorch_radius = light_radius = self.radius
|
||||
if self.blast_type == 'tnt':
|
||||
light_radius *= 1.4
|
||||
scorch_radius *= 1.15
|
||||
scl *= 3.0
|
||||
lpos = light.position
|
||||
factory.random_explode_sound().play(position=lpos)
|
||||
factory.debris_fall_sound.play(position=lpos)
|
||||
|
||||
iscale = 1.6
|
||||
bs.animate(
|
||||
light,
|
||||
'intensity',
|
||||
{
|
||||
0: 2.0 * iscale,
|
||||
scl * 0.02: 0.1 * iscale,
|
||||
scl * 0.025: 0.2 * iscale,
|
||||
scl * 0.05: 17.0 * iscale,
|
||||
scl * 0.06: 5.0 * iscale,
|
||||
scl * 0.08: 4.0 * iscale,
|
||||
scl * 0.2: 0.6 * iscale,
|
||||
scl * 2.0: 0.00 * iscale,
|
||||
scl * 3.0: 0.0,
|
||||
},
|
||||
)
|
||||
bs.animate(
|
||||
light,
|
||||
'radius',
|
||||
{
|
||||
0: light_radius * 0.2,
|
||||
scl * 0.05: light_radius * 0.55,
|
||||
scl * 0.1: light_radius * 0.3,
|
||||
scl * 0.3: light_radius * 0.15,
|
||||
scl * 1.0: light_radius * 0.05,
|
||||
},
|
||||
)
|
||||
bs.timer(scl * 3.0, light.delete)
|
||||
# ↓ We don't need any of this, we're fully trained professionals.
|
||||
# bs.camerashake(intensity=5.0 if self.blast_type == 'tnt' else 1.0)
|
||||
|
||||
# Make a scorch that fades over time.
|
||||
scorch = bs.newnode(
|
||||
'scorch',
|
||||
attrs={
|
||||
'position': position,
|
||||
'size': scorch_radius * 0.5,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
if self.blast_type == 'ice':
|
||||
scorch.color = (1, 1, 1.5)
|
||||
|
||||
bs.animate(scorch, 'presence', {3.000: 1, 13.000: 0})
|
||||
bs.timer(13.0, scorch.delete)
|
||||
|
||||
if self.blast_type == 'ice':
|
||||
factory.hiss_sound.play(position=light.position)
|
||||
|
||||
lpos = light.position
|
||||
# TNT is more epic.
|
||||
if self.blast_type == 'tnt':
|
||||
factory.random_explode_sound().play(position=lpos)
|
||||
factory.debris_fall_sound.play(position=lpos)
|
||||
|
||||
# ↓ We don't need any of this, we're fully trained professionals.
|
||||
#bs.camerashake(intensity=5.0 if self.blast_type == 'tnt' else 1.0)
|
||||
|
||||
# TNT is more epic.
|
||||
if self.blast_type == 'tnt':
|
||||
def _extra_boom() -> None:
|
||||
factory.random_explode_sound().play(position=lpos)
|
||||
|
||||
def _extra_boom() -> None:
|
||||
factory.random_explode_sound().play(position=lpos)
|
||||
bs.timer(0.25, _extra_boom)
|
||||
|
||||
bs.timer(0.25, _extra_boom)
|
||||
def _extra_debris_sound() -> None:
|
||||
factory.debris_fall_sound.play(position=lpos)
|
||||
factory.wood_debris_fall_sound.play(position=lpos)
|
||||
|
||||
def _extra_debris_sound() -> None:
|
||||
factory.debris_fall_sound.play(position=lpos)
|
||||
factory.wood_debris_fall_sound.play(position=lpos)
|
||||
bs.timer(0.4, _extra_debris_sound)
|
||||
|
||||
bs.timer(0.4, _extra_debris_sound)
|
||||
|
||||
bomb.Blast.__init__ = new__init__
|
||||
|
||||
org_handlemessage = bomb.Blast.handlemessage
|
||||
|
||||
|
||||
def new_handlemessage(self, msg: Any, *args, **kwargs) -> Any:
|
||||
org_handlemessage(self, msg, *args, **kwargs)
|
||||
|
||||
if isinstance(msg, ExplodeHitMessage):
|
||||
node = bs.getcollision().opposingnode
|
||||
delegate = node.getdelegate(PlayerSpaz)
|
||||
has_used_camerashake = getattr(self, 'has_used_camerashake', False)
|
||||
if not has_used_camerashake and (delegate and not delegate.shield) and not node.invincible:
|
||||
self.has_used_camerashake = True
|
||||
bs.camerashake(intensity=5.0 if self.blast_type == 'tnt' else 1.0)
|
||||
node = bs.getcollision().opposingnode
|
||||
delegate = node.getdelegate(PlayerSpaz)
|
||||
has_used_camerashake = getattr(self, 'has_used_camerashake', False)
|
||||
if not has_used_camerashake and (delegate and not delegate.shield) and not node.invincible:
|
||||
self.has_used_camerashake = True
|
||||
bs.camerashake(intensity=5.0 if self.blast_type == 'tnt' else 1.0)
|
||||
|
||||
|
||||
bomb.Blast.handlemessage = new_handlemessage
|
||||
|
||||
# ba_meta export babase.Plugin
|
||||
|
||||
|
||||
class Plugin(babase.Plugin):
|
||||
pass
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -25,92 +25,95 @@ plugman = dict(
|
|||
|
||||
# Transparent Background (kinda hacky, works best on pc with high/higher quality 'visuals' setting)
|
||||
BACKGROUND_OPACITY = 0.5
|
||||
|
||||
|
||||
def __modified_background_init(
|
||||
self,
|
||||
fade_time: float = 0.5,
|
||||
start_faded: bool = False,
|
||||
show_logo: bool = False,
|
||||
):
|
||||
super(type(self), self).__init__()
|
||||
self._dying = False
|
||||
self.fade_time = fade_time
|
||||
# We're special in that we create our node in the session
|
||||
# scene instead of the activity scene.
|
||||
# This way we can overlap multiple activities for fades
|
||||
# and whatnot.
|
||||
session = bs.getsession()
|
||||
self._session = weakref.ref(session)
|
||||
with session.context:
|
||||
self.node = bs.newnode(
|
||||
self,
|
||||
fade_time: float = 0.5,
|
||||
start_faded: bool = False,
|
||||
show_logo: bool = False,
|
||||
):
|
||||
super(type(self), self).__init__()
|
||||
self._dying = False
|
||||
self.fade_time = fade_time
|
||||
# We're special in that we create our node in the session
|
||||
# scene instead of the activity scene.
|
||||
# This way we can overlap multiple activities for fades
|
||||
# and whatnot.
|
||||
session = bs.getsession()
|
||||
self._session = weakref.ref(session)
|
||||
with session.context:
|
||||
self.node = bs.newnode(
|
||||
'image',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'fill_screen': True,
|
||||
'texture': bs.gettexture('bg'),
|
||||
'tilt_translate': -0.3,
|
||||
'has_alpha_channel': False,
|
||||
'color': (1, 1, 1),
|
||||
'opacity': BACKGROUND_OPACITY,
|
||||
},
|
||||
)
|
||||
if not start_faded:
|
||||
bs.animate(
|
||||
self.node,
|
||||
'opacity',
|
||||
{0.0: 0.0, self.fade_time: BACKGROUND_OPACITY},
|
||||
loop=False,
|
||||
)
|
||||
if show_logo:
|
||||
logo_texture = bs.gettexture('logo')
|
||||
logo_mesh = bs.getmesh('logo')
|
||||
logo_mesh_transparent = bs.getmesh('logoTransparent')
|
||||
self.logo = bs.newnode(
|
||||
'image',
|
||||
delegate=self,
|
||||
owner=self.node,
|
||||
attrs={
|
||||
'fill_screen': True,
|
||||
'texture': bs.gettexture('bg'),
|
||||
'tilt_translate': -0.3,
|
||||
'has_alpha_channel': False,
|
||||
'color': (1, 1, 1),
|
||||
'opacity': BACKGROUND_OPACITY,
|
||||
'texture': logo_texture,
|
||||
'mesh_opaque': logo_mesh,
|
||||
'mesh_transparent': logo_mesh_transparent,
|
||||
'scale': (0.7, 0.7),
|
||||
'vr_depth': -250,
|
||||
'color': (0.15, 0.15, 0.15),
|
||||
'position': (0, 0),
|
||||
'tilt_translate': -0.05,
|
||||
'absolute_scale': False,
|
||||
},
|
||||
)
|
||||
if not start_faded:
|
||||
bs.animate(
|
||||
self.node,
|
||||
'opacity',
|
||||
{0.0: 0.0, self.fade_time: BACKGROUND_OPACITY},
|
||||
loop=False,
|
||||
self.node.connectattr('opacity', self.logo, 'opacity')
|
||||
# add jitter/pulse for a stop-motion-y look unless we're in VR
|
||||
# in which case stillness is better
|
||||
if not bs.app.env.vr:
|
||||
self.cmb = bs.newnode(
|
||||
'combine', owner=self.node, attrs={'size': 2}
|
||||
)
|
||||
if show_logo:
|
||||
logo_texture = bs.gettexture('logo')
|
||||
logo_mesh = bs.getmesh('logo')
|
||||
logo_mesh_transparent = bs.getmesh('logoTransparent')
|
||||
self.logo = bs.newnode(
|
||||
'image',
|
||||
owner=self.node,
|
||||
attrs={
|
||||
'texture': logo_texture,
|
||||
'mesh_opaque': logo_mesh,
|
||||
'mesh_transparent': logo_mesh_transparent,
|
||||
'scale': (0.7, 0.7),
|
||||
'vr_depth': -250,
|
||||
'color': (0.15, 0.15, 0.15),
|
||||
'position': (0, 0),
|
||||
'tilt_translate': -0.05,
|
||||
'absolute_scale': False,
|
||||
},
|
||||
for attr in ['input0', 'input1']:
|
||||
bs.animate(
|
||||
self.cmb,
|
||||
attr,
|
||||
{0.0: 0.693, 0.05: 0.7, 0.5: 0.693},
|
||||
loop=True,
|
||||
)
|
||||
self.cmb.connectattr('output', self.logo, 'scale')
|
||||
cmb = bs.newnode(
|
||||
'combine', owner=self.node, attrs={'size': 2}
|
||||
)
|
||||
self.node.connectattr('opacity', self.logo, 'opacity')
|
||||
# add jitter/pulse for a stop-motion-y look unless we're in VR
|
||||
# in which case stillness is better
|
||||
if not bs.app.env.vr:
|
||||
self.cmb = bs.newnode(
|
||||
'combine', owner=self.node, attrs={'size': 2}
|
||||
)
|
||||
for attr in ['input0', 'input1']:
|
||||
bs.animate(
|
||||
self.cmb,
|
||||
attr,
|
||||
{0.0: 0.693, 0.05: 0.7, 0.5: 0.693},
|
||||
loop=True,
|
||||
)
|
||||
self.cmb.connectattr('output', self.logo, 'scale')
|
||||
cmb = bs.newnode(
|
||||
'combine', owner=self.node, attrs={'size': 2}
|
||||
)
|
||||
cmb.connectattr('output', self.logo, 'position')
|
||||
# Gen some random keys for that stop-motion-y look.
|
||||
keys = {}
|
||||
timeval = 0.0
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015
|
||||
timeval += random.random() * 0.1
|
||||
bs.animate(cmb, 'input0', keys, loop=True)
|
||||
keys = {}
|
||||
timeval = 0.0
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015 + 0.05
|
||||
timeval += random.random() * 0.1
|
||||
bs.animate(cmb, 'input1', keys, loop=True)
|
||||
cmb.connectattr('output', self.logo, 'position')
|
||||
# Gen some random keys for that stop-motion-y look.
|
||||
keys = {}
|
||||
timeval = 0.0
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015
|
||||
timeval += random.random() * 0.1
|
||||
bs.animate(cmb, 'input0', keys, loop=True)
|
||||
keys = {}
|
||||
timeval = 0.0
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015 + 0.05
|
||||
timeval += random.random() * 0.1
|
||||
bs.animate(cmb, 'input1', keys, loop=True)
|
||||
|
||||
|
||||
def _modified_background_die(self, immediate: bool = False) -> None:
|
||||
session = self._session()
|
||||
|
|
@ -138,10 +141,13 @@ def _modified_background_die(self, immediate: bool = False) -> None:
|
|||
)
|
||||
bs.timer(self.fade_time + 0.1, self.node.delete)
|
||||
|
||||
|
||||
Background.__init__ = __modified_background_init
|
||||
Background._die = _modified_background_die
|
||||
|
||||
# Tools
|
||||
|
||||
|
||||
def blend_toward(
|
||||
rgb: tuple[float, float, float],
|
||||
target: tuple[float, float, float],
|
||||
|
|
@ -177,6 +183,8 @@ def blend_toward(
|
|||
return tuple(clamp01(linear_to_srgb(c)) for c in blended_lin)
|
||||
|
||||
# ba_meta export babase.Plugin
|
||||
|
||||
|
||||
class Plugin(babase.Plugin):
|
||||
def on_app_running(self) -> None:
|
||||
from bascenev1lib.actor.bomb import Blast, ExplodeHitMessage
|
||||
|
|
@ -190,7 +198,8 @@ class Plugin(babase.Plugin):
|
|||
def equip_shields(self, decay: bool = False) -> None:
|
||||
org_equip_shields(self, decay)
|
||||
if self.shield is not None:
|
||||
safe_highlight = bs.safecolor(getattr(self, '_original_highlight', self.node.highlight), target_intensity=0.75)
|
||||
safe_highlight = bs.safecolor(
|
||||
getattr(self, '_original_highlight', self.node.highlight), target_intensity=0.75)
|
||||
self.shield.color = bs.normalized_color(safe_highlight)
|
||||
|
||||
Spaz.equip_shields = equip_shields
|
||||
|
|
@ -208,7 +217,8 @@ class Plugin(babase.Plugin):
|
|||
|
||||
# Pause
|
||||
gnode.paused = True
|
||||
self._pause_timer = bs.DisplayTimer(0.01, bs.CallPartial(setattr, gnode, 'paused', True), True)
|
||||
self._pause_timer = bs.DisplayTimer(
|
||||
0.01, bs.CallPartial(setattr, gnode, 'paused', True), True)
|
||||
|
||||
delay = 0.06
|
||||
|
||||
|
|
@ -217,12 +227,14 @@ class Plugin(babase.Plugin):
|
|||
|
||||
# Slow Motion
|
||||
gnode.slow_motion = True
|
||||
self._slow_motion_timer = bs.DisplayTimer(0.01, bs.CallPartial(setattr, gnode, 'slow_motion', True), True)
|
||||
self._slow_motion_timer = bs.DisplayTimer(
|
||||
0.01, bs.CallPartial(setattr, gnode, 'slow_motion', True), True)
|
||||
|
||||
delay += 0.14
|
||||
|
||||
bs.displaytimer(delay, bs.CallPartial(setattr, self, '_slow_motion_timer', None))
|
||||
bs.displaytimer(delay, bs.CallPartial(setattr, gnode, 'slow_motion', activity.slow_motion))
|
||||
bs.displaytimer(delay, bs.CallPartial(
|
||||
setattr, gnode, 'slow_motion', activity.slow_motion))
|
||||
|
||||
Blast.__init__ = new_init
|
||||
|
||||
|
|
@ -233,58 +245,61 @@ class Plugin(babase.Plugin):
|
|||
org_handlemessage(self, msg, *args, **kwargs)
|
||||
|
||||
if isinstance(msg, ExplodeHitMessage):
|
||||
node = bs.getcollision().opposingnode
|
||||
delegate = node.getdelegate(PlayerSpaz) or node.getdelegate(SpazBot)
|
||||
if (delegate and not delegate.shield) and not node.invincible:
|
||||
if not hasattr(delegate, '_original_color'):
|
||||
delegate._original_color = node.color
|
||||
delegate._original_highlight = node.highlight
|
||||
node = bs.getcollision().opposingnode
|
||||
delegate = node.getdelegate(PlayerSpaz) or node.getdelegate(SpazBot)
|
||||
if (delegate and not delegate.shield) and not node.invincible:
|
||||
if not hasattr(delegate, '_original_color'):
|
||||
delegate._original_color = node.color
|
||||
delegate._original_highlight = node.highlight
|
||||
|
||||
original_color = delegate._original_color
|
||||
original_highlight = delegate._original_highlight
|
||||
original_color = delegate._original_color
|
||||
original_highlight = delegate._original_highlight
|
||||
|
||||
blend_time = 1.0
|
||||
start_time = 6.0
|
||||
end_time = 7.0
|
||||
|
||||
bs.emitfx(
|
||||
position=node.position,
|
||||
velocity=node.velocity,
|
||||
count=int(4.0 + random.random() * 4),
|
||||
emit_type='tendrils',
|
||||
tendril_type='ice' if self.blast_type == 'ice' else 'smoke',
|
||||
)
|
||||
|
||||
explosion_intensity = 0.70 if not self.blast_type == 'tnt' else 0.96
|
||||
|
||||
if self.blast_type == 'ice':
|
||||
explosion_intensity = 0.91
|
||||
explosion_color = (0.07, 0.6, 1.5)
|
||||
elif self.blast_type == 'sticky':
|
||||
explosion_intensity = 0.91
|
||||
explosion_color = (0.07, 0.9, 0.07)
|
||||
blend_time = 1.0
|
||||
start_time = 6.0
|
||||
end_time = 7.0
|
||||
start_time = 1.2
|
||||
end_time = 3.0
|
||||
else:
|
||||
explosion_color = (0.07, 0.03, 0.0)
|
||||
|
||||
bs.emitfx(
|
||||
position=node.position,
|
||||
velocity=node.velocity,
|
||||
count=int(4.0 + random.random() * 4),
|
||||
emit_type='tendrils',
|
||||
tendril_type='ice' if self.blast_type == 'ice' else 'smoke',
|
||||
)
|
||||
blend_color = blend_toward(node.color, explosion_color,
|
||||
explosion_intensity, True)
|
||||
blend_highlight = blend_toward(
|
||||
node.highlight, explosion_color, explosion_intensity-0.03, True)
|
||||
|
||||
explosion_intensity = 0.70 if not self.blast_type == 'tnt' else 0.96
|
||||
|
||||
if self.blast_type == 'ice':
|
||||
explosion_intensity = 0.91
|
||||
explosion_color = (0.07, 0.6, 1.5)
|
||||
elif self.blast_type == 'sticky':
|
||||
explosion_intensity = 0.91
|
||||
explosion_color = (0.07, 0.9, 0.07)
|
||||
blend_time = 1.0
|
||||
start_time = 1.2
|
||||
end_time = 3.0
|
||||
else:
|
||||
explosion_color = (0.07, 0.03, 0.0)
|
||||
bs.animate_array(node, 'color', 3, {
|
||||
blend_time: blend_color,
|
||||
start_time: blend_color,
|
||||
end_time: original_color
|
||||
})
|
||||
bs.animate_array(node, 'highlight', 3, {
|
||||
blend_time: blend_highlight,
|
||||
start_time: blend_highlight,
|
||||
end_time: original_highlight
|
||||
})
|
||||
|
||||
delegate._color_timer = bs.Timer(
|
||||
end_time, bs.CallPartial(delattr, delegate, '_original_color'))
|
||||
delegate._highlight_timer = bs.Timer(
|
||||
end_time, bs.CallPartial(delattr, delegate, '_original_highlight'))
|
||||
|
||||
blend_color = blend_toward(node.color, explosion_color, explosion_intensity, True)
|
||||
blend_highlight = blend_toward(node.highlight, explosion_color, explosion_intensity-0.03, True)
|
||||
|
||||
bs.animate_array(node, 'color', 3, {
|
||||
blend_time: blend_color,
|
||||
start_time: blend_color,
|
||||
end_time: original_color
|
||||
})
|
||||
bs.animate_array(node, 'highlight', 3, {
|
||||
blend_time: blend_highlight,
|
||||
start_time: blend_highlight,
|
||||
end_time: original_highlight
|
||||
})
|
||||
|
||||
delegate._color_timer = bs.Timer(end_time, bs.CallPartial(delattr, delegate, '_original_color'))
|
||||
delegate._highlight_timer = bs.Timer(end_time, bs.CallPartial(delattr, delegate, '_original_highlight'))
|
||||
|
||||
Blast.handlemessage = new_handlemessage
|
||||
Blast.handlemessage = new_handlemessage
|
||||
|
|
|
|||
|
|
@ -16,28 +16,35 @@ plugman = dict(
|
|||
version="1.0.0",
|
||||
)
|
||||
|
||||
INGAME_TIME = 40 # (in seconds)
|
||||
INGAME_TIME = 40 # (in seconds)
|
||||
|
||||
# Spaz Changes
|
||||
|
||||
|
||||
def _afk_sleep_knockout(self, value: float) -> None:
|
||||
if not self.node:
|
||||
return
|
||||
if not self.is_alive() and hasattr(self.getplayer(self), 'sessionplayer'):
|
||||
current_activity = self.getactivity()
|
||||
player = self.getplayer(self).sessionplayer
|
||||
#Pop timer data if the player is dead
|
||||
if current_activity.customdata.get(str(player.id) +'_knockoutTimer') is not None:
|
||||
current_activity.customdata.pop(str(player.id) +'_knockoutTimer')
|
||||
return
|
||||
if not self.node:
|
||||
return
|
||||
if not self.is_alive() and hasattr(self.getplayer(self), 'sessionplayer'):
|
||||
current_activity = self.getactivity()
|
||||
player = self.getplayer(self).sessionplayer
|
||||
# Pop timer data if the player is dead
|
||||
if current_activity.customdata.get(str(player.id) + '_knockoutTimer') is not None:
|
||||
current_activity.customdata.pop(str(player.id) + '_knockoutTimer')
|
||||
return
|
||||
|
||||
self.node.handlemessage('knockout', value)
|
||||
self.node.handlemessage('knockout', value)
|
||||
|
||||
Spaz._afk_sleep_knockout = _afk_sleep_knockout # type: ignore
|
||||
|
||||
Spaz._afk_sleep_knockout = _afk_sleep_knockout # type: ignore
|
||||
|
||||
# Idle Checker
|
||||
|
||||
|
||||
def idle_start(activity: bs.Activity):
|
||||
activity.customdata['afk_timer'] = bs.Timer(0.5, bs.CallStrict(idle_check, activity), repeat=True)
|
||||
|
||||
activity.customdata['afk_timer'] = bs.Timer(
|
||||
0.5, bs.CallStrict(idle_check, activity), repeat=True)
|
||||
|
||||
|
||||
def idle_check(current_activity: bs.Activity):
|
||||
current_session = current_activity.session
|
||||
wait_time = INGAME_TIME if not current_activity.slow_motion else round(INGAME_TIME / 3)
|
||||
|
|
@ -57,7 +64,7 @@ def idle_check(current_activity: bs.Activity):
|
|||
and not getattr(player.activityplayer.actor.node, 'invincible', False)
|
||||
):
|
||||
continue
|
||||
|
||||
|
||||
player_actor = player.activityplayer.actor
|
||||
player_node = player_actor.node
|
||||
player_data = player.activityplayer.customdata
|
||||
|
|
@ -66,22 +73,24 @@ def idle_check(current_activity: bs.Activity):
|
|||
if player_node.move_up_down != 0.0 or player_node.move_left_right != 0.0:
|
||||
player_data['last_input'] = current
|
||||
elif player_turbo_times:
|
||||
highest_turbo_time = player_turbo_times.get(max(player_turbo_times, key=player_turbo_times.get))
|
||||
highest_turbo_time = player_turbo_times.get(
|
||||
max(player_turbo_times, key=player_turbo_times.get))
|
||||
if highest_turbo_time > player_data.get('last_input', current):
|
||||
player_data.update({'last_input': highest_turbo_time })
|
||||
player_data.update({'last_input': highest_turbo_time})
|
||||
player_data['last_input'] = player_data.get('last_input', current)
|
||||
|
||||
|
||||
last_input = max(0, player_data['last_input'])
|
||||
afk_time = int((current - last_input) / 1000)
|
||||
|
||||
#print(player_data)
|
||||
#print(last_input)
|
||||
#print(current)
|
||||
#print(player.getname() + ": " + str(afk_time))
|
||||
#print(wait_time)
|
||||
|
||||
# print(player_data)
|
||||
# print(last_input)
|
||||
# print(current)
|
||||
# print(player.getname() + ": " + str(afk_time))
|
||||
# print(wait_time)
|
||||
|
||||
if afk_time >= wait_time:
|
||||
current_activity.customdata[str(player.id) +'_knockoutTimer'] = bs.Timer(0.1, bs.WeakCallStrict(player_actor._afk_sleep_knockout, 100.0), repeat=True)
|
||||
current_activity.customdata[str(player.id) + '_knockoutTimer'] = bs.Timer(
|
||||
0.1, bs.WeakCallStrict(player_actor._afk_sleep_knockout, 100.0), repeat=True)
|
||||
|
||||
# Make the player's node not an area of interest if it was one
|
||||
if not getattr(player_actor, '_previous_is_area_of_interest', False):
|
||||
|
|
@ -90,8 +99,8 @@ def idle_check(current_activity: bs.Activity):
|
|||
if player_actor._previous_is_area_of_interest:
|
||||
player_node.is_area_of_interest = False
|
||||
|
||||
elif current_activity.customdata.get(str(player.id) +'_knockoutTimer') is not None:
|
||||
current_activity.customdata.pop(str(player.id) +'_knockoutTimer')
|
||||
elif current_activity.customdata.get(str(player.id) + '_knockoutTimer') is not None:
|
||||
current_activity.customdata.pop(str(player.id) + '_knockoutTimer')
|
||||
|
||||
# Restore the player's node area of interest if necessary
|
||||
if getattr(player_actor, '_previous_is_area_of_interest', False):
|
||||
|
|
@ -100,17 +109,21 @@ def idle_check(current_activity: bs.Activity):
|
|||
if hasattr(player_actor, "_previous_is_area_of_interest"):
|
||||
delattr(player_actor, "_previous_is_area_of_interest")
|
||||
|
||||
|
||||
# Setup new activity
|
||||
org_on_begin = bs.Activity.on_begin
|
||||
|
||||
|
||||
def patched_on_begin(self, *args, **kwargs):
|
||||
idle_start(self)
|
||||
|
||||
return org_on_begin(self, *args, **kwargs)
|
||||
|
||||
|
||||
bs.Activity.on_begin = patched_on_begin
|
||||
|
||||
# ba_meta export babase.Plugin
|
||||
|
||||
|
||||
class Plugin(babase.Plugin):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue