Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Shockwaves to Explosions and Xeno Screeches #5938

Merged
merged 14 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

//#define AREA_LAYER 1

#define DISPLACEMENT_PLATE_RENDER_LAYER 1
#define DISPLACEMENT_PLATE_RENDER_TARGET "*DISPLACEMENT_PLATE_RENDER_TARGET"

#define UNDER_TURF_LAYER 1.99

#define TURF_LAYER 2
Expand Down
7 changes: 7 additions & 0 deletions code/_onclick/hud/rendering/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,10 @@
plane = ESCAPE_MENU_PLANE
appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR
render_relay_plane = RENDER_PLANE_MASTER

/atom/movable/screen/plane_master/displacement
name = "displacement plane"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
plane = DISPLACEMENT_PLATE_RENDER_LAYER
render_target = DISPLACEMENT_PLATE_RENDER_TARGET
render_relay_plane = null
4 changes: 4 additions & 0 deletions code/_onclick/hud/rendering/render_plate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
plane = RENDER_PLANE_GAME
render_relay_plane = RENDER_PLANE_MASTER

/atom/movable/screen/plane_master/rendering_plate/game_world/Initialize(mapload, datum/hud/hud_owner)
. = ..()
add_filter("displacer", 1, displacement_map_filter(render_source = DISPLACEMENT_PLATE_RENDER_TARGET, size = 10))

///render plate for OOC stuff like ghosts, hud-screen effects, etc
/atom/movable/screen/plane_master/rendering_plate/non_game
name = "non-game rendering plate"
Expand Down
3 changes: 3 additions & 0 deletions code/datums/autocells/explosion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ as having entered the turf.
if(QDELETED(E))
return

if(power >= 150) //shockwave for anything over 150 power
new /obj/effect/shockwave(epicenter, power/60)

E.power = power
E.power_falloff = falloff
E.falloff_shape = falloff_shape
Expand Down
23 changes: 23 additions & 0 deletions code/game/objects/effects/temporary_visuals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,26 @@
splatter_type = "csplatter"
color = BLOOD_COLOR_SYNTHETIC

//------------------------------------------
//Shockwaves
//------------------------------------------

/obj/effect/shockwave
icon = 'icons/effects/light_overlays/shockwave.dmi'
icon_state = "shockwave"
plane = DISPLACEMENT_PLATE_RENDER_LAYER
pixel_x = -496
pixel_y = -496

/obj/effect/shockwave/Initialize(mapload, radius, speed, easing_type = LINEAR_EASING, y_offset, x_offset)
. = ..()
if(!speed)
speed = 1
if(y_offset)
pixel_y += y_offset
if(x_offset)
pixel_x += x_offset
QDEL_IN(src, 0.5 * radius * speed)
transform = matrix().Scale(32 / 1024, 32 / 1024)
animate(src, time = 0.5 * radius * speed, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5), easing = easing_type)

2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/Abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

playsound(xeno.loc, pick(xeno.screech_sound_effect_list), 75, 0, status = 0)
xeno.visible_message(SPAN_XENOHIGHDANGER("[xeno] emits an ear-splitting guttural roar!"))
xeno.create_shriekwave() //Adds the visual effect. Wom wom wom
xeno.create_shriekwave(14) //Adds the visual effect. Wom wom wom, 14 shriekwaves

for(var/mob/mob in view())
if(mob && mob.client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

playsound(xeno.loc, pick(predalien_roar), 75, 0, status = 0)
xeno.visible_message(SPAN_XENOHIGHDANGER("[xeno] emits a guttural roar!"))
xeno.create_shriekwave(color = "#FF0000")

xeno.create_shriekwave(7) //Adds the visual effect. Wom wom wom, 7 shriekwaves
for(var/mob/living/carbon/carbon in view(7, xeno))
if(ishuman(carbon))
var/mob/living/carbon/human/human = carbon
Expand Down
65 changes: 40 additions & 25 deletions code/modules/mob/living/carbon/xenomorph/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,31 +196,46 @@
overlays_standing[X_LEGCUFF_LAYER] = image("icon" = 'icons/mob/xenos/effects.dmi', "icon_state" = "legcuff", "layer" =-X_LEGCUFF_LAYER)
apply_overlay(X_LEGCUFF_LAYER)

/mob/living/carbon/xenomorph/proc/create_shriekwave(color = null)
var/image/screech_image

var/offset_x = 0
var/offset_y = 0
if(mob_size <= MOB_SIZE_XENO)
offset_x = -7
offset_y = -10

if (color)
screech_image = image("icon"='icons/mob/xenos/overlay_effects64x64.dmi', "icon_state" = "shriek_waves_greyscale") // For Praetorian screech
screech_image.color = color
else
screech_image = image("icon"='icons/mob/xenos/overlay_effects64x64.dmi', "icon_state" = "shriek_waves") //Ehh, suit layer's not being used.

screech_image.pixel_x = offset_x
screech_image.pixel_y = offset_y

screech_image.appearance_flags |= RESET_COLOR

remove_suit_layer()

overlays_standing[X_SUIT_LAYER] = screech_image
apply_overlay(X_SUIT_LAYER)
addtimer(CALLBACK(src, PROC_REF(remove_overlay), X_SUIT_LAYER), 30)
/mob/living/carbon/xenomorph/proc/create_shriekwave(shriekwaves_left)
var/offset_y = 8
if(mob_size == MOB_SIZE_XENO)
offset_y = 24
if(mob_size == MOB_SIZE_IMMOBILE)
offset_y = 28

//the shockwave center is updated eachtime shockwave is called and offset relative to the mob_size.
//due to the speed of the shockwaves, it isn't required to be tied to the exact mob movements
var/epicenter = loc //center of the shockwave, set at the center of the tile that the mob is currently standing on
var/easing = QUAD_EASING | EASE_OUT
var/stage1_radius = rand(11, 12)
var/stage2_radius = rand(9, 11)
var/stage3_radius = rand(8, 10)
var/stage4_radius = 7.5

//shockwaves are iterated, counting down once per shriekwave, with the total amount being determined on the respective xeno ability tile
if(shriekwaves_left > 12)
shriekwaves_left--
new /obj/effect/shockwave(epicenter, stage1_radius, 0.5, easing, offset_y)
addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 2)
return
if(shriekwaves_left > 8)
shriekwaves_left--
new /obj/effect/shockwave(epicenter, stage2_radius, 0.5, easing, offset_y)
addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3)
return
if(shriekwaves_left > 4)
shriekwaves_left--
new /obj/effect/shockwave(epicenter, stage3_radius, 0.5, easing, offset_y)
addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3)
return
if(shriekwaves_left > 1)
shriekwaves_left--
new /obj/effect/shockwave(epicenter, stage4_radius, 0.5, easing, offset_y)
addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3)
return
if(shriekwaves_left == 1)
shriekwaves_left--
new /obj/effect/shockwave(epicenter, 10.5, 0.6, easing, offset_y)

/mob/living/carbon/xenomorph/proc/create_stomp()
remove_suit_layer()
Expand Down
Loading