Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fixes shield not blocking pounces tgstation#14861, also cleans up fac…
Browse files Browse the repository at this point in the history
…ehugger pounce code. (#651)

* Fixes Xenomorph pounce bypassing shields & improves it a bit. (tgstation#14861)

* Update abilities_hunter.dm

* Update abilities_hunter.dm

* Update facehugger.dm

* Update abilities_facehugger.dm

* Update abilities_facehugger.dm

* Update abilities_facehugger.dm

* Update abilities_facehugger.dm

* eh

---------

Co-authored-by: DeltaFire <[email protected]>
  • Loading branch information
Helg2 and DeltaFire15 authored Jun 21, 2024
1 parent 38120cf commit c6441e8
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ RU TGMC EDIT */
if(owner.layer != MOB_LAYER)
owner.layer = MOB_LAYER
var/datum/action/ability/xeno_action/xenohide/hide_action = owner.actions_by_path[/datum/action/ability/xeno_action/xenohide]
hide_action?.button?.cut_overlay(mutable_appearance('icons/Xeno/actions.dmi', "selected_purple_frame", ACTION_LAYER_ACTION_ICON_STATE, FLOAT_PLANE)) // Removes Hide action icon border
//hide_action?.button?.cut_overlay(mutable_appearance('icons/Xeno/actions.dmi', "selected_purple_frame", ACTION_LAYER_ACTION_ICON_STATE, FLOAT_PLANE)) // Removes Hide action icon border // ORIGINAL
hide_action?.button?.cut_overlay(mutable_appearance('modular_RUtgmc/icons/Xeno/actions.dmi', "selected_purple_frame", ACTION_LAYER_ACTION_ICON_STATE, FLOAT_PLANE)) // RUTGMC EDIT
if(owner.buckled)
owner.buckled.unbuckle_mob(owner)
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(movement_fx))
Expand Down Expand Up @@ -328,29 +329,31 @@ RU TGMC EDIT */
return

var/mob/living/carbon/xenomorph/xeno_owner = owner
if(ishuman(living_target) && (living_target.dir in reverse_nearby_direction(living_target.dir)))
if(ishuman(living_target) && (angle_to_dir(Get_Angle(xeno_owner.throw_source, living_target)) in reverse_nearby_direction(living_target.dir)))
var/mob/living/carbon/human/human_target = living_target
if(!human_target.check_shields(COMBAT_TOUCH_ATTACK, 30, "melee"))
xeno_owner.Paralyze(XENO_POUNCE_SHIELD_STUN_DURATION)
xeno_owner.set_throwing(FALSE)
playsound(xeno_owner, 'modular_RUtgmc/sound/machines/bonk.ogg', 50, FALSE) // RUTGMC ADDITION
return
// RU TGMC EDIT
if(istype(owner, /mob/living/carbon/xenomorph/predalien))
owner.playsound_local(owner, 'sound/voice/predalien_pounce.ogg', 25, 0, 1)
else
playsound(living_target.loc, 'sound/voice/alien_pounce.ogg', 25, TRUE)
// RU TGMC EDIT
trigger_pounce_effect(living_target)
pounce_complete()

///Triggers the effect of a successful pounce on the target.
/datum/action/ability/activable/xeno/pounce/proc/trigger_pounce_effect(mob/living/living_target)
playsound(get_turf(living_target), 'sound/voice/alien_pounce.ogg', 25, TRUE)
var/mob/living/carbon/xenomorph/xeno_owner = owner
xeno_owner.set_throwing(FALSE)
xeno_owner.Immobilize(XENO_POUNCE_STANDBY_DURATION)
xeno_owner.forceMove(get_turf(living_target))
living_target.Knockdown(XENO_POUNCE_STUN_DURATION)
pounce_complete()

/datum/action/ability/activable/xeno/pounce/proc/pounce_complete()
SIGNAL_HANDLER
UnregisterSignal(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_XENO_OBJ_THROW_HIT, COMSIG_XENOMORPH_LEAP_BUMP, COMSIG_MOVABLE_POST_THROW))
SEND_SIGNAL(owner, COMSIG_XENOMORPH_POUNCE_END)
var/mob/living/carbon/xenomorph/xeno_owner = owner
xeno_owner.set_throwing(FALSE) // RUTGMC ADDITION, for whatever modular fuckery, without this pounce doesn't stop
xeno_owner.xeno_flags &= ~XENO_LEAPING

/datum/action/ability/activable/xeno/pounce/proc/reset_pass_flags()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
action_icon_state = "pounce_savage_[savage_activated? "on" : "off"]"
update_button_icon()

/datum/action/ability/activable/xeno/pounce/runner/mob_hit(datum/source, mob/living/living_target)
/datum/action/ability/activable/xeno/pounce/runner/trigger_pounce_effect(mob/living/living_target)
. = ..()
if(!savage_activated)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ GLOBAL_LIST_INIT(wraith_banish_very_short_duration_list, typecacheof(list(
for(var/mob/rider AS in crosser.buckled_mobs)
if(ishuman(rider))
crosser.unbuckle_mob(rider)
if(crosser.throwing)
crosser.throw_source = get_turf(linked_portal)
crosser.Move(get_turf(linked_portal), crosser.dir)
UnregisterSignal(crosser, COMSIG_MOVABLE_MOVED)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#define HUG_RANGE 1
#define HUGGER_POUNCE_RANGE 6
#define HUGGER_POUNCE_PARALYZE_DURATION 1 SECONDS
#define HUGGER_POUNCE_STANDBY_DURATION 1 SECONDS
#define HUGGER_POUNCE_WINDUP_DURATION 1 SECONDS

// ***************************************
// *********** Hug
Expand All @@ -14,14 +18,6 @@
KEYBINDING_NORMAL = COMSING_XENOABILITY_HUGGER_POUNCE,
)
use_state_flags = ABILITY_USE_BUCKLED
///How far can we leap.
var/range = 6
///For how long will we stun the victim
var/victim_paralyze_time = 1 SECONDS
///For how long will we freeze upon hitting our target
var/freeze_on_hit_time = 1 SECONDS
///How long is the windup before leap
var/windup_time = 1 SECONDS
///Where do we start the leap from
var/start_turf

Expand All @@ -31,51 +27,49 @@
var/mob/living/carbon/xenomorph/caster = owner
caster.pass_flags = initial(caster.pass_flags)
caster.icon_state = "[caster.xeno_caste.caste_name] Walking"
caster.set_throwing(FALSE)
UnregisterSignal(owner, list(COMSIG_XENO_OBJ_THROW_HIT, COMSIG_MOVABLE_POST_THROW, COMSIG_XENO_LIVING_THROW_HIT))

/datum/action/ability/activable/xeno/pounce_hugger/proc/obj_hit(datum/source, obj/target, speed)
SIGNAL_HANDLER
target.hitby(owner, speed)
pounce_complete()

/datum/action/ability/activable/xeno/pounce_hugger/proc/mob_hit(datum/source, mob/living/M)
/datum/action/ability/activable/xeno/pounce_hugger/proc/mob_hit(datum/source, mob/living/living_target)
SIGNAL_HANDLER
if(M.stat || isxeno(M))
if(living_target.stat || isxeno(living_target))
return

var/mob/living/carbon/xenomorph/facehugger/caster = owner

caster.visible_message(span_danger("[caster] leaps on [M]!"),
span_xenodanger("We leap on [M]!"), null, 5)
caster.visible_message(span_danger("[caster] leaps on [living_target]!"), span_xenodanger("We leap on [living_target]!"), null, 5)
playsound(caster.loc, 'sound/voice/alien_roar_larva3.ogg', 25, TRUE) //TODO: I NEED ACTUAL HUGGERS SOUND DAMMED

if(ishuman(M) && (M.dir in reverse_nearby_direction(caster.dir)))
var/mob/living/carbon/human/H = M
if(!H.check_shields(COMBAT_TOUCH_ATTACK, 30, "melee"))
caster.Paralyze(6 SECONDS)
if(ishuman(living_target) && (angle_to_dir(Get_Angle(caster.throw_source, living_target)) in reverse_nearby_direction(living_target.dir)))
var/mob/living/carbon/human/human_target = living_target
if(!human_target.check_shields(COMBAT_TOUCH_ATTACK, 30, "melee"))
caster.Paralyze(XENO_POUNCE_SHIELD_STUN_DURATION)
caster.set_throwing(FALSE) //Reset throwing manually.
playsound(caster, 'modular_RUtgmc/sound/machines/bonk.ogg', 50, FALSE)
return

caster.forceMove(get_turf(M))
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(get_dist(start_turf, H) <= HUG_RANGE) //Check whether we hugged the target or just knocked it down
caster.try_attach(H)
caster.forceMove(get_turf(living_target))
if(ishuman(living_target))
var/mob/living/carbon/human/human_target = living_target
if(get_dist(start_turf, human_target) <= HUG_RANGE) //Check whether we hugged the target or just knocked it down
caster.try_attach(human_target)
else
if(victim_paralyze_time)
H.Paralyze(victim_paralyze_time)

if(freeze_on_hit_time)
caster.Immobilize(freeze_on_hit_time)
human_target.Paralyze(HUGGER_POUNCE_PARALYZE_DURATION)
caster.Immobilize(HUGGER_POUNCE_STANDBY_DURATION)

pounce_complete()

/datum/action/ability/activable/xeno/pounce_hugger/can_use_ability(atom/A, silent = FALSE, override_flags)
/datum/action/ability/activable/xeno/pounce_hugger/can_use_ability(atom/target, silent = FALSE, override_flags)
. = ..()
if(!.)
return FALSE

if(!A || A.layer >= FLY_LAYER)
if(!target || target.layer >= FLY_LAYER)
return FALSE

/datum/action/ability/activable/xeno/pounce_hugger/proc/prepare_to_pounce()
Expand All @@ -91,17 +85,17 @@
caster.xeno_flags |= XENO_LEAPING
return ..()

/datum/action/ability/activable/xeno/pounce_hugger/use_ability(atom/A)
/datum/action/ability/activable/xeno/pounce_hugger/use_ability(atom/target)
var/mob/living/carbon/xenomorph/caster = owner

prepare_to_pounce()
if(!do_after(caster, windup_time, IGNORE_HELD_ITEM, caster, BUSY_ICON_DANGER, extra_checks = CALLBACK(src, PROC_REF(can_use_ability), A, FALSE, ABILITY_USE_BUSY)))
if(!do_after(caster, HUGGER_POUNCE_WINDUP_DURATION, IGNORE_HELD_ITEM, caster, BUSY_ICON_DANGER, extra_checks = CALLBACK(src, PROC_REF(can_use_ability), target, FALSE, ABILITY_USE_BUSY)))
return fail_activate()

caster.icon_state = "[caster.xeno_caste.caste_name] Thrown"

caster.visible_message(span_xenowarning("\The [caster] leaps at [A]!"), \
span_xenowarning("We leap at [A]!"))
caster.visible_message(span_xenowarning("\The [caster] leaps at [target]!"), \
span_xenowarning("We leap at [target]!"))

RegisterSignal(caster, COMSIG_XENO_OBJ_THROW_HIT, PROC_REF(obj_hit))
RegisterSignal(caster, COMSIG_XENOMORPH_LEAP_BUMP, PROC_REF(mob_hit))
Expand All @@ -114,9 +108,9 @@
caster.pass_flags ^= PASS_MOB

start_turf = get_turf(caster)
if(ishuman(A) && get_turf(A) == start_turf)
mob_hit(caster, A)
caster.throw_at(A, range, 2, caster)
if(ishuman(target) && get_turf(target) == start_turf)
mob_hit(caster, target)
caster.throw_at(target, HUGGER_POUNCE_RANGE, XENO_POUNCE_SPEED, caster)

return TRUE

Expand All @@ -135,11 +129,15 @@
return FALSE
action_activate()
LAZYINCREMENT(owner.do_actions, target)
addtimer(CALLBACK(src, PROC_REF(decrease_do_action), target), windup_time)
addtimer(CALLBACK(src, PROC_REF(decrease_do_action), target), HUGGER_POUNCE_WINDUP_DURATION)
return TRUE

///Decrease the do_actions of the owner
/datum/action/ability/activable/xeno/pounce_hugger/proc/decrease_do_action(atom/target)
LAZYDECREMENT(owner.do_actions, target)

#undef HUG_RANGE
#undef HUGGER_POUNCE_RANGE
#undef HUGGER_POUNCE_PARALYZE_DURATION
#undef HUGGER_POUNCE_STANDBY_DURATION
#undef HUGGER_POUNCE_WINDUP_DURATION
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,11 @@
///Trying to attach facehagger to face. Returns true on success and false otherwise
/mob/living/carbon/xenomorph/facehugger/proc/try_attach(mob/living/carbon/human/host)
var/obj/item/clothing/mask/facehugger/larval/mask = new /obj/item/clothing/mask/facehugger/larval(host, src.hivenumber, src)
if(host.can_be_facehugged(mask, provoked = TRUE))
if(mask.Attach(host, FALSE)) //Attach hugger-mask
src.forceMove(host) //Moving sentient hugger inside host
if(client && isnormalhive(hive))
client.facehugger_exp_update(1)
return TRUE
else
qdel(mask)
return FALSE
if(host.can_be_facehugged(mask, provoked = TRUE) && mask.Attach(host, FALSE)) //Attach hugger-mask
src.forceMove(host) //Moving sentient hugger inside host
if(client && isnormalhive(hive))
client.facehugger_exp_update(1)
return TRUE
else
qdel(mask)
return FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
if(ishuman(target) || isdroid(target))
M.apply_damage(base_damage + damage_scale * min(xeno.life_kills_total, xeno.max_bonus_life_kills), BRUTE, "chest", MELEE, FALSE, FALSE, TRUE, 20)

///Triggers the effect of a successful pounce on the target.
/datum/action/ability/activable/xeno/pounce/predalien/trigger_pounce_effect(mob/living/living_target)
playsound(get_turf(living_target), 'sound/voice/predalien_pounce.ogg', 25, TRUE)
var/mob/living/carbon/xenomorph/xeno_owner = owner
xeno_owner.set_throwing(FALSE)
xeno_owner.Immobilize(XENO_POUNCE_STANDBY_DURATION)
xeno_owner.forceMove(get_turf(living_target))
living_target.Knockdown(XENO_POUNCE_STUN_DURATION)

// ***************************************
// *********** Roar
// ***************************************
Expand Down

0 comments on commit c6441e8

Please sign in to comment.