From 418d4fae2a5e8667959afda020e29502224cfd4d Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Fri, 17 May 2024 14:59:06 +0200 Subject: [PATCH] You can now crash into things with leap (#25345) * I'm happy with this * Lewc review * Adds varedit safeties * Update code/game/dna/mutations/mutation_powers.dm Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com> Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --- code/game/dna/mutations/mutation_powers.dm | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/code/game/dna/mutations/mutation_powers.dm b/code/game/dna/mutations/mutation_powers.dm index da930664a2c..d25a11adfd7 100644 --- a/code/game/dna/mutations/mutation_powers.dm +++ b/code/game/dna/mutations/mutation_powers.dm @@ -478,6 +478,7 @@ invocation_type = "none" action_icon_state = "genetic_jump" + var/leap_distance = 10 /datum/spell/leap/create_new_targeting() return new /datum/spell_targeting/self @@ -510,15 +511,25 @@ user.layer = 9 user.flying = TRUE - for(var/i=0, i<10, i++) + for(var/i in 1 to leap_distance) + var/turf/hit_turf = get_step(user, user.dir) + var/atom/hit_atom = get_blocking_atom(hit_turf) + if(hit_atom) + hit_atom.hit_by_thrown_mob(user, damage = 10) + break + step(user, user.dir) - if(i < 5) user.pixel_y += 8 - else user.pixel_y -= 8 + if(i < 6) + user.pixel_y += 8 + else + user.pixel_y -= 8 sleep(1) + user.flying = prevFlying + user.pixel_y = 0 // In case leap was varedited to be longer or shorter if(HAS_TRAIT(user, TRAIT_FAT) && prob(66)) - user.visible_message("[user.name] crashes due to [user.p_their()] heavy weight!") + user.visible_message("[user.name] crashes due to [user.p_their()] heavy weight!") //playsound(user.loc, 'zhit.wav', 50, 1) user.AdjustWeakened(20 SECONDS) user.AdjustStunned(10 SECONDS) @@ -541,6 +552,24 @@ container.pixel_x = 0 container.pixel_y = 0 +/datum/spell/leap/proc/get_blocking_atom(turf/turf_to_check) + if(!turf_to_check) + return FALSE + + if(turf_to_check.density) + return turf_to_check + + for(var/atom/movable/hit_thing in turf_to_check) + if(isliving(hit_thing)) + var/mob/living/hit_mob = hit_thing + return hit_mob.density + + if(isobj(hit_thing)) + var/obj/hit_obj = hit_thing + return hit_obj.density + + return FALSE + //////////////////////////////////////////////////////////////////////// // WAS: /datum/bioEffect/polymorphism