From f98d2d066c5b7e2872202127222332dbe1c5bc78 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sat, 24 Oct 2015 10:20:22 -0700 Subject: [PATCH 1/3] Hopefully fix Spacepod bullshit. I cleaned up part of my giant mess, and tried to ensure that the references will never be incorrect, however THAT PROBABLY WON'T FUCKING WORK, so I also added a proc spacepods call every time they want to interface with the occupant vars, which checks that the occupants are actually valid, and nulls them/moves them as appropriate. If this happens, it will make a debug log message and yell about it. --- code/game/vehicles/spacepods/spacepod.dm | 183 +++++++++++------------ 1 file changed, 91 insertions(+), 92 deletions(-) diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index d1525fde451..29df0f8f8f5 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 + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() 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 + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() 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) + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() switch(severity) if(1) var/mob/living/carbon/human/H = occupant @@ -207,6 +210,7 @@ deal_damage(50) /obj/spacepod/emp_act(severity) + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() switch(severity) if(1) if(src.occupant) src.occupant << "The pod console flashes 'Heavy EMP WAVE DETECTED'." //warn the occupants @@ -464,129 +468,119 @@ . = 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) + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + 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 + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() 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 + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() - 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 + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() // /obj/spacepod/proc/__SANITY_CHECK_FUCKING_OCCUPANT_VARS() + if(occupant) + if(!ismob(occupant)) + occupant = null + 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]") + else if(occupant.loc != src) + occupant = null + log_debug("##SPACEPOD WARNING: OCCUPANT [occupant] ESCAPED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + if(occupant2) + if(!ismob(occupant2)) + occupant2 = null + 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]") + else if(occupant2.loc != src) + occupant2 = null + log_debug("##SPACEPOD WARNING: OCCUPANT [occupant2] ESCAPED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + + if(!occupant && !allow2enter) + allow2enter = 1 + log_debug("##SPACEPOD WARNING: SOME FUCKHEAD LEFT THE DOORS LOCKED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") /obj/spacepod/verb/exit_pod() set name = "Exit pod" @@ -595,7 +589,10 @@ var/mob/user = usr var/spos = 0 - if(!ismob(user)) return + if(!istype(user)) + return + + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() if(occupant == user) spos = 1 if(occupant2 == user) spos = 2 @@ -618,6 +615,8 @@ set category = "Spacepod" set src = usr.loc + __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + if(!occupant2) usr << "There is no one in the second seat." return @@ -685,7 +684,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 From 3381874471a35c7b0831036b1faf848c1aeb5bc7 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sat, 24 Oct 2015 15:35:11 -0700 Subject: [PATCH 2/3] Decrease Vulgarity, fix mistake --- code/game/vehicles/spacepods/spacepod.dm | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index 29df0f8f8f5..14d36cc9833 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -85,7 +85,7 @@ pr_give_air = null qdel(ion_trail) ion_trail = null - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(occupant) occupant.forceMove(get_turf(src)) occupant = null @@ -149,7 +149,7 @@ var/oldhealth = health health = max(0, health - damage) var/percentage = (health / initial(health)) * 100 - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __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 @@ -188,7 +188,7 @@ /obj/spacepod/ex_act(severity) - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() switch(severity) if(1) var/mob/living/carbon/human/H = occupant @@ -210,7 +210,7 @@ deal_damage(50) /obj/spacepod/emp_act(severity) - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() switch(severity) if(1) if(src.occupant) src.occupant << "The pod console flashes 'Heavy EMP WAVE DETECTED'." //warn the occupants @@ -469,7 +469,7 @@ return /obj/spacepod/proc/moved_other_inside(var/mob/living/carbon/human/H as mob) - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(!occupant2) H.stop_pulling() H.forceMove(src) @@ -482,7 +482,7 @@ if(!isliving(M)) return - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(M != user && M.stat == DEAD && allow2enter) if(occupant2 && !occupant) @@ -527,7 +527,7 @@ 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)]") - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(!occupant) visible_message("[user] starts to climb into \the [src].") @@ -560,27 +560,27 @@ user << "You can't fit in \the [src], it's full!" /obj/spacepod/proc - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() // /obj/spacepod/proc/__SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() // /obj/spacepod/proc/__occupant_sanity_check() if(occupant) if(!ismob(occupant)) - occupant = null 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]") - else if(occupant.loc != src) 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 = null 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]") - else if(occupant2.loc != src) 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: SOME FUCKHEAD LEFT THE DOORS LOCKED, TURF [get_turf(src)] | AREA [get_area(src)] | COORDS [x], [y], [z]") + 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" @@ -592,7 +592,7 @@ if(!istype(user)) return - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(occupant == user) spos = 1 if(occupant2 == user) spos = 2 @@ -615,7 +615,7 @@ set category = "Spacepod" set src = usr.loc - __SANITY_CHECK_FUCKING_OCCUPANT_VARS() + __occupant_sanity_check() if(!occupant2) usr << "There is no one in the second seat." From 5c06f724ce5724274b1bdb6d11cfe17e69cbc6a7 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sun, 25 Oct 2015 13:44:06 -0700 Subject: [PATCH 3/3] my ability to care is waning --- code/game/vehicles/spacepods/spacepod.dm | 59 ++++++++++++------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index 14d36cc9833..effd1bd64b9 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -85,7 +85,7 @@ pr_give_air = null qdel(ion_trail) ion_trail = null - __occupant_sanity_check() + occupant_sanity_check() if(occupant) occupant.forceMove(get_turf(src)) occupant = null @@ -149,7 +149,7 @@ var/oldhealth = health health = max(0, health - damage) var/percentage = (health / initial(health)) * 100 - __occupant_sanity_check() + 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 @@ -188,7 +188,7 @@ /obj/spacepod/ex_act(severity) - __occupant_sanity_check() + occupant_sanity_check() switch(severity) if(1) var/mob/living/carbon/human/H = occupant @@ -210,7 +210,7 @@ deal_damage(50) /obj/spacepod/emp_act(severity) - __occupant_sanity_check() + occupant_sanity_check() switch(severity) if(1) if(src.occupant) src.occupant << "The pod console flashes 'Heavy EMP WAVE DETECTED'." //warn the occupants @@ -469,7 +469,7 @@ return /obj/spacepod/proc/moved_other_inside(var/mob/living/carbon/human/H as mob) - __occupant_sanity_check() + occupant_sanity_check() if(!occupant2) H.stop_pulling() H.forceMove(src) @@ -482,7 +482,7 @@ if(!isliving(M)) return - __occupant_sanity_check() + occupant_sanity_check() if(M != user && M.stat == DEAD && allow2enter) if(occupant2 && !occupant) @@ -527,7 +527,7 @@ 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)]") - __occupant_sanity_check() + occupant_sanity_check() if(!occupant) visible_message("[user] starts to climb into \the [src].") @@ -559,28 +559,27 @@ else user << "You can't fit in \the [src], it's full!" -/obj/spacepod/proc - __occupant_sanity_check() // /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 +/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]") + 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" @@ -592,7 +591,7 @@ if(!istype(user)) return - __occupant_sanity_check() + occupant_sanity_check() if(occupant == user) spos = 1 if(occupant2 == user) spos = 2 @@ -615,7 +614,7 @@ set category = "Spacepod" set src = usr.loc - __occupant_sanity_check() + occupant_sanity_check() if(!occupant2) usr << "There is no one in the second seat."