From 569e8f08c399aa8fc4cdc1e5f8e386d3acc7db8a Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Thu, 19 Apr 2018 00:34:18 -0400 Subject: [PATCH] Adds Quantum Pads Pad-to-pad teleporters, though they cost 75% of a diamond for each one (since they require a bluespace crystal each). --- code/datums/helper_datums/teleport.dm | 10 +- code/modules/research/designs_vr.dm | 7 + code/modules/telesci/construction.dm | 21 ++- code/modules/telesci/quantum_pad.dm | 189 ++++++++++++++++++++++++++ vorestation.dme | 1 + 5 files changed, 223 insertions(+), 5 deletions(-) create mode 100644 code/modules/telesci/quantum_pad.dm diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 3576c66dfe4..d2f99a347ba 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -1,5 +1,5 @@ //wrapper -/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) +/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, local=TRUE) //VOREStation Edit new /datum/teleport/instant/science(arglist(args)) return @@ -12,15 +12,16 @@ var/soundin //soundfile to play before teleportation var/soundout //soundfile to play after teleportation var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) + var/local = TRUE //VOREStation Add - If false, can teleport from/to any z-level -/datum/teleport/New(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) +/datum/teleport/New(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null, local=TRUE) //VOREStation Edit ..() if(!initTeleport(arglist(args))) return 0 return 1 -/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) +/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout,local) //VOREStation Edit if(!setTeleatom(ateleatom)) return 0 if(!setDestination(adestination)) @@ -30,6 +31,7 @@ setEffects(aeffectin,aeffectout) setForceTeleport(afteleport) setSounds(asoundin,asoundout) + src.local = local // VOREStation Add return 1 //must succeed @@ -186,7 +188,7 @@ return 0 */ //VOREStation Removal End //VOREStation Edit Start - if(destination.z in using_map.player_levels) + if(!local || (destination.z in using_map.player_levels)) //VOREStation Edit return 1 if(istype(teleatom, /mob/living)) to_chat(teleatom, "The portal refuses to carry you that far away!") diff --git a/code/modules/research/designs_vr.dm b/code/modules/research/designs_vr.dm index de86ebf8729..02b71645da6 100644 --- a/code/modules/research/designs_vr.dm +++ b/code/modules/research/designs_vr.dm @@ -173,6 +173,13 @@ build_path = /obj/item/weapon/circuitboard/bomb_tester sort_string = "HABAG" +/datum/design/circuit/quantum_pad + name = "Quantum Pad" + id = "quantum_pad" + req_tech = list(TECH_ENGINEERING = 4, TECH_POWER = 4, TECH_BLUESPACE = 4) + build_path = /obj/item/weapon/circuitboard/quantumpad + sort_string = "HABAH" + ////// RIGSuit Stuff /* /datum/design/item/rig diff --git a/code/modules/telesci/construction.dm b/code/modules/telesci/construction.dm index ac5d7becd7f..5143733a478 100644 --- a/code/modules/telesci/construction.dm +++ b/code/modules/telesci/construction.dm @@ -20,6 +20,18 @@ /obj/item/stack/cable_coil = 5, /obj/item/weapon/stock_parts/console_screen = 1) +// Bamfpads! Ported from /tg/ +/obj/item/weapon/circuitboard/quantumpad + name = T_BOARD("quantum pad") + board_type = new /datum/frame/frame_types/machine + build_path = /obj/machinery/power/quantumpad + origin_tech = list(TECH_ENGINEERING = 4, TECH_POWER = 4, TECH_BLUESPACE = 4) + req_components = list( + /obj/item/weapon/ore/bluespace_crystal = 1, + /obj/item/weapon/stock_parts/capacitor = 1, + /obj/item/weapon/stock_parts/manipulator = 1, + /obj/item/stack/cable_coil = 5) + // The Designs /datum/design/circuit/telesci_console @@ -44,10 +56,17 @@ build_path = /obj/item/device/gps/advanced sort_string = "HAAEB" +/datum/design/circuit/quantum_pad + name = "Quantum Pad" + id = "quantum_pad" + req_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 4, TECH_PHORON = 4, TECH_BLUESPACE = 5) + build_path = /obj/item/weapon/circuitboard/quantumpad + sort_string = "HAAC" + /datum/design/item/bluespace_crystal name = "Artificial Bluespace Crystal" id = "bluespace_crystal" req_tech = list(TECH_BLUESPACE = 3, TECH_PHORON = 4) materials = list("diamond" = 1500, "phoron" = 1500) build_path = /obj/item/weapon/ore/bluespace_crystal/artificial - sort_string = "HAAEC" + sort_string = "HAAED" \ No newline at end of file diff --git a/code/modules/telesci/quantum_pad.dm b/code/modules/telesci/quantum_pad.dm new file mode 100644 index 00000000000..6919dc795f1 --- /dev/null +++ b/code/modules/telesci/quantum_pad.dm @@ -0,0 +1,189 @@ +/obj/machinery/power/quantumpad + name = "quantum pad" + desc = "A bluespace quantum-linked telepad used for teleporting objects to other quantum pads." + icon = 'icons/obj/telescience.dmi' + icon_state = "qpad-idle" + anchored = TRUE + use_power = 1 + idle_power_usage = 200 + active_power_usage = 5000 + circuit = /obj/item/weapon/circuitboard/quantumpad + var/teleport_cooldown = 400 //30 seconds base due to base parts + var/teleport_speed = 50 + var/last_teleport //to handle the cooldown + var/teleporting = 0 //if it's in the process of teleporting + var/power_efficiency = 1 + var/obj/machinery/power/quantumpad/linked_pad + + //mapping + var/static/list/mapped_quantum_pads = list() + var/map_pad_id = "" as text //what's my name + var/map_pad_link_id = "" as text //who's my friend + +/obj/machinery/power/quantumpad/initialize() + . = ..() + default_apply_parts() + connect_to_network() + if(map_pad_id) + mapped_quantum_pads[map_pad_id] = src + +/obj/machinery/power/quantumpad/Destroy() + mapped_quantum_pads -= map_pad_id + return ..() + +/obj/machinery/power/quantumpad/RefreshParts() + var/E = 0 + for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) + E += M.rating + power_efficiency = E + + E = 0 + for(var/obj/item/weapon/stock_parts/capacitor/C in component_parts) + E += C.rating + + teleport_speed = initial(teleport_speed) + teleport_speed -= (E*10) + teleport_cooldown = initial(teleport_cooldown) + teleport_cooldown -= (E * 100) + +/obj/machinery/power/quantumpad/attackby(obj/item/I, mob/user, params) + if(default_deconstruction_screwdriver(user, I)) + return + + if(istype(I, /obj/item/device/multitool)) + if(panel_open) + var/obj/item/device/multitool/M = I + M.buffer = src + to_chat(user, "You save the data in [I]'s buffer.") + return 1 + else + var/obj/item/device/multitool/M = I + if(istype(M.buffer, /obj/machinery/power/quantumpad)) + linked_pad = M.buffer + to_chat(user, "You link [src] to the one in [I]'s buffer.") + return 1 + + if(default_part_replacement(user, I)) + return + + if(default_deconstruction_crowbar(I)) + return + + return ..() + +/obj/machinery/power/quantumpad/update_icon() + . = ..() + + if(inoperable() || panel_open) + icon_state = "pad-idle-o" + else + icon_state = initial(icon_state) + +/obj/machinery/power/quantumpad/attack_hand(mob/user) + . = ..() + if(.) + return + if(panel_open) + to_chat(user, "The panel must be closed before operating this machine!") + return + + if(istype(get_area(src), /area/shuttle)) + to_chat(user, "This is too unstable a platform for \the [src] to operate on!") + return + + if(!powernet) + to_chat(user, "[src] is not attached to a powernet!") + return + + if(!linked_pad || QDELETED(linked_pad)) + if(!map_pad_link_id || !initMappedLink()) + to_chat(user, "There is no linked pad!") + return + + if(world.time < last_teleport + teleport_cooldown) + to_chat(user, "[src] is recharging power. Please wait [round((last_teleport + teleport_cooldown - world.time)/10)] seconds.") + return + + if(teleporting) + to_chat(user, "[src] is charging up. Please wait.") + return + + if(linked_pad.teleporting) + to_chat(user, "Linked pad is busy. Please wait.") + return + + if(linked_pad.inoperable()) + to_chat(user, "Linked pad is not responding to ping.") + return + src.add_fingerprint(user) + doteleport(user) + +/obj/machinery/power/quantumpad/proc/sparks() + var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread() + sparks.set_up(5, 1, get_turf(src)) + sparks.start() + +/obj/machinery/power/quantumpad/attack_ghost(mob/observer/dead/ghost) + . = ..() + if(.) + return + if(!linked_pad && map_pad_link_id) + initMappedLink() + if(linked_pad && !QDELETED(linked_pad)) + ghost.forceMove(get_turf(linked_pad)) + +/obj/machinery/power/quantumpad/proc/doteleport(mob/user) + if(!linked_pad) + return + playsound(get_turf(src), 'sound/weapons/flash.ogg', 25, 1) + teleporting = 1 + + spawn(teleport_speed) + if(!src || QDELETED(src)) + teleporting = 0 + return + if(inoperable()) + to_chat(user, "[src] is nonfunctional!") + teleporting = 0 + return + if(!linked_pad || QDELETED(linked_pad) || linked_pad.inoperable()) + to_chat(user, "Linked pad is not responding to ping. Teleport aborted.") + teleporting = 0 + return + + teleporting = 0 + last_teleport = world.time + + // use a lot of power + var/power_to_use = 10000 / power_efficiency + if(draw_power(power_to_use) != power_to_use) + to_chat(user, "Power is not sufficient to complete a teleport. Teleport aborted.") + return + sparks() + linked_pad.sparks() + + flick("qpad-beam", src) + playsound(get_turf(src), 'sound/weapons/emitter2.ogg', 25, 1, extrarange = 3, falloff = 5) + flick("qpad-beam", linked_pad) + playsound(get_turf(linked_pad), 'sound/weapons/emitter2.ogg', 25, 1, extrarange = 3, falloff = 5) + for(var/atom/movable/ROI in get_turf(src)) + // if is anchored, don't let through + if(ROI.anchored) + if(isliving(ROI)) + var/mob/living/L = ROI + if(L.buckled) + // TP people on office chairs + if(L.buckled.anchored) + continue + else + continue + else if(!isobserver(ROI)) + continue + do_teleport(ROI, get_turf(linked_pad), local = FALSE) + +/obj/machinery/power/quantumpad/proc/initMappedLink() + . = FALSE + var/obj/machinery/power/quantumpad/link = mapped_quantum_pads[map_pad_link_id] + if(link) + linked_pad = link + . = TRUE diff --git a/vorestation.dme b/vorestation.dme index 5a79013373a..398066f5d07 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -2674,6 +2674,7 @@ #include "code\modules\telesci\bscyrstal.dm" #include "code\modules\telesci\construction.dm" #include "code\modules\telesci\gps_advanced.dm" +#include "code\modules\telesci\quantum_pad.dm" #include "code\modules\telesci\telepad.dm" #include "code\modules\telesci\telesci_computer.dm" #include "code\modules\tension\tension.dm"