Skip to content

Commit

Permalink
Adds quantum keycards (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDinamit authored Feb 13, 2024
1 parent faae0ea commit f4f2dd3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@
#include "code\game\objects\items\devices\paint_sprayer.dm"
#include "code\game\objects\items\devices\personal_shield.dm"
#include "code\game\objects\items\devices\powersink.dm"
#include "code\game\objects\items\devices\quantum_keycard.dm"
#include "code\game\objects\items\devices\remote_weapon_controller.dm"
#include "code\game\objects\items\devices\slide_projector.dm"
#include "code\game\objects\items\devices\spy_bug.dm"
Expand Down
12 changes: 12 additions & 0 deletions code/game/machinery/quantum_pad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
anchored = !anchored
return TRUE

if(istype(I, /obj/item/quantum_keycard))
var/obj/item/quantum_keycard/K = I
if(K.qpad)
to_chat(user, SPAN_NOTICE("You insert [K] into [src]'s card slot, activating it."))
physical_attack_hand(user, K.qpad)
else
to_chat(user, SPAN_NOTICE("You insert [K] into [src]'s card slot, initiating the link procedure."))
if(do_after(user, 40, target = src))
to_chat(user, SPAN_NOTICE("You complete the link between [K] and [src]."))
K.LinkPad(src)
return TRUE

return ..()

/obj/machinery/quantumpad/physical_attack_hand(mob/user, obj/machinery/quantumpad/target_pad = linked_pad)
Expand Down
49 changes: 49 additions & 0 deletions code/game/objects/items/devices/quantum_keycard.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/obj/item/quantum_keycard
name = "quantum keycard"
desc = "A keycard able to link to a quantum pad's particle signature, allowing other quantum pads to travel there instead of their linked pad."
icon = 'icons/obj/device.dmi'
icon_state = "quantum_keycard"
item_state = "card-id"
w_class = ITEM_SIZE_TINY
origin_tech = list(TECH_BLUESPACE = 6, TECH_ENGINEERING = 5, TECH_DATA = 5)
var/obj/machinery/quantumpad/qpad = null

/obj/item/quantum_keycard/examine(mob/user)
. = ..()
if(qpad)
to_chat(user, "It's currently linked to a [qpad.name].")
to_chat(user, SPAN_NOTICE("Alt-click to unlink the keycard."))
else
to_chat(user, SPAN_NOTICE("Insert [src] into an active quantum pad to link it."))

/obj/item/quantum_keycard/AltClick(mob/living/user)
if(!istype(user) || user.incapacitated() || !Adjacent(user))
return
to_chat(user, SPAN_NOTICE("You start pressing [src]'s unlink button..."))
if(do_after(user, 40, target = src))
to_chat(user, SPAN_NOTICE("The keycard beeps twice and disconnects the quantum link."))
UnlinkPad()

/obj/item/quantum_keycard/on_update_icon()
if(qpad)
icon_state = "quantum_keycard_on"
else
icon_state = initial(icon_state)

/obj/item/quantum_keycard/proc/LinkPad(obj/machinery/quantumpad/pad)
if(!istype(pad))
return

qpad = pad
update_icon()
RegisterSignal(pad, COMSIG_PARENT_QDELETING, .proc/PadDeleted)

/obj/item/quantum_keycard/proc/UnlinkPad()
UnregisterSignal(qpad, COMSIG_PARENT_QDELETING)
qpad = null
update_icon()

/obj/item/quantum_keycard/proc/PadDeleted()
SIGNAL_HANDLER
visible_message(SPAN_WARNING("\The [src] beeps as it loses connection to its pad!"))
UnlinkPad()
9 changes: 9 additions & 0 deletions code/modules/research/designs/designs_bluespace.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@
materials = list(MATERIAL_GOLD = 3000, MATERIAL_DIAMOND = 1500, MATERIAL_URANIUM = 250, MATERIAL_PLASTIC = 250)
build_path = /obj/item/storage/backpack/holding/duffle
sort_string = "VAFAB"

/datum/design/item/bluespace/quantum_keycard
name = "quantum keycard"
desc = "A keycard able to link to a quantum pad's particle signature, allowing other quantum pads to travel there instead of their linked pad."
id = "quantum_keycard"
req_tech = list(TECH_BLUESPACE = 6, TECH_ENGINEERING = 5, TECH_DATA = 5)
materials = list(MATERIAL_PLASTIC = 3000, MATERIAL_DIAMOND = 1000, MATERIAL_URANIUM = 500)
build_path = /obj/item/quantum_keycard
sort_string = "VAGAA"
Binary file modified icons/obj/device.dmi
Binary file not shown.

0 comments on commit f4f2dd3

Please sign in to comment.