From 4db452cfa88593e67866e89138343a7603a091ac Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Fri, 11 Nov 2022 01:51:40 +0100 Subject: [PATCH] Makes being thrown into airlocks/doors/machines hurt, mobs can now be thrown over railings. (#15054) * Makes being thrown into airlocks/doors/machines hurt, mobs can now be thrown over railings. * Apply suggestions from code review Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com> * Update code/game/machinery/machinery.dm Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com> Co-authored-by: Matt Atlas Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com> --- code/game/atoms.dm | 2 +- code/game/machinery/camera/camera.dm | 2 +- code/game/machinery/doors/door.dm | 2 - code/game/machinery/machinery.dm | 9 ++++ code/game/objects/structures/gore/core.dm | 2 +- code/game/objects/structures/railing.dm | 2 + code/game/objects/structures/window.dm | 13 ++++-- code/modules/mob/living/living_defense.dm | 4 +- .../overmap/ship_weaponry/_ship_gun.dm | 7 +++- html/changelogs/mattatlas-genesong.yml | 42 +++++++++++++++++++ 10 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 html/changelogs/mattatlas-genesong.yml diff --git a/code/game/atoms.dm b/code/game/atoms.dm index df459849e85..9a3b5fc7621 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -316,7 +316,7 @@ /atom/proc/melt() return -/atom/proc/hitby(atom/movable/AM as mob|obj) +/atom/proc/hitby(atom/movable/AM as mob|obj, var/speed = THROWFORCE_SPEED_DIVISOR) if(density) AM.throwing = 0 return diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index c152b7bff00..d4ec43893b0 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -102,7 +102,7 @@ ..() //and give it the regular chance of being deleted outright -/obj/machinery/camera/hitby(AM as mob|obj) +/obj/machinery/camera/hitby(AM as mob|obj, var/speed = THROWFORCE_SPEED_DIVISOR) ..() if (istype(AM, /obj)) var/obj/O = AM diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index d80b3734d28..45f094ad6e1 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -261,9 +261,7 @@ /obj/machinery/door/hitby(AM as mob|obj, var/speed=5) - ..() - visible_message("[src.name] was hit by [AM].") var/tforce = 0 if(ismob(AM)) tforce = 15 * (speed/5) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 1d2f39088b4..248fcdc89e9 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -526,3 +526,12 @@ Class Procs: /obj/machinery/proc/set_emergency_state(var/new_security_level) return + +/obj/machinery/hitby(atom/movable/AM, var/speed = THROWFORCE_SPEED_DIVISOR) + . = ..() + if(isliving(AM)) + var/mob/living/M = AM + M.turf_collision(src, speed) + return + else + visible_message(SPAN_DANGER("\The [src] was hit by \the [AM].")) \ No newline at end of file diff --git a/code/game/objects/structures/gore/core.dm b/code/game/objects/structures/gore/core.dm index 6d0533d151f..d38097dffc0 100644 --- a/code/game/objects/structures/gore/core.dm +++ b/code/game/objects/structures/gore/core.dm @@ -49,7 +49,7 @@ health -= 25 healthcheck() -/obj/structure/gore/hitby(atom/movable/AM) +/obj/structure/gore/hitby(atom/movable/AM, var/speed = THROWFORCE_SPEED_DIVISOR) . = ..() visible_message(SPAN_WARNING("\The [src] was hit by \the [AM].")) playsound(loc, 'sound/effects/attackblob.ogg', 100, TRUE) diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm index e0bdbc0a0cd..a865ef4cfcd 100644 --- a/code/game/objects/structures/railing.dm +++ b/code/game/objects/structures/railing.dm @@ -81,6 +81,8 @@ return TRUE if(!istype(mover) || mover.checkpass(PASSRAILING)) return TRUE + if(mover.throwing) + return TRUE if(get_dir(loc, target) == dir) return !density return TRUE diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 259e0a37614..ca236152cab 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -171,16 +171,23 @@ return 0 return 1 -/obj/structure/window/hitby(AM as mob|obj) +/obj/structure/window/hitby(AM as mob|obj, var/speed = THROWFORCE_SPEED_DIVISOR) ..() - visible_message(SPAN_DANGER("[src] was hit by [AM].")) var/tforce = 0 if(ismob(AM)) + if(isliving(AM)) + var/mob/living/M = AM + M.turf_collision(src, speed, /decl/sound_category/glasscrack_sound) + return + else + visible_message(SPAN_DANGER("\The [src] was hit by \the [AM].")) tforce = 40 else if(isobj(AM)) + visible_message(SPAN_DANGER("\The [src] was hit by \the [AM].")) var/obj/item/I = AM tforce = I.throwforce - if(reinf) tforce *= 0.25 + if(reinf) + tforce *= 0.25 if(health - tforce <= 7 && !reinf) anchored = 0 update_nearby_icons() diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 0a41dad1a18..916f622350b 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -201,9 +201,9 @@ src.embedded += O src.verbs += /mob/proc/yank_out_object -/mob/living/proc/turf_collision(var/turf/T, var/speed = THROWFORCE_SPEED_DIVISOR) +/mob/living/proc/turf_collision(var/atom/T, var/speed = THROWFORCE_SPEED_DIVISOR, var/sound_to_play = 'sound/effects/bangtaper.ogg') visible_message("[src] slams into \the [T]!") - playsound(T, 'sound/effects/bangtaper.ogg', 50, 1, 1)//so it plays sounds on the turf instead, makes for awesome carps to hull collision and such + playsound(T, sound_to_play, 50, 1, 1)//so it plays sounds on the turf instead, makes for awesome carps to hull collision and such apply_damage(speed*5, BRUTE) /mob/living/proc/near_wall(var/direction,var/distance=1) diff --git a/code/modules/overmap/ship_weaponry/_ship_gun.dm b/code/modules/overmap/ship_weaponry/_ship_gun.dm index 85d505b0c25..9bc1ce1e8e2 100644 --- a/code/modules/overmap/ship_weaponry/_ship_gun.dm +++ b/code/modules/overmap/ship_weaponry/_ship_gun.dm @@ -265,8 +265,13 @@ /obj/structure/ship_weapon_dummy/attackby(obj/item/W, mob/user) connected.attackby(W, user) -/obj/structure/ship_weapon_dummy/hitby(atom/movable/AM) +/obj/structure/ship_weapon_dummy/hitby(atom/movable/AM, var/speed = THROWFORCE_SPEED_DIVISOR) connected.hitby(AM) + if(ismob(AM)) + if(isliving(AM)) + var/mob/living/M = AM + M.turf_collision(src, speed) + return /obj/structure/ship_weapon_dummy/bullet_act(obj/item/projectile/P, def_zone) connected.bullet_act(P) diff --git a/html/changelogs/mattatlas-genesong.yml b/html/changelogs/mattatlas-genesong.yml new file mode 100644 index 00000000000..158984234ed --- /dev/null +++ b/html/changelogs/mattatlas-genesong.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Being thrown into airlocks, machines, windows will now hurt a lot." + - bugfix: "Mobs can now be thrown over railings!"