Skip to content

Commit

Permalink
Lurker: bug fix, var disambiguation and redundant type checks (#4922)
Browse files Browse the repository at this point in the history
- Fixes #4905
- Disambiguates some abbreviated vars & single letter
- Removes some unnecessary type checks

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: Lurker can no longer tail jab through doors/structures.
code: Var disambiguation, cleanup and removal of redundant typechecks in
lurker code.
/:cl:
  • Loading branch information
Birdtalon authored Nov 16, 2023
1 parent 62e66db commit 75bdfdb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
if (istype(lurker_invis))
lurker_invis.invisibility_off()

/datum/action/xeno_action/activable/pounce/lurker/additional_effects(mob/living/L)
var/mob/living/carbon/xenomorph/X = owner
if (!istype(X))
/datum/action/xeno_action/activable/pounce/lurker/additional_effects(mob/living/living_mob)
var/mob/living/carbon/xenomorph/xeno = owner
if (!istype(xeno))
return

if (X.mutation_type == LURKER_NORMAL)
RegisterSignal(X, COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF, PROC_REF(remove_freeze), TRUE) // Suppresses runtime ever we pounce again before slashing
if (xeno.mutation_type == LURKER_NORMAL)
RegisterSignal(xeno, COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF, PROC_REF(remove_freeze), TRUE) // Suppresses runtime ever we pounce again before slashing

/datum/action/xeno_action/activable/pounce/lurker/proc/remove_freeze(mob/living/carbon/xenomorph/X)
/datum/action/xeno_action/activable/pounce/lurker/proc/remove_freeze(mob/living/carbon/xenomorph/xeno)
SIGNAL_HANDLER

var/datum/behavior_delegate/lurker_base/BD = X.behavior_delegate
if (istype(BD))
UnregisterSignal(X, COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF)
var/datum/behavior_delegate/lurker_base/behaviour_del = xeno.behavior_delegate
if (istype(behaviour_del))
UnregisterSignal(xeno, COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF)
end_pounce_freeze()

/datum/action/xeno_action/onclick/lurker_invisibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
xeno.visible_message(SPAN_XENOWARNING("\The [xeno] strikes the window with their tail!"), SPAN_XENOWARNING("You strike the window with your tail!"))
apply_cooldown(cooldown_modifier = 0.5)
return
if(current_structure.density)
to_chat(xeno, SPAN_WARNING("There's something blocking you from striking!"))
return

if(!isxeno_human(hit_target) || xeno.can_not_harm(hit_target) || hit_target.stat == DEAD)
xeno.visible_message(SPAN_XENOWARNING("\The [xeno] swipes their tail through the air!"), SPAN_XENOWARNING("You swipe your tail through the air!"))
Expand Down
36 changes: 18 additions & 18 deletions code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
target_carbon.set_effect(get_xeno_stun_duration(target_carbon, 3), SUPERSLOW)
next_slash_buffed = FALSE
var/datum/action/xeno_action/onclick/lurker_assassinate/ability = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_assassinate)
if (ability && istype(ability))
if (ability)
ability.button.icon_state = "template"

return original_damage
Expand All @@ -110,33 +110,33 @@
/datum/behavior_delegate/lurker_base/melee_attack_additional_effects_self()
..()

var/datum/action/xeno_action/onclick/lurker_invisibility/LIA = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if (LIA && istype(LIA))
LIA.invisibility_off()
var/datum/action/xeno_action/onclick/lurker_invisibility/lurker_invis_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if (lurker_invis_action)
lurker_invis_action.invisibility_off()

/datum/behavior_delegate/lurker_base/proc/decloak_handler(mob/source)
SIGNAL_HANDLER
var/datum/action/xeno_action/onclick/lurker_invisibility/LIA = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if(istype(LIA))
LIA.invisibility_off()
var/datum/action/xeno_action/onclick/lurker_invisibility/lurker_invis_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if(istype(lurker_invis_action))
lurker_invis_action.invisibility_off()

// What to do when we go invisible
/datum/behavior_delegate/lurker_base/proc/on_invisibility()
var/datum/action/xeno_action/activable/pounce/lurker/LPA = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/activable/pounce/lurker)
if (LPA && istype(LPA))
LPA.knockdown = TRUE // pounce knocks down
LPA.freeze_self = TRUE
var/datum/action/xeno_action/activable/pounce/lurker/lurker_pounce_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/activable/pounce/lurker)
if (lurker_pounce_action)
lurker_pounce_action.knockdown = TRUE // pounce knocks down
lurker_pounce_action.freeze_self = TRUE
ADD_TRAIT(bound_xeno, TRAIT_CLOAKED, TRAIT_SOURCE_ABILITY("cloak"))
RegisterSignal(bound_xeno, COMSIG_MOB_EFFECT_CLOAK_CANCEL, PROC_REF(decloak_handler))
bound_xeno.stealth = TRUE
can_go_invisible = FALSE
invis_start_time = world.time

/datum/behavior_delegate/lurker_base/proc/on_invisibility_off()
var/datum/action/xeno_action/activable/pounce/lurker/LPA = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/activable/pounce/lurker)
if (LPA && istype(LPA))
LPA.knockdown = FALSE // pounce no longer knocks down
LPA.freeze_self = FALSE
var/datum/action/xeno_action/activable/pounce/lurker/lurker_pounce_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/activable/pounce/lurker)
if (lurker_pounce_action)
lurker_pounce_action.knockdown = FALSE // pounce no longer knocks down
lurker_pounce_action.freeze_self = FALSE
bound_xeno.stealth = FALSE
REMOVE_TRAIT(bound_xeno, TRAIT_CLOAKED, TRAIT_SOURCE_ABILITY("cloak"))
UnregisterSignal(bound_xeno, COMSIG_MOB_EFFECT_CLOAK_CANCEL)
Expand All @@ -153,9 +153,9 @@

can_go_invisible = TRUE
if(bound_xeno)
var/datum/action/xeno_action/onclick/lurker_invisibility/LIA = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if(LIA && istype(LIA))
LIA.end_cooldown()
var/datum/action/xeno_action/onclick/lurker_invisibility/lurker_invisibility_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/lurker_invisibility)
if(lurker_invisibility_action)
lurker_invisibility_action.end_cooldown()

/datum/behavior_delegate/lurker_base/append_to_stat()
. = list()
Expand Down

0 comments on commit 75bdfdb

Please sign in to comment.