From 2cfa9d620fd5f5c1aeb9e2ab39d1473369ff1169 Mon Sep 17 00:00:00 2001 From: Mikhail Dzianishchyts Date: Tue, 23 Apr 2024 01:04:38 +0300 Subject: [PATCH] Fixes exploit (#25101) --- code/datums/helper_datums/teleport.dm | 21 ++++++++++--------- .../abduction/machinery/experiment.dm | 3 +++ code/game/machinery/clonescanner.dm | 17 ++++++++------- code/game/machinery/cryopod.dm | 9 +++++--- .../mecha/equipment/tools/medical_tools.dm | 2 ++ .../kitchen_machinery/gibber.dm | 3 ++- 6 files changed, 34 insertions(+), 21 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index e599974ad1a..dfb66d084f6 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -23,9 +23,7 @@ effect_in = effect if(isnull(effect_out)) effect_out = effect - if(D.start(atom_to_teleport, destination, variance_range, force_teleport, effect_in, effect_out, sound_in, sound_out, bypass_area_flag, safe_turf_pick, do_effect)) - return TRUE - return FALSE + return D.start(atom_to_teleport, destination, variance_range, force_teleport, effect_in, effect_out, sound_in, sound_out, bypass_area_flag, safe_turf_pick, do_effect) /datum/teleport var/atom/movable/teleatom //atom to teleport @@ -166,6 +164,16 @@ playSpecials(curturf,effectin,soundin) + if(isliving(teleatom)) + var/mob/living/target_mob = teleatom + if(target_mob.buckled) + target_mob.buckled.unbuckle_mob(target_mob, force = TRUE) + if(target_mob.has_buckled_mobs()) + target_mob.unbuckle_all_mobs(force = TRUE) + if(ismachinery(target_mob.loc) || istype(target_mob.loc, /obj/item/mecha_parts/mecha_equipment/medical/sleeper)) + var/obj/location = target_mob.loc + location.force_eject_occupant(target_mob) + if(force_teleport) teleatom.forceMove(destturf) playSpecials(destturf,effectout,soundout) @@ -173,13 +181,6 @@ if(teleatom.Move(destturf)) playSpecials(destturf,effectout,soundout) - if(isliving(teleatom)) - var/mob/living/L = teleatom - if(L.buckled) - L.buckled.unbuckle_mob(L, force = TRUE) - if(L.has_buckled_mobs()) - L.unbuckle_all_mobs(force = TRUE) - destarea.Entered(teleatom) return TRUE diff --git a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm index 2322549036a..0eb5a40d52f 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/experiment.dm @@ -216,6 +216,9 @@ occupant = null update_icon(UPDATE_ICON_STATE) +/obj/machinery/abductor/experiment/force_eject_occupant(mob/target) + eject_abductee() + /obj/machinery/abductor/experiment/broken stat = BROKEN diff --git a/code/game/machinery/clonescanner.dm b/code/game/machinery/clonescanner.dm index ef123acfb4a..83105a45ba4 100644 --- a/code/game/machinery/clonescanner.dm +++ b/code/game/machinery/clonescanner.dm @@ -60,7 +60,7 @@ if(console) console.scanner = null if(occupant) - remove_mob(occupant) + remove_mob() return ..() /obj/machinery/clonescanner/MouseDrop_T(atom/movable/O, mob/user) @@ -84,16 +84,16 @@ if(!occupant) return if(issilicon(user)) - remove_mob(occupant) + remove_mob() return if(!Adjacent(user) || !ishuman(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) return - remove_mob(occupant) + remove_mob() /obj/machinery/clonescanner/relaymove(mob/user) if(user.stat) return - remove_mob(user) + remove_mob() /obj/machinery/clonescanner/proc/try_scan(mob/living/carbon/human/scanned) if(!scanned) @@ -158,10 +158,10 @@ occupant = inserted update_icon(UPDATE_ICON_STATE) -/obj/machinery/clonescanner/proc/remove_mob(mob/living/carbon/human/removed) - if(!istype(removed)) +/obj/machinery/clonescanner/proc/remove_mob() + if(!occupant) return - removed.forceMove(get_turf(loc)) + occupant.forceMove(get_turf(loc)) occupant = null update_scan_status() update_icon(UPDATE_ICON_STATE) @@ -192,3 +192,6 @@ return var/obj/item/multitool/M = I M.set_multitool_buffer(user, src) + +/obj/machinery/clonescanner/force_eject_occupant(mob/target) + remove_mob() diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index f5a9f7ed6d8..fadd07fa124 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -613,6 +613,9 @@ /obj/machinery/cryopod/blob_act() return //Sorta gamey, but we don't really want these to be destroyed. +/obj/machinery/cryopod/force_eject_occupant(mob/target) + go_out() + /obj/machinery/cryopod/offstation // Won't announce when used for cryoing. silent = TRUE @@ -667,7 +670,7 @@ /proc/cryo_ssd(mob/living/person_to_cryo) if(istype(person_to_cryo.loc, /obj/machinery/cryopod)) - return 0 + return FALSE if(isobj(person_to_cryo.loc)) var/obj/O = person_to_cryo.loc O.force_eject_occupant(person_to_cryo) @@ -685,8 +688,8 @@ var/obj/effect/portal/SP = new /obj/effect/portal(T, null, null, 40, create_sparks = FALSE) SP.name = "NT SSD Teleportation Portal" target_cryopod.take_occupant(person_to_cryo, 1) - return 1 - return 0 + return TRUE + return FALSE /proc/force_cryo_human(mob/living/carbon/person_to_cryo) if(!istype(person_to_cryo)) diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 2513acdddba..979e78469ea 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -233,6 +233,8 @@ chassis.use_power(energy_drain) update_equip_info() +/obj/item/mecha_parts/mecha_equipment/medical/sleeper/force_eject_occupant(mob/target) + go_out() /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun name = "exosuit syringe gun" diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 5896e70e42d..51a0d347356 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -321,7 +321,8 @@ operating = FALSE update_icon(UPDATE_OVERLAYS | UPDATE_ICON_STATE) - +/obj/machinery/gibber/force_eject_occupant(mob/target) + go_out() /* AUTOGIBBER */