From eb013b2537e28b18b2e5918c5826b49db00261b5 Mon Sep 17 00:00:00 2001
From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com>
Date: Wed, 13 Sep 2023 12:19:31 +0200
Subject: [PATCH] Prevents exosuit sleepers from loading buckled people
(#17327)
* sdafa
* sdfa
---
.../heavy_vehicle/equipment/medical.dm | 27 +++++++++---
html/changelogs/fluffyghost_fix15436.yml | 42 +++++++++++++++++++
2 files changed, 63 insertions(+), 6 deletions(-)
create mode 100644 html/changelogs/fluffyghost_fix15436.yml
diff --git a/code/modules/heavy_vehicle/equipment/medical.dm b/code/modules/heavy_vehicle/equipment/medical.dm
index c9f153bdfdb..f3809e1d2ef 100644
--- a/code/modules/heavy_vehicle/equipment/medical.dm
+++ b/code/modules/heavy_vehicle/equipment/medical.dm
@@ -37,12 +37,27 @@
/obj/item/mecha_equipment/sleeper/afterattack(var/atom/target, var/mob/living/user, var/inrange, var/params)
. = ..()
- if(.)
- if(ishuman(target) && !sleeper.occupant)
- visible_message("\The [src] begins loading \the [target] into \the [src].")
- sleeper.go_in(target, user)
- else
- to_chat(user, "You cannot load that in!")
+ if(!.)
+ return
+
+ //Check it's a person and typecast if so
+ if(!ishuman(target))
+ return
+ var/mob/living/carbon/human/person_to_load = target
+
+ //Check that the person is not buckled
+ if(person_to_load.buckled_to)
+ to_chat(SPAN_WARNING("You must unbuckle [person_to_load] before loading!"))
+ return
+
+ //Check that the sleeper isn't already occupied
+ if(sleeper.occupant)
+ to_chat(user, SPAN_WARNING("The sleeper is already occupied!"))
+ return
+
+ //All good, load the person
+ visible_message("\The [src] begins loading \the [target] into \the [src].")
+ sleeper.go_in(person_to_load, user)
/obj/item/mecha_equipment/sleeper/get_hardpoint_maptext()
if(sleeper && sleeper.occupant)
diff --git a/html/changelogs/fluffyghost_fix15436.yml b/html/changelogs/fluffyghost_fix15436.yml
new file mode 100644
index 00000000000..fec797aa42c
--- /dev/null
+++ b/html/changelogs/fluffyghost_fix15436.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: FluffyGhost
+
+# 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:
+ - bugfix: "Prevents exosuit sleepers from loading buckled people."
+ - refactor: "Minor refactor of exosuit sleepers afterattack function."