mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
Ports the shuttle console hijack from TG. Tweaks malf AI hijack. (#19018)
* *puts on sunglasses* "I'm in." * whoops * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * Caching, danger, range, xenomorphs can no longer hijack * Update code/modules/shuttle/emergency.dm Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> * Update code/modules/shuttle/emergency.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
|
||||
#define NOT_BEGUN 0
|
||||
#define STAGE_1 1
|
||||
#define STAGE_2 2
|
||||
#define STAGE_3 3
|
||||
#define STAGE_4 4
|
||||
#define HIJACKED 5
|
||||
|
||||
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle
|
||||
name = "emergency shuttle console"
|
||||
desc = "For shuttle control."
|
||||
@@ -5,6 +15,23 @@
|
||||
icon_keyboard = "tech_key"
|
||||
var/auth_need = 3
|
||||
var/list/authorized = list()
|
||||
var/hijack_last_stage_increase = 0 SECONDS
|
||||
var/hijack_stage_time = 5 SECONDS
|
||||
var/hijack_stage_cooldown = 5 SECONDS
|
||||
var/hijack_flight_time_increase = 30 SECONDS
|
||||
var/hijack_completion_flight_time_set = 10 SECONDS
|
||||
var/hijack_hacking = FALSE
|
||||
var/hijack_announce = TRUE
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/examine(mob/user)
|
||||
. = ..()
|
||||
if(hijack_announce)
|
||||
. += "Security systems present on console. Any unauthorized tampering will result in an emergency announcement, and a fee of 20000 credits."
|
||||
if(user?.mind?.get_hijack_speed())
|
||||
. += "<span class='danger'>Alt click on this to attempt to hijack the shuttle. This will take multiple tries (current: stage [SSshuttle.emergency.hijack_status]/[HIJACKED]).</span>"
|
||||
. += "<span class='danger'>It will take you [user.mind.get_hijack_speed() / 10] seconds to reprogram a stage of the shuttle's navigational firmware, and the console will undergo automated timed lockout for [hijack_stage_cooldown / 10] seconds after each stage.</span>"
|
||||
if(hijack_announce)
|
||||
. += "<span class='warning'>It is probably best to fortify your position as to be uninterrupted during the attempt, given the automatic announcements...</span>"
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/attackby(obj/item/card/W, mob/user, params)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
@@ -75,6 +102,94 @@
|
||||
emagged = TRUE
|
||||
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/proc/increase_hijack_stage()
|
||||
var/obj/docking_port/mobile/emergency/shuttle = SSshuttle.emergency
|
||||
shuttle.hijack_status++
|
||||
if(hijack_announce)
|
||||
announce_hijack_stage()
|
||||
hijack_last_stage_increase = world.time
|
||||
atom_say("Navigational protocol error! Rebooting systems.")
|
||||
if(shuttle.mode == SHUTTLE_ESCAPE)
|
||||
if(shuttle.hijack_status == HIJACKED)
|
||||
shuttle.setTimer(hijack_completion_flight_time_set)
|
||||
else
|
||||
shuttle.setTimer(shuttle.timeLeft(1) + hijack_flight_time_increase) //give the guy more time to hijack if it's already in flight.
|
||||
return shuttle.hijack_status
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/AltClick(user)
|
||||
if(isliving(user))
|
||||
attempt_hijack_stage(user)
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/proc/attempt_hijack_stage(mob/living/user)
|
||||
var/is_ai = isAI(user)
|
||||
if(!Adjacent(user) && !is_ai)
|
||||
return
|
||||
if(!ishuman(user) && !is_ai) //No, xenomorphs, constructs and traitors in cyborgs can not hack it.
|
||||
return
|
||||
if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
|
||||
to_chat(user, "<span class='warning'>You need your hands free before you can manipulate [src].</span>")
|
||||
return
|
||||
var/speed = user.mind?.get_hijack_speed()
|
||||
if(!speed)
|
||||
to_chat(user, "<span class='warning'>You manage to open a user-mode shell on [src], and hundreds of lines of debugging output fly through your vision. It is probably best to leave this alone.</span>")
|
||||
return
|
||||
if(hijack_hacking)
|
||||
return
|
||||
if(SSshuttle.emergency.hijack_status >= HIJACKED)
|
||||
to_chat(user, "<span class='warning'>The emergency shuttle is already loaded with a corrupt navigational payload. What more do you want from it?</span>")
|
||||
return
|
||||
if(hijack_last_stage_increase >= world.time - hijack_stage_cooldown)
|
||||
atom_say("ACCESS DENIED: Console is temporarily on security lockdown. Please try again.")
|
||||
return
|
||||
hijack_hacking = TRUE
|
||||
to_chat(user, "<span class='userdanger'>You [SSshuttle.emergency.hijack_status == NOT_BEGUN ? "begin" : "continue"] to override [src]'s navigational protocols.</span>")
|
||||
atom_say("Software override initiated.")
|
||||
playsound(src, 'sound/machines/terminal_on.ogg', 100, FALSE)
|
||||
var/turf/console_hijack_turf = get_turf(src)
|
||||
message_admins("[src] is being overriden for hijack by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(console_hijack_turf)]")
|
||||
. = FALSE
|
||||
if(do_after(user, speed, target = src))
|
||||
increase_hijack_stage()
|
||||
console_hijack_turf = get_turf(src)
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] has hijacked [src] in [ADMIN_VERBOSEJMP(console_hijack_turf)]. Hijack stage increased to stage [SSshuttle.emergency.hijack_status] out of [HIJACKED].")
|
||||
log_game("[key_name(usr)] has hijacked [src]. Hijack stage increased to stage [SSshuttle.emergency.hijack_status] out of [HIJACKED].")
|
||||
. = TRUE
|
||||
to_chat(user, "<span class='notice'>You fiddle with [src]'s programming and manage to get a foothold, looks like it'll take [hijack_stage_cooldown / 10] seconds before you can try again!</span>")
|
||||
visible_message("<span class='danger'>[user.name] appears to be tampering with [src].</span>")
|
||||
hijack_hacking = FALSE
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/proc/announce_hijack_stage()
|
||||
var/msg
|
||||
switch(SSshuttle.emergency.hijack_status)
|
||||
if(NOT_BEGUN)
|
||||
return
|
||||
if(STAGE_1)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
msg = "AUTHENTICATING - FAIL. AUTHENTICATING - FAIL. AUTHENTICATING - FAI###### Welcome, technician: [random_name(pick(MALE, FEMALE), H.dna.species.name)]. Debug mode: Enabled."
|
||||
else
|
||||
msg = "AUTHENTICATING - FAIL. AUTHENTICATING - FAIL. AUTHENTICATING - FAI###### Welcome, technician: admin_[rand(0,25)]. Debug mode: Enabled."
|
||||
if(STAGE_2)
|
||||
msg = "Warning: Navigational route fails \"IS_AUTHORIZED\". Please try againNN[Gibberish("againagainerroragainagain", 70, 50)]."
|
||||
if(STAGE_3)
|
||||
msg = "CRC mismatch at ~h~ in calculated route buffer. Full reset initiated of FTL_NAVIGATION_SERVICES. Memory decrypted for automatic repair."
|
||||
if(STAGE_4)
|
||||
msg = "~ACS_directive module_load(cyberdyne.exploit.nanotrasen.shuttlenav)... NT key mismatch. Confirm load? Y...###Reboot complete. CALL transponder.disable(1) ON /transmitter IN world; System link initiated with connected engines..."
|
||||
if(HIJACKED)
|
||||
msg = "SYSTEM OVERRIDE - Resetting course to \[[Gibberish("###########", 100, 90)]\] \
|
||||
([Gibberish("#######", 100, 90)]/[Gibberish("#######", 100, 90)]/[Gibberish("#######", 100, 90)]) \
|
||||
{AUTH - ROOT (uid: 0)}. <br>\
|
||||
[SSshuttle.emergency.mode == SHUTTLE_ESCAPE ? "Diverting from existing route - Bluespace exit in <br>\
|
||||
[hijack_completion_flight_time_set >= INFINITY ? "[Gibberish("\[ERROR\]", 50, 50)]" : hijack_completion_flight_time_set / 10] seconds." : ""]"
|
||||
announce_here("SYSTEM ERROR", Gibberish(msg, 70, rand(3,6)))
|
||||
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/proc/announce_here(a_header = "Emergency Shuttle", a_text = "")
|
||||
var/msg_text = "<b><font size=4 color=red>[a_header]</font><br> <font size=3><span class='robot'>[a_text]</font size></font></b></span>"
|
||||
for(var/mob/R in range(35, src)) //Normal escape shutttle is 30 tiles from console to bottom. Extra range for if we ever get a bigger shuttle. Would do in shuttle area, doesn't account for mechs and such,
|
||||
to_chat(R, msg_text)
|
||||
SEND_SOUND(R, sound('sound/misc/notice1.ogg'))
|
||||
|
||||
/obj/docking_port/mobile/emergency
|
||||
name = "emergency shuttle"
|
||||
id = "emergency"
|
||||
@@ -95,6 +210,8 @@
|
||||
var/datum/announcement/priority/crew_shuttle_called = new(0, new_sound = sound('sound/AI/cshuttle.ogg'))
|
||||
var/datum/announcement/priority/crew_shuttle_docked = new(0, new_sound = sound('sound/AI/cshuttle_dock.ogg'))
|
||||
|
||||
///State of the emergency shuttles hijack status.
|
||||
var/hijack_status = NOT_BEGUN
|
||||
|
||||
/obj/docking_port/mobile/emergency/register()
|
||||
if(!..())
|
||||
@@ -170,7 +287,9 @@
|
||||
SSshuttle.emergencyLastCallLoc = null
|
||||
emergency_shuttle_recalled.Announce("The emergency shuttle has been recalled.[SSshuttle.emergencyLastCallLoc ? " Recall signal traced. Results can be viewed on any communications console." : "" ]")
|
||||
|
||||
/obj/docking_port/mobile/emergency/proc/is_hijacked()
|
||||
/obj/docking_port/mobile/emergency/proc/is_hijacked(fullcheck = FALSE)
|
||||
if(hijack_status == HIJACKED && !fullcheck) //Don't even bother if it was done via computer.
|
||||
return TRUE
|
||||
for(var/mob/living/player in GLOB.player_list)
|
||||
if(!player.mind)
|
||||
continue
|
||||
@@ -381,3 +500,10 @@
|
||||
..()
|
||||
SSshuttle.emergency = current_emergency
|
||||
SSshuttle.backup_shuttle = src
|
||||
|
||||
#undef NOT_BEGUN
|
||||
#undef STAGE_1
|
||||
#undef STAGE_2
|
||||
#undef STAGE_3
|
||||
#undef STAGE_4
|
||||
#undef HIJACKED
|
||||
|
||||
Reference in New Issue
Block a user