Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit afcf0a0

Browse files
Makes fall damage interesting (#22749)
* screw gravity * forgor to remove this bit
1 parent af6b86e commit afcf0a0

File tree

8 files changed

+58
-16
lines changed

8 files changed

+58
-16
lines changed

code/game/atoms_movable.dm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,10 @@
265265

266266
/atom/movable/proc/onZImpact(turf/impacted_turf, levels, impact_flags = NONE)
267267
SHOULD_CALL_PARENT(TRUE)
268+
269+
pixel_z += 32
270+
animate(src, max((4 - levels) / 10, 0.1) SECONDS, pixel_z = pixel_z - 32)
268271

269-
if(!(impact_flags & ZIMPACT_NO_MESSAGE))
270-
visible_message(
271-
span_danger("[src] crashes into [impacted_turf]!"),
272-
span_userdanger("You crash into [impacted_turf]!"),
273-
)
274272
if(!(impact_flags & ZIMPACT_NO_SPIN))
275273
INVOKE_ASYNC(src, PROC_REF(SpinAnimation), 5, 2)
276274
SEND_SIGNAL(src, COMSIG_ATOM_ON_Z_IMPACT, impacted_turf, levels)

code/game/objects/effects/effects.dm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
/obj/effect/abstract/singularity_act()
5858
return
5959

60-
/obj/effect/abstract/has_gravity(turf/T)
61-
return FALSE
62-
6360
/obj/effect/dummy/singularity_pull()
6461
return
6562

code/game/objects/effects/temporary_visuals/miscellaneous.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@
546546
icon = 'icons/effects/effects_rcd.dmi'
547547
icon_state = ""
548548
layer = ABOVE_ALL_MOB_LAYER
549+
anchored = TRUE
549550
var/status = 0
550551
var/delay = 0
551552

code/modules/mob/living/carbon/carbon.dm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,26 @@
11671167

11681168
return total_bleed_rate
11691169

1170+
/mob/living/carbon/ZImpactDamage(turf/impacted_turf, levels, impact_flags = NONE)
1171+
impact_flags |= SEND_SIGNAL(src, COMSIG_LIVING_Z_IMPACT, levels, impacted_turf)
1172+
if(impact_flags & ZIMPACT_CANCEL_DAMAGE)
1173+
return impact_flags
1174+
Knockdown(levels * 3 SECONDS)
1175+
if(!(impact_flags & ZIMPACT_NO_MESSAGE))
1176+
visible_message(
1177+
span_danger("[src] crashes into [impacted_turf] with a sickening noise!"),
1178+
span_userdanger("You crash into [impacted_turf] with a sickening noise!"),
1179+
)
1180+
var/obj/item/bodypart/damaged_limb = pick(bodyparts)
1181+
if(!damaged_limb)
1182+
CRASH("[src] has no bodyparts!")
1183+
var/fall_damage = (levels * 5) ** 1.5
1184+
if(damaged_limb.can_dismember() && prob(fall_damage * 3) && HAS_TRAIT(src, TRAIT_EASYDISMEMBER))
1185+
damaged_limb.dismember(BRUTE, FALSE)
1186+
apply_damage(fall_damage, BRUTE, BODY_ZONE_CHEST, sharpness = SHARP_NONE)
1187+
else
1188+
damaged_limb.receive_damage(fall_damage, 0, 0, getarmor(damaged_limb.body_zone, BOMB), TRUE, wound_bonus = 30, sharpness = SHARP_NONE)
1189+
11701190
/**
11711191
* generate_fake_scars()- for when you want to scar someone, but you don't want to hurt them first. These scars don't count for temporal scarring (hence, fake)
11721192
*

code/modules/mob/living/living.dm

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,24 @@
3838
return ..()
3939

4040
/mob/living/onZImpact(turf/impacted_turf, levels, impact_flags = NONE)
41+
impact_flags |= SEND_SIGNAL(impacted_turf, COMSIG_TURF_MOB_FALL, src, levels, impact_flags)
4142
if(!isgroundlessturf(impacted_turf))
42-
impact_flags |= ZImpactDamage(impacted_turf, levels)
43-
44-
return ..()
45-
46-
/mob/living/proc/ZImpactDamage(turf/T, levels)
47-
SEND_SIGNAL(T, COMSIG_TURF_MOB_FALL, src)
48-
visible_message(span_danger("[src] crashes into [T] with a sickening noise!"))
43+
impact_flags |= ZImpactDamage(impacted_turf, levels, impact_flags)
44+
45+
return ..(impacted_turf, levels, impact_flags)
46+
47+
/mob/living/proc/ZImpactDamage(turf/impacted_turf, levels, impact_flags)
48+
impact_flags |= SEND_SIGNAL(src, COMSIG_LIVING_Z_IMPACT, levels, impacted_turf)
49+
if(impact_flags & ZIMPACT_CANCEL_DAMAGE)
50+
return impact_flags
51+
if(!(impact_flags & ZIMPACT_NO_MESSAGE))
52+
visible_message(
53+
span_danger("[src] crashes into [impacted_turf] with a sickening noise!"),
54+
span_userdanger("You crash into [impacted_turf] with a sickening noise!"),
55+
)
4956
adjustBruteLoss((levels * 5) ** 1.5)
50-
Knockdown(levels * 50)
57+
Knockdown(levels * 3 SECONDS)
58+
return impact_flags
5159

5260
/mob/living/proc/OpenCraftingMenu()
5361
return

code/modules/mob/living/simple_animal/friendly/cat.dm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
sitting = FALSE
5050
update_appearance(UPDATE_ICON_STATE)
5151

52+
/mob/living/simple_animal/pet/cat/ZImpactDamage(turf/T, levels)
53+
visible_message(span_notice("[src] lands completely unharmed!"))
54+
return ZIMPACT_CANCEL_DAMAGE|ZIMPACT_NO_MESSAGE|ZIMPACT_NO_SPIN
55+
5256
/mob/living/simple_animal/pet/cat/space
5357
name = "space cat"
5458
desc = "It's a cat... in space!"

yogstation/code/datums/components/lingering.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
. = ..()
2828
RegisterSignal(parent, COMSIG_ATOM_HITBY, PROC_REF(hitby))
2929
RegisterSignal(parent, COMSIG_ATOM_ENTERED, PROC_REF(Entered))
30+
RegisterSignal(parent, COMSIG_TURF_MOB_FALL, PROC_REF(kersplash))
3031

3132
/datum/component/lingering/UnregisterFromParent()
3233
UnregisterSignal(parent, COMSIG_ATOM_HITBY)
3334
UnregisterSignal(parent, COMSIG_ATOM_ENTERED)
35+
UnregisterSignal(parent, COMSIG_TURF_MOB_FALL)
3436
STOP_PROCESSING(SSobj, src)
3537
. = ..()
3638

@@ -49,6 +51,17 @@
4951
if(!affect_stuff(delta_time))
5052
STOP_PROCESSING(SSobj, src)
5153

54+
/datum/component/lingering/proc/kersplash(datum/source, atom/movable/fallen_atom, turf/impacted_turf, levels = 1, impact_flags = NONE)
55+
fallen_atom.visible_message(
56+
span_danger("[fallen_atom] plunges into [parent]!"),
57+
span_userdanger("You plunge into [parent]!")
58+
)
59+
playsound(parent, 'yogstation/sound/effects/splash.ogg', 50, 0)
60+
if(isliving(fallen_atom))
61+
var/mob/living/cannonball = fallen_atom
62+
cannonball.Knockdown(2 SECONDS)
63+
return ZIMPACT_CANCEL_DAMAGE
64+
5265
////////////////////////////////////////////////////////////////////////////////////
5366
//---------------------------------safety check-----------------------------------//
5467
////////////////////////////////////////////////////////////////////////////////////

yogstation/code/modules/liquids/liquid_effect.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
to_chat(C, span_userdanger("You fall in and swallow some water!"))
176176
else
177177
to_chat(M, span_userdanger("You fall in the water!"))
178+
return ZIMPACT_CANCEL_DAMAGE
178179

179180
/obj/effect/abstract/liquid_turf/Initialize(mapload, datum/liquid_group/group_to_add)
180181
. = ..()

0 commit comments

Comments
 (0)