Skip to content

Commit

Permalink
You can altClick to take out DNA Disks from DNA consoles (#51247)
Browse files Browse the repository at this point in the history
* You can altClick to take out DNA Disks from DNA consoles

You can now altClick to take out a disk from a DNA Console, instead of having to use the GUI and clicking eject.

* Create eject proc, address code review concerns

* DMDOC additions

Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
  • Loading branch information
KathyRyals and Timberpoes committed May 27, 2020
1 parent c3d0a6d commit f4e92e4
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions code/game/machinery/computer/dna_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@

return ..()


/obj/machinery/computer/scan_consolenew/AltClick(mob/user)
// Make sure the user can interact with the machine.
if(!user.canUseTopic(src, !issilicon(user)))
return

eject_disk(user)

/obj/machinery/computer/scan_consolenew/Initialize()
. = ..()

Expand Down Expand Up @@ -1048,13 +1056,7 @@

// Eject stored diskette from console
if("eject_disk")
// GUARD CHECK - This code shouldn't even be callable without a diskette
// inserted. Unexpected result
if(!diskette)
return

diskette.forceMove(drop_location())
diskette = null
eject_disk(usr)
return

// Create a Genetic Makeup injector. These injectors are timed and thus are
Expand Down Expand Up @@ -1986,6 +1988,26 @@
tgui_view_state["storageConsSubMode"] = "mutations"
tgui_view_state["storageDiskSubMode"] = "mutations"

/**
* Ejects the DNA Disk from the console.
*
* Will insert into the user's hand if possible, otherwise will drop it at the
* console's location.
*
* Arguments:
* * user - The mob that is attempting to eject the diskette.
*/
/obj/machinery/computer/scan_consolenew/proc/eject_disk(mob/user)
// Check for diskette.
if(!diskette)
return

to_chat(user, "<span class='notice'>You eject [diskette] from [src].</span>")

// If the disk shouldn't pop into the user's hand for any reason, drop it on the console instead.
if(!istype(user) || !Adjacent(user) || !user.put_in_active_hand(diskette))
diskette.forceMove(drop_location())
diskette = null

#undef INJECTOR_TIMEOUT
#undef NUMBER_OF_BUFFERS
Expand Down

0 comments on commit f4e92e4

Please sign in to comment.