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

Jumping mobs now make any mobs buckled to them jump #16970

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 17 additions & 7 deletions code/datums/components/jump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,21 @@
UnregisterSignal(parent, list(COMSIG_KB_LIVING_JUMP_DOWN))
if(jump_flags & JUMP_CHARGEABLE)
RegisterSignal(parent, COMSIG_KB_LIVING_JUMP_DOWN, PROC_REF(charge_jump))
RegisterSignal(parent, COMSIG_KB_LIVING_JUMP_UP, PROC_REF(do_jump))
RegisterSignal(parent, COMSIG_KB_LIVING_JUMP_UP, PROC_REF(start_jump))
else
RegisterSignal(parent, COMSIG_KB_LIVING_JUMP_DOWN, PROC_REF(do_jump))
RegisterSignal(parent, COMSIG_KB_LIVING_JUMP_DOWN, PROC_REF(start_jump))

///Starts charging the jump
/datum/component/jump/proc/charge_jump(mob/living/jumper)
jump_start_time = world.timeofday

///Performs the jump
/datum/component/jump/proc/do_jump(mob/living/jumper)
///handles pre-jump checks and setup of additional jump behavior.
/datum/component/jump/proc/start_jump(mob/living/jumper)
SIGNAL_HANDLER

if(TIMER_COOLDOWN_CHECK(jumper, JUMP_COMPONENT_COOLDOWN))
return

if(jumper.buckled)
return
if(jumper.incapacitated())
Expand All @@ -80,6 +82,15 @@
to_chat(jumper, span_warning("Catch your breath!"))
return

do_jump(jumper)
jumper.adjustStaminaLoss(stamina_cost)
//Forces all who ride to jump alongside the jumper.
for(var/mob/buckled_mob AS in jumper.buckled_mobs)
do_jump(buckled_mob)

///Performs the jump
/datum/component/jump/proc/do_jump(mob/living/jumper)

var/effective_jump_duration = jump_duration
var/effective_jump_height = jump_height
var/effective_jumper_allow_pass_flags = jumper_allow_pass_flags
Expand All @@ -98,11 +109,10 @@
var/original_pass_flags = jumper.pass_flags

SEND_SIGNAL(jumper, COMSIG_ELEMENT_JUMP_STARTED, effective_jump_height, effective_jump_duration)
jumper.adjustStaminaLoss(stamina_cost)
jumper.pass_flags |= effective_jumper_allow_pass_flags
ADD_TRAIT(jumper, TRAIT_SILENT_FOOTSTEPS, JUMP_COMPONENT)
jumper.add_nosubmerge_trait(JUMP_COMPONENT)
RegisterSignal(parent, COMSIG_MOB_THROW, PROC_REF(jump_throw))
RegisterSignal(jumper, COMSIG_MOB_THROW, PROC_REF(jump_throw))

jumper.add_filter(JUMP_COMPONENT, 2, drop_shadow_filter(color = COLOR_TRANSPARENT_SHADOW, size = 0.9))
var/shadow_filter = jumper.get_filter(JUMP_COMPONENT)
Expand All @@ -127,7 +137,7 @@
jumper.remove_traits(list(TRAIT_SILENT_FOOTSTEPS, TRAIT_NOSUBMERGE), JUMP_COMPONENT)
SEND_SIGNAL(jumper, COMSIG_ELEMENT_JUMP_ENDED, TRUE, 1.5, 2)
SEND_SIGNAL(jumper.loc, COMSIG_TURF_JUMP_ENDED_HERE, jumper)
UnregisterSignal(parent, COMSIG_MOB_THROW)
UnregisterSignal(jumper, COMSIG_MOB_THROW)

///Jump throw bonuses
/datum/component/jump/proc/jump_throw(mob/living/thrower, target, thrown_thing, list/throw_modifiers)
Expand Down
Loading