From fd5cc3364f42b3684a9a48fd9cdeb971bf24f811 Mon Sep 17 00:00:00 2001 From: ROdenFL <144662735+ROdenFL@users.noreply.github.com> Date: Thu, 9 Nov 2023 23:08:44 +0300 Subject: [PATCH] refactor: dir_slash is every mob/living parametr (#3841) --- code/_onclick/other_mobs.dm | 10 ---------- code/modules/mob/living/carbon/alien/alien.dm | 2 +- code/modules/mob/living/living_defense.dm | 12 ++++++++++++ code/modules/mob/living/living_defines.dm | 2 ++ .../mob/living/simple_animal/hostile/hostile.dm | 9 +-------- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index fe555ab2b89..f167dbf0d89 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -89,16 +89,6 @@ /mob/living/carbon/alien/RestrainedClickOn(atom/A) return -/mob/living/carbon/alien/RangedAttack(atom/A, params) - . = ..() - if(dirslash_enabled && a_intent != INTENT_HELP) - var/turf/turf_attacking = get_step(src, get_compass_dir(src, A)) - if(turf_attacking) - var/mob/living/target = locate() in turf_attacking - if(target && Adjacent(target)) - changeNext_move(CLICK_CD_MELEE) - return UnarmedAttack(target, TRUE) - // Babby aliens /mob/living/carbon/alien/larva/UnarmedAttack(atom/A) A.attack_larva(src) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index a21e7546145..db191802cbe 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -33,7 +33,7 @@ var/large = FALSE var/heat_protection = 0.5 var/leaping = FALSE - var/dirslash_enabled = TRUE + dirslash_enabled = TRUE ventcrawler = 1 var/death_message = "lets out a waning guttural screech, green blood bubbling from its maw..." var/death_sound = 'sound/voice/hiss6.ogg' diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 71769b52314..0f9b4e41c97 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -394,3 +394,15 @@ /mob/living/proc/cult_self_harm(damage) return FALSE + +/mob/living/RangedAttack(atom/A, params) //Player firing + if(GLOB.pacifism_after_gt) + return + else if(dirslash_enabled && a_intent != INTENT_HELP) + var/turf/turf_attacking = get_step(src, get_compass_dir(src, A)) + if(turf_attacking) + var/mob/living/target = locate() in turf_attacking + if(target && Adjacent(target)) + changeNext_move(CLICK_CD_MELEE) + return UnarmedAttack(target, TRUE) + return ..() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index d4380493fcb..938920ecaad 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -80,3 +80,5 @@ ///if this exists AND the normal sprite is bigger than 32x32, this is the replacement icon state (because health doll size limitations). the icon will always be screen_gen.dmi var/health_doll_icon + + var/dirslash_enabled = FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 9a5e313b3a4..2450f9ea2a3 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -58,7 +58,7 @@ tts_seed = "Vort_e2" - var/dirslash_enabled = TRUE + dirslash_enabled = TRUE /mob/living/simple_animal/hostile/Initialize(mapload) . = ..() @@ -557,13 +557,6 @@ target = A OpenFire(A) return - else if(dirslash_enabled && a_intent != INTENT_HELP) - var/turf/turf_attacking = get_step(src, get_compass_dir(src, A)) - if(turf_attacking) - var/mob/living/target = locate() in turf_attacking - if(target && Adjacent(target)) - changeNext_move(CLICK_CD_MELEE) - return UnarmedAttack(target, TRUE) return ..()