Шейдер ударной волны для взрывов (#633)

* Adds shock wave shader (#2631)

Co-authored-by: DOOM <N/A>
Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com>

* add explosive shockwave

* add shockwave to fireball

* wd edit

* cleanup

* remove exgreande beeping sound

---------

Co-authored-by: Vero <73014819+vero5123@users.noreply.github.com>
Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com>
This commit is contained in:
ThereDrD
2024-08-17 23:59:11 +03:00
committed by GitHub
parent ad5ebecbd6
commit 3a6b3ee1f4
36 changed files with 468 additions and 23 deletions

View File

@@ -29,6 +29,8 @@
ignited: true
- type: IgniteOnCollide
fireStacks: 0.35
- type: ExplosionEffect # WD
maxShrapnel: 0
- type: entity
id: ProjectileAnomalyFireball

View File

@@ -743,6 +743,8 @@
totalIntensity: 150 # a ~2 tile radius
intensitySlope: 5
maxIntensity: 10
- type: ExplosionEffect # WD
maxShrapnel: 0
- type: entity
id: BulletGrenadeFlash
@@ -781,6 +783,8 @@
totalIntensity: 175 # about a ~6 tile radius
intensitySlope: 1
maxIntensity: 10
- type: ExplosionEffect # WD
maxShrapnel: 0
- type: entity
id: BulletGrenadeEMP

View File

@@ -36,10 +36,18 @@
Primed: { state: primed }
Unprimed: { state: icon }
- type: entity # WD
abstract: true
parent: GrenadeBase
id: GrenadeBaseExplosionEffect
components:
- type: ExplosionEffect
maxShrapnel: 0
- type: entity
name: explosive grenade
description: Grenade that creates a small but devastating explosion.
parent: GrenadeBase
parent: GrenadeBaseExplosionEffect # WD
id: ExGrenade
components:
- type: ExplodeOnTrigger
@@ -49,13 +57,8 @@
intensitySlope: 3
totalIntensity: 120 # about a ~4 tile radius
canCreateVacuum: false
- type: OnUseTimerTrigger
beepSound:
path: "/Audio/Effects/beep1.ogg"
params:
volume: 5
initialBeepDelay: 0
beepInterval: 2 # 2 beeps total (at 0 and 2)
- type: ExplosionEffect
maxShrapnel: 12
- type: entity
name: flashbang
@@ -102,7 +105,7 @@
- type: entity
name: syndicate minibomb
description: A syndicate-manufactured explosive used to stow destruction and cause chaos.
parent: GrenadeBase
parent: GrenadeBaseExplosionEffect # WD
id: SyndieMiniBomb
components:
- type: Sprite
@@ -235,7 +238,7 @@
- type: entity
name: the nuclear option
description: Please don't throw it, think of the children.
parent: GrenadeBase
parent: GrenadeBaseExplosionEffect # WD
id: NuclearGrenade
components:
- type: Sprite
@@ -326,7 +329,7 @@
- type: entity
name: holy hand grenade
description: O Lord, bless this thy hand grenade, that with it thou mayst blow thine enemies to tiny bits, in thy mercy.
parent: GrenadeBase
parent: GrenadeBaseExplosionEffect # WD
id: HolyHandGrenade
components:
- type: Sprite

View File

@@ -35,6 +35,8 @@
explosionType: FireBomb # WD EDIT
totalIntensity: 120 # ~ 5 tile radius
canCreateVacuum: false
- type: ExplosionEffect # WD
maxShrapnel: 0
- type: entity
id: WeldingFuelTankFull

View File

@@ -0,0 +1,92 @@
- type: entity
id: ExplosionEffectGrenade
noSpawn: true
components:
- type: Sprite
sprite: White/Effects/grenade_explosion.rsi
state: grenade
- type: TimedDespawn
lifetime: 0.5
- type: entity
id: ExplosionEffectGrenadeShockWave
components:
- type: TimedDespawn
lifetime: 0.5
- type: ExplosionShockWave
falloffPower: 30
sharpness: 15
width: 1.3
- type: entity
id: ExplosionEffectShrapnel1
noSpawn: true
components:
- type: CollisionWake
- type: Physics
bodyType: Dynamic
fixedRotation: true
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
density: 20
mask:
- ItemMask
restitution: 0.3
friction: 0
- type: Sprite
sprite: White/Objects/Weapons/shrapnel.rsi
state: shrapnel_bright1
- type: TimedDespawn
lifetime: 0.5
# - type: DeleteOnCollide
- type: entity
parent: ExplosionEffectShrapnel1
id: ExplosionEffectShrapnel2
noSpawn: true
components:
- type: Sprite
state: shrapnel_bright2
# Не работает каким-то хуем
- type: entity
parent: BaseBullet
id: ProjectileShrapnel
name: shrapnel
noSpawn: true
components:
- type: Sprite
sprite: White/Objects/Weapons/Ammunition/Projectiles/shotgun_projectiles.rsi
layers:
- state: buckshot
- type: Fixtures
fixtures:
projectile:
shape:
!type:PhysShapeAabb
bounds: "-0.1,-0.1,0.1,0.1"
hard: false
mask:
- Impassable
- BulletImpassable
- LowImpassable
fly-by:
shape: !type:PhysShapeCircle
radius: 1.5
layer:
- Impassable
- MidImpassable
- HighImpassable
- LowImpassable
hard: False
- type: Projectile
damage:
types:
Piercing: 12
deleteOnCollide: true
- type: TimedDespawn
lifetime: 0.5

View File

@@ -0,0 +1,4 @@
- type: shader
id: ShockWave
kind: source
path: "/Textures/White/Shaders/shock_wave.swsl"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -0,0 +1,26 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cmss13 at https://github.com/cmss13-devs/cmss13/blob/add6123ac6b3263f257e4b233ef5a8fea5d3d317/icons/effects/explosion.dmi",
"size": {
"x": 48,
"y": 48
},
"states": [
{
"name": "grenade",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

View File

@@ -0,0 +1,23 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cmss13 at https://github.com/cmss13-devs/cmss13/blob/a86a9e2e57e5c00195cab704713a4962e8bc973a/icons/obj/items/weapons/projectiles.dmi",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "autocannon"
},
{
"name": "buckshot"
},
{
"name": "beanbag"
},
{
"name": "flechette"
}
]
}

View File

@@ -0,0 +1,55 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cmss13 at https://github.com/cmss13-devs/cmss13/blob/a86a9e2e57e5c00195cab704713a4962e8bc973a/icons/obj/items/weapons/projectiles.dmi",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "shrapnelshot"
},
{
"name": "shrapnelshot_bit"
},
{
"name": "shrapnel_glass"
},
{
"name": "shrapnel_light"
},
{
"name": "shrapnel_xeno"
},
{
"name": "shrapnel_human"
},
{
"name": "shrapnel_human1"
},
{
"name": "shrapnel_human2"
},
{
"name": "shrapnel_bright1",
"delays": [
[
0.1,
0.1,
0.1
]
]
},
{
"name": "shrapnel_bright2",
"delays": [
[
0.1,
0.1,
0.1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View File

@@ -0,0 +1,40 @@
uniform sampler2D SCREEN_TEXTURE;
uniform highp vec2 renderScale;
uniform lowp int count;
uniform highp vec2[10] position;
uniform highp float[10] sharpness;
uniform highp float[10] width;
uniform highp float[10] falloffPower;
void fragment() {
highp vec2 coord = FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy;
highp float ratio = SCREEN_PIXEL_SIZE.y / SCREEN_PIXEL_SIZE.x * 0.6;
for (int i = 0; i < count; ++i) {
highp vec2 WaveCentre = position[i];
highp float Dist = distance(
vec2(coord.x, coord.y * ratio),
vec2(WaveCentre.x, WaveCentre.y * ratio)
);
// removes the first few frames of the "animation"
Dist = max(Dist, 0.13);
highp float offset = (TIME - floor(TIME)) / TIME;
highp float CurrentTime = TIME * offset;
if (Dist <= (CurrentTime + 0.1) && Dist >= (CurrentTime - 0.1)) {
highp float Diff = Dist - CurrentTime;
highp float ScaleDiff = 1.0 - pow(abs(Diff * sharpness[i]), width[i]);
highp float DiffTime = Diff * ScaleDiff;
highp vec2 DiffTexCoord = normalize(coord - WaveCentre);
coord += (DiffTexCoord * DiffTime) / (CurrentTime * Dist * falloffPower[i]);
highp vec4 Color = zTextureSpec(SCREEN_TEXTURE, coord);
Color += (Color * ScaleDiff) / (CurrentTime * Dist * 40.0);
COLOR = Color;
} else {
COLOR = zTextureSpec(SCREEN_TEXTURE, UV);
}
}
}