diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 47af8f005001a..361b7a000209c 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -10,6 +10,15 @@ #define STAGE_3 3 #define STAGE_4 4 #define HIJACKED 5 +// the actual time until emag again +#define EMAG_COOLDOWN 1.5 SECONDS + +// various possibilities for how much it change +#define EMAG_DOUBLE 2 +#define EMAG_STAY 1 +#define EMAG_SLIGHT 0.6 +#define EMAG_HEAVY 0.35 +#define EMAG_OHNO 0.25 /obj/machinery/computer/emergency_shuttle name = "emergency shuttle console" @@ -31,6 +40,9 @@ var/hijack_hacking = FALSE var/hijack_announce = TRUE + // measures the last world time the emag event triggered + var/emag_last + /obj/machinery/computer/emergency_shuttle/examine(mob/user) . = ..() if(hijack_announce) @@ -161,6 +173,9 @@ /obj/machinery/computer/emergency_shuttle/proc/clear_recent_action(mob/user) acted_recently -= user + + + /obj/machinery/computer/emergency_shuttle/process() // Launch check is in process in case auth_need changes for some reason // probably external. @@ -175,8 +190,30 @@ if(ENGINES_STARTED || (!IS_DOCKED)) return . + + // monkestation addition + if(obj_flags & EMAGGED && (!emag_last || EMAG_COOLDOWN + emag_last < world.time) && prob(40)) + var/cut_time = pick(EMAG_DOUBLE, EMAG_STAY, EMAG_SLIGHT, EMAG_HEAVY, EMAG_OHNO) + + if (cut_time * TIME_LEFT <= 11) + minor_announce("Launch timer too corrupted, starting shuttle early launch..", "SYSTEM ERROR:") + SSshuttle.emergency.setTimer(ENGINES_START_TIME) // to make it align with igniting + else + SSshuttle.emergency.modTimer(cut_time) + if (cut_time > 1) // providing launch updates if it changes (doesnt roll a 2) + minor_announce("Launch timer corrupted, restarting timer at earlier point..", "SYSTEM ERROR:") + else if (cut_time < 1) + minor_announce("Launch timer corrupted, fast forwarding..", "SYSTEM ERROR:") + + emag_last = world.time + + message_admins("Emagged emergency shuttle will launch in [TIME_LEFT] seconds.") + log_game("Emagged emergency shuttle will launch in [TIME_LEFT] seconds.") + + + // Check to see if we've reached criteria for early launch - if((authorized.len >= auth_need) || (obj_flags & EMAGGED)) + if(authorized.len >= auth_need) // shuttle timers use 1/10th seconds internally SSshuttle.emergency.setTimer(ENGINES_START_TIME) var/system_error = obj_flags & EMAGGED ? "SYSTEM ERROR:" : null @@ -259,16 +296,14 @@ if(!IS_DOCKED) return - if((obj_flags & EMAGGED) || ENGINES_STARTED) //SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LAUNCH IN 10 SECONDS + if(ENGINES_STARTED) //SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LAUNCH IN 10 SECONDS to_chat(user, "The shuttle is already launching!") return - var/time = TIME_LEFT - message_admins("[ADMIN_LOOKUPFLW(user.client)] has emagged the emergency shuttle, [time] seconds before launch.") - log_game("[key_name(user)] has emagged the emergency shuttle in [COORD(src)] [time] seconds before launch.") + obj_flags |= EMAGGED - SSshuttle.emergency.movement_force = list("KNOCKDOWN" = 60, "THROW" = 20)//YOUR PUNY SEATBELTS can SAVE YOU NOW, MORTAL + SSshuttle.emergency.movement_force = list("KNOCKDOWN" = 60, "THROW" = 20) //YOUR PUNY SEATBELTS can SAVE YOU NOW, MORTAL var/datum/species/S = new for(var/i in 1 to 10) // the shuttle system doesn't know who these people are, but they @@ -278,8 +313,6 @@ ID.registered_name = S.random_name(pick(MALE, FEMALE)) ID.assignment = J.title - authorized += ID - process(SSMACHINES_DT) /obj/machinery/computer/emergency_shuttle/Destroy() @@ -291,7 +324,6 @@ if(authorized?.len) authorized.Cut() authorized = null - . = ..() /obj/docking_port/mobile/emergency @@ -762,3 +794,9 @@ #undef STAGE_3 #undef STAGE_4 #undef HIJACKED +#undef EMAG_COOLDOWN +#undef EMAG_DOUBLE +#undef EMAG_STAY +#undef EMAG_SLIGHT +#undef EMAG_HEAVY +#undef EMAG_OHNO