diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index d1525fde451..effd1bd64b9 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -85,6 +85,7 @@ pr_give_air = null qdel(ion_trail) ion_trail = null + occupant_sanity_check() if(occupant) occupant.forceMove(get_turf(src)) occupant = null @@ -148,6 +149,7 @@ var/oldhealth = health health = max(0, health - damage) var/percentage = (health / initial(health)) * 100 + occupant_sanity_check() if(occupant && oldhealth > health && percentage <= 25 && percentage > 0) var/sound/S = sound('sound/effects/engine_alert2.ogg') S.wait = 0 //No queue @@ -186,6 +188,7 @@ /obj/spacepod/ex_act(severity) + occupant_sanity_check() switch(severity) if(1) var/mob/living/carbon/human/H = occupant @@ -207,6 +210,7 @@ deal_damage(50) /obj/spacepod/emp_act(severity) + occupant_sanity_check() switch(severity) if(1) if(src.occupant) src.occupant << "The pod console flashes 'Heavy EMP WAVE DETECTED'." //warn the occupants @@ -464,129 +468,118 @@ . = t_air.return_temperature() return -/obj/spacepod/proc/moved_inside(var/mob/living/carbon/human/H as mob) - var/fukkendisk = usr.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) - if(fukkendisk) - usr << "\red The nuke-disk locks the door as you try to get in. You evil person." - return - - if(H && H.client && H in range(1)) - if(src.occupant && src.occupant2) - H << "[src.name] is full." - return - - if(src.occupant && !src.occupant2) - if(src.occupant == H) - H.visible_message("You climb over the console and drop down into the secondary seat.") - H.reset_view(src) - H.stop_pulling() - H.forceMove(src) - if(src.occupant == H) occupant = null - src.occupant2 = H - src.add_fingerprint(H) - src.forceMove(src.loc) - playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) - return 1 - - else - if(!src.occupant) - H.reset_view(src) - H.stop_pulling() - H.forceMove(src) - src.occupant = H - src.add_fingerprint(H) - src.forceMove(src.loc) - playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) - return 1 - else - return - else - return 0 - /obj/spacepod/proc/moved_other_inside(var/mob/living/carbon/human/H as mob) - if(!src.occupant2) - H.reset_view(src) + occupant_sanity_check() + if(!occupant2) H.stop_pulling() H.forceMove(src) - src.occupant2 = H - src.forceMove(src.loc) + occupant2 = H + H.forceMove(src) playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) return 1 - else + +/obj/spacepod/MouseDrop_T(mob/M, mob/user) + if(!isliving(M)) return - - -/obj/spacepod/MouseDrop_T(mob/M as mob, mob/user as mob) - if(!isliving(M)) return + occupant_sanity_check() if(M != user && M.stat == DEAD && allow2enter) - if(src.occupant2 && !src.occupant) + if(occupant2 && !occupant) usr << "You can't put a corpse into the driver's seat!" - return - if(!src.occupant2) + return 0 + if(!occupant2) visible_message("[user.name] starts loading [M.name] into the pod!") sleep(10) moved_other_inside(M) if(M == user) - move_inside(user) + enter_pod(user) -/obj/spacepod/verb/move_inside(var/mob/user) +/obj/spacepod/verb/enter_pod(mob/user = usr) set category = "Object" set name = "Enter Pod" set src in oview(1) - var/fukkendisk = usr.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) - if(user.restrained() || user.stat || user.weakened || user.stunned || user.paralysis || user.resting) //are you cuffed, dying, lying, stunned or other - return - if (!ishuman(user)) return + if(!istype(user)) + return 0 + + var/fukkendisk = user.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) + + if(user.incapacitated()) //are you cuffed, dying, lying, stunned or other + return 0 + if(!ishuman(user)) + return 0 if(fukkendisk) - user << "The nuke-disk is locking the door every time you try to open it. You get the feeling that it doesn't want to go into the spacepod." - return + user << "The nuke-disk is locking the door every time you try to open it. You get the feeling that it doesn't want to go into the spacepod." + return 0 for(var/mob/living/carbon/slime/S in range(1,usr)) if(S.Victim == user) user << "You're too busy getting your life sucked out of you." - return + return 0 - try_user_enter(user) + move_inside(user) -/obj/spacepod/proc/try_user_enter(var/mob/user) - if(!src.occupant && !src.occupant2) - visible_message("[user] starts to climb into [src.name]") - if(enter_after(40,user)) - if(!src.occupant) - moved_inside(user) - else if(src.occupant != user) - user << "[src.occupant] was faster. Try better next time, loser." - else user << "You stop entering the spacepod." - return +/obj/spacepod/proc/move_inside(mob/user) + if(!istype(user)) + log_debug("SHIT'S GONE WRONG WITH THE SPACEPOD [src] AT [x], [y], [z], AREA [get_area(src)], TURF [get_turf(src)]") - if(!allow2enter) - user << "The door is locked!" - return + occupant_sanity_check() - if(occupant && occupant2) - user << "You can't fit in \the [src], it's full!" - return + if(!occupant) + visible_message("[user] starts to climb into \the [src].") + if(do_after(user, 40, target = src)) + if(!occupant) + user.stop_pulling() + occupant = user + user.forceMove(src) + add_fingerprint(user) + playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) + else + user << "[occupant] was faster. Try better next time, loser." + else + user << "You stop entering \the [src]." - if(occupant && !occupant2) - user << "You start climbing into the passenger bay." - user_enter(user) - - if(!occupant && occupant2) - user << "You start climbing into the pilot's seat." - user_enter(user) - -/obj/spacepod/proc/user_enter(var/mob/user) - visible_message("[user] starts to climb into \the [src.name].") - if(enter_after(40,user)) - moved_inside(user) + else if(!occupant2) + visible_message("[user] starts to climb into \the [src].") + if(do_after(user, 40, target = src)) + if(!occupant2) + user.stop_pulling() + occupant2 = user + user.forceMove(src) + add_fingerprint(user) + playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) + else + user << "[occupant] was faster. Try better next time, loser." + else + user << "You stop entering \the [src]." else - user << "You stop entering the spacepod." + user << "You can't fit in \the [src], it's full!" + +/obj/spacepod/proc/occupant_sanity_check() + if(occupant) + if(!ismob(occupant)) + occupant.forceMove(get_turf(src)) + log_debug("##SPACEPOD WARNING: NON-MOB OCCUPANT [occupant], TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + occupant = null + else if(occupant.loc != src) + log_debug("##SPACEPOD WARNING: OCCUPANT [occupant] ESCAPED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + occupant = null + if(occupant2) + if(!ismob(occupant2)) + occupant2.forceMove(get_turf(src)) + log_debug("##SPACEPOD WARNING: NON-MOB OCCUPANT [occupant2], TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + occupant2 = null + else if(occupant2.loc != src) + log_debug("##SPACEPOD WARNING: OCCUPANT [occupant2] ESCAPED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + occupant2 = null + + if(!occupant && !allow2enter) + allow2enter = 1 + log_debug("##SPACEPOD WARNING: DOORS WERE STILL LOCKED WITH NO OCCUPANT, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") /obj/spacepod/verb/exit_pod() set name = "Exit pod" @@ -595,7 +588,10 @@ var/mob/user = usr var/spos = 0 - if(!ismob(user)) return + if(!istype(user)) + return + + occupant_sanity_check() if(occupant == user) spos = 1 if(occupant2 == user) spos = 2 @@ -618,6 +614,8 @@ set category = "Spacepod" set src = usr.loc + occupant_sanity_check() + if(!occupant2) usr << "There is no one in the second seat." return @@ -685,7 +683,7 @@ return equipment_system.weapon_system.fire_weapons() -obj/spacepod/verb/toggleLights() +/obj/spacepod/verb/toggleLights() set name = "Toggle Lights" set category = "Spacepod" set src = usr.loc