From 1697b1497c09a4790a66b281feda7807f9a36f44 Mon Sep 17 00:00:00 2001
From: Helg2 <93882977+Helg2@users.noreply.github.com>
Date: Fri, 13 Dec 2024 17:39:23 +0200
Subject: [PATCH] Fixes runtimes with explosion sounds, lobby join button and
warrior jab punch. (#815)
* Update menu_text_objects.dm
* Update explosion.dm
* Update abilities_warrior.dm
* Update explosion.dm
Signed-off-by: Helg2 <93882977+Helg2@users.noreply.github.com>
---------
Signed-off-by: Helg2 <93882977+Helg2@users.noreply.github.com>
---
.../hud/screen_objects/menu_text_objects.dm | 2 +-
code/datums/autocells/explosion.dm | 28 +++++++++----------
.../castes/warrior/abilities_warrior.dm | 9 +++---
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/code/_onclick/hud/screen_objects/menu_text_objects.dm b/code/_onclick/hud/screen_objects/menu_text_objects.dm
index fd1fcd35dcf..f334964fb8f 100644
--- a/code/_onclick/hud/screen_objects/menu_text_objects.dm
+++ b/code/_onclick/hud/screen_objects/menu_text_objects.dm
@@ -92,7 +92,7 @@
maptext = "ПРИСОЕДИНИТЬСЯ"
icon_state = "join"
return
- if(!hud.mymob)
+ if(!hud?.mymob)
return
var/mob/new_player/player = hud.mymob
maptext = "ВЫ: [player.ready ? "" : "НЕ "]ГОТОВЫ"
diff --git a/code/datums/autocells/explosion.dm b/code/datums/autocells/explosion.dm
index 863dfc411d9..bd930c9dcf0 100644
--- a/code/datums/autocells/explosion.dm
+++ b/code/datums/autocells/explosion.dm
@@ -265,7 +265,6 @@ as having entered the turf.
var/frequency = GET_RAND_FREQUENCY
var/sound/explosion_sound = SFX_EXPLOSION_LARGE
var/sound/far_explosion_sound = SFX_EXPLOSION_LARGE_DISTANT
- var/sound/creak_sound = SFX_EXPLOSION_CREAK
//no need to loop this for every mob
switch(power)
@@ -282,19 +281,20 @@ as having entered the turf.
var/mob/our_mob = MN
// Double check for client
var/turf/mob_turf = get_turf(our_mob)
- if(mob_turf?.z == epicenter.z)
- var/dist = get_dist(mob_turf, epicenter)
- if(dist <= max(round(power, 1)))
- our_mob.playsound_local(epicenter, null, 75, 1, frequency, falloff = 5, sound_to_use = explosion_sound)
- if(is_mainship_level(epicenter.z))
- our_mob.playsound_local(epicenter, null, 40, 1, frequency, falloff = 5, sound_to_use = creak_sound)//ship groaning under explosion effect
- // You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
- else if(dist <= far_dist)
- var/far_volume = clamp(far_dist, 30, 60) // Volume is based on explosion size and dist
- far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
- our_mob.playsound_local(epicenter, null, far_volume, 1, frequency, falloff = 5, sound_to_use = far_explosion_sound)
- if(is_mainship_level(epicenter.z))
- our_mob.playsound_local(epicenter, null, far_volume * 3, 1, frequency, falloff = 5, sound_to_use = creak_sound)//ship groaning under explosion effect
+ if(mob_turf?.z != epicenter.z)
+ continue
+ var/dist = get_dist(mob_turf, epicenter)
+ if(dist <= max(round(power, 1)))
+ our_mob.playsound_local(epicenter, explosion_sound, 75, 1, frequency, falloff = 5)
+ if(is_mainship_level(epicenter.z))
+ our_mob.playsound_local(epicenter, SFX_EXPLOSION_CREAK, 40, 1, frequency, falloff = 5)//ship groaning under explosion effect
+ // You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
+ else if(dist <= far_dist)
+ var/far_volume = clamp(far_dist, 30, 60) // Volume is based on explosion size and dist
+ far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
+ our_mob.playsound_local(epicenter, far_explosion_sound, far_volume, 1, frequency, falloff = 5)
+ if(is_mainship_level(epicenter.z))
+ our_mob.playsound_local(epicenter, SFX_EXPLOSION_CREAK, far_volume * 3, 1, frequency, falloff = 5)//ship groaning under explosion effect
if(!orig_range)
orig_range = round(power / falloff)
new /obj/effect/temp_visual/explosion(epicenter, orig_range, color, power)
diff --git a/code/modules/mob/living/carbon/xenomorph/castes/warrior/abilities_warrior.dm b/code/modules/mob/living/carbon/xenomorph/castes/warrior/abilities_warrior.dm
index 282fadf01ae..f63d4214bc4 100644
--- a/code/modules/mob/living/carbon/xenomorph/castes/warrior/abilities_warrior.dm
+++ b/code/modules/mob/living/carbon/xenomorph/castes/warrior/abilities_warrior.dm
@@ -638,16 +638,17 @@
/datum/action/ability/activable/xeno/warrior/punch/jab/use_ability(atom/A)
var/mob/living/carbon/xenomorph/xeno_owner = owner
- var/mob/living/carbon/human/target = A
var/jab_damage = xeno_owner.xeno_caste.melee_damage * xeno_owner.xeno_melee_damage_modifier
var/datum/action/ability/xeno_action/empower/empower_action = xeno_owner.actions_by_path[/datum/action/ability/xeno_action/empower]
if(!A.punch_act(xeno_owner, jab_damage))
return fail_activate()
if(empower_action?.check_empower(A))
jab_damage *= WARRIOR_PUNCH_EMPOWER_MULTIPLIER
- to_chat(target, span_highdanger("The concussion from the [xeno_owner]'s blow blinds us!"))
- target.apply_status_effect(STATUS_EFFECT_CONFUSED, 3 SECONDS)
- target.Paralyze(0.5 SECONDS)
+ if(ishuman(A))
+ var/mob/living/carbon/human/target = A
+ to_chat(target, span_highdanger("The concussion from the [xeno_owner]'s blow blinds us!"))
+ target.apply_status_effect(STATUS_EFFECT_CONFUSED, 3 SECONDS)
+ target.Paralyze(0.5 SECONDS)
GLOB.round_statistics.warrior_punches++
SSblackbox.record_feedback(FEEDBACK_TALLY, "round_statistics", 1, "warrior_punches")
succeed_activate()