Makes mech removal crowbar remove mech sleeper patients (#92281)

This commit is contained in:
Fikou
2025-07-30 17:37:34 -04:00
committed by Roxy
parent 57c1ee7e21
commit ec96a7dd2c
2 changed files with 18 additions and 10 deletions
+17 -9
View File
@@ -238,22 +238,30 @@
if(!HAS_TRAIT(src, TRAIT_WIELDED))
mech.balloon_alert(user, "not wielded!")
return
if(!LAZYLEN(mech.occupants) || (LAZYLEN(mech.occupants) == 1 && mech.mecha_flags & SILICON_PILOT)) //if no occupants, or only an ai
var/obj/item/mecha_parts/mecha_equipment/sleeper/mech_sleeper = locate() in mech
if((!LAZYLEN(mech.occupants) || (LAZYLEN(mech.occupants) == 1 && mech.mecha_flags & SILICON_PILOT)) && (!mech_sleeper || !mech_sleeper.patient)) //if no occupants, or only an ai
mech.balloon_alert(user, "it's empty!")
return
user.log_message("tried to pry open [mech], located at [loc_name(mech)], which is currently occupied by [mech.occupants.Join(", ")].", LOG_ATTACK)
var/list/log_list_before = LAZYCOPY(mech.occupants)
if(mech_sleeper?.patient)
log_list_before += mech_sleeper.patient
user.log_message("tried to pry open [mech], located at [loc_name(mech)], which is occupied by [log_list_before.Join(", ")].", LOG_ATTACK)
var/mech_dir = mech.dir
mech.balloon_alert(user, "prying open...")
playsound(mech, 'sound/machines/airlock/airlock_alien_prying.ogg', 100, TRUE)
if(!use_tool(mech, user, (mech.mecha_flags & IS_ENCLOSED) ? 5 SECONDS : 3 SECONDS, volume = 0, extra_checks = CALLBACK(src, PROC_REF(extra_checks), mech, mech_dir)))
if(!use_tool(mech, user, (mech.mecha_flags & IS_ENCLOSED) ? 5 SECONDS : 3 SECONDS, volume = 0, extra_checks = CALLBACK(src, PROC_REF(extra_checks), mech, mech_dir, mech_sleeper)))
mech.balloon_alert(user, "interrupted!")
return
user.log_message("pried open [mech], located at [loc_name(mech)], which is currently occupied by [mech.occupants.Join(", ")].", LOG_ATTACK)
for(var/mob/living/occupant as anything in mech.occupants)
if(isAI(occupant))
var/list/log_list_after = LAZYCOPY(mech.occupants)
if(mech_sleeper?.patient)
log_list_after += mech_sleeper.patient
mech_sleeper.go_out()
user.log_message("pried open [mech], located at [loc_name(mech)], which was occupied by [log_list_after.Join(", ")].", LOG_ATTACK)
for(var/mob/living/occupant as anything in SANITIZE_LIST(mech.occupants))
if(isAI(occupant) || isbrain(occupant))
continue
mech.mob_exit(occupant, randomstep = TRUE)
mech.mob_exit(occupant)
playsound(mech, 'sound/machines/airlock/airlockforced.ogg', 75, TRUE)
/obj/item/crowbar/mechremoval/proc/extra_checks(obj/vehicle/sealed/mecha/mech, mech_dir)
return HAS_TRAIT(src, TRAIT_WIELDED) && LAZYLEN(mech.occupants) && mech.dir == mech_dir
/obj/item/crowbar/mechremoval/proc/extra_checks(obj/vehicle/sealed/mecha/mech, mech_dir, obj/item/mecha_parts/mecha_equipment/sleeper/mech_sleeper)
return HAS_TRAIT(src, TRAIT_WIELDED) && (LAZYLEN(mech.occupants) || mech_sleeper?.patient) && (mech.dir == mech_dir)