From 0c5cd7d8acc6c02486dec1bdb397bb9002e835f9 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 15:03:23 +0000 Subject: [PATCH] Telescience now uses projectile trajectories to calculate the tile to teleport to. The user can set a rotation (the direction the teleport will send him), the power (the amount of power the telepad will use, basically the x velocity) and the angle (which is the y velocity). The random factor is that the power is randomly offset everytime you recalibrate the telepad. There is a delay between each use of the teleport, which is calculated by the time it takes for a projectile to hit a destination. There is also a delay determined by the amount of power you use. Added a manual for telescience, which links to the wiki. --- code/game/objects/items/weapons/manuals.dm | 17 +++ code/modules/telesci/telesci_computer.dm | 125 ++++++++++++--------- maps/tgstation.2.1.2.dmm | 2 +- 3 files changed, 92 insertions(+), 52 deletions(-) diff --git a/code/game/objects/items/weapons/manuals.dm b/code/game/objects/items/weapons/manuals.dm index 649d97bb46c..d99a7b1db6d 100644 --- a/code/game/objects/items/weapons/manuals.dm +++ b/code/game/objects/items/weapons/manuals.dm @@ -84,6 +84,23 @@ "} +/obj/item/weapon/book/manual/telescience + name = "Teleportation Science - Bluespace for dummies!" + icon_state = "book7" + author = "University of Bluespace" + title = "Teleportation Science - Bluespace for dummies!" + + dat = {" + + + + + + + + + "} + /obj/item/weapon/book/manual/engineering_hacking name = "Hacking" icon_state ="bookHacking" diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 9700b1c51fd..f517afb3b7a 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -4,28 +4,27 @@ icon_state = "teleport" var/sending = 1 var/obj/machinery/telepad/telepad = null - var/temp_msg = "Telescience control console initialized." + var/temp_msg = "Telescience control console initialized.
" // VARIABLES // var/teles_left // How many teleports left until it becomes uncalibrated var/datum/projectile_data/last_tele_data = null var/z_co = 1 - var/rotation_off var/power_off - var/rotation + var/rotation = 0 var/angle - var/power = 25 + var/power // Based on the power used var/teleport_cooldown = 0 - var/list/power_options = list(50, 200, 500) // + var/list/power_options = list(5, 10, 25, 50, 100) // + var/teleporting = 0 /obj/machinery/computer/telescience/New() ..() - teles_left = rand(8,12) - rotation_off = rand(-10,10) - power_off = rand(-10,10) + recalibrate() + power = power_options[1] initialize() /obj/machinery/computer/telescience/initialize() @@ -57,12 +56,12 @@ /obj/machinery/computer/telescience/interact(mob/user) - var/t = "
[temp_msg]
" + var/t = "
[temp_msg]

" t += "Set Rotation" - t += "
[rotation ? rotation : "NULL"]°
" - t += "Set Angle:" + t += "
[rotation]°
" + t += "Set Angle" t += "
[angle ? angle : "NULL"]°
" - t += "Set Power:" + t += "Set Power" t += "
" for(var/pwr in power_options) @@ -72,24 +71,24 @@ t += "[pwr]" t += "
" - t += "Set Z Level:" + t += "Set Sector" t += "
[z_co ? z_co : "NULL"]
" - t += "

Send" + t += "
Send" t += " Receive" - t += "

Recalibrate" + t += "
Recalibrate" // Information about the last teleport t += "
" if(!last_tele_data) t += "No teleport data found." else - t += "Source Location: ([last_tele_data.src_x], [last_tele_data.src_y])" + t += "Source Location: ([last_tele_data.src_x], [last_tele_data.src_y])
" t += "Distance: [last_tele_data.distance]ft
" t += "Time: [last_tele_data.time]secs
" t += "
" - var/datum/browser/popup = new(user, "telesci", name) + var/datum/browser/popup = new(user, "telesci", name, 300, 500) popup.set_content(t) popup.open() return @@ -110,41 +109,62 @@ /obj/machinery/computer/telescience/proc/doteleport(mob/user) - if(telepad) - var/truePower = Clamp(power - power_off, 0, 1000) - var/trueRotation = SimplifyDegrees(rotation - rotation_off) - var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, angle, truePower) + if(teleport_cooldown > world.time) + temp_msg = "Telepad is recharging power, please wait [round((teleport_cooldown - world.time) / 10)] seconds." + return - var/trueX = proj_data.dest_x - var/trueY = proj_data.dest_y + if(teleporting) + temp_msg = "Telepad is in use. Please wait.
" + return + + if(telepad) + + var/truePower = Clamp(power + power_off, 1, 1000) + var/trueRotation = rotation + + var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, angle, truePower) + last_tele_data = proj_data + + var/trueX = Clamp(round(proj_data.dest_x, 1), 1, world.maxx) + var/trueY = Clamp(round(proj_data.dest_y, 1), 1, world.maxy) var/turf/target = locate(trueX, trueY, z_co) var/area/A = get_area(target) - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(5, 1, telepad) - s.start() flick("pad-beam", telepad) - temp_msg = "Teleport successful." - investigate_log("[key_name(usr)]/[user] has teleported with Telescience at [trueX],[trueY],[z_co], in [A.name].","telesci") - var/sparks = get_turf(target) - var/datum/effect/effect/system/spark_spread/y = new /datum/effect/effect/system/spark_spread - y.set_up(5, 1, sparks) - y.start() - var/turf/source = target - var/turf/dest = get_turf(telepad) - if(sending) - source = dest - dest = target - for(var/atom/movable/ROI in source) - if(!ismob(ROI) && ROI.anchored) continue - do_teleport(ROI, dest, 0) - last_tele_data = proj_data + + // Wait depending on the time the projectile took to get there + teleporting = 1 + temp_msg = "Powering up bluespace crystals." + + spawn(round(proj_data.time) * 10) // in seconds + teleporting = 0 + teleport_cooldown = world.time + (power * 2) + + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + + s.set_up(5, 1, telepad) + s.start() + temp_msg = "Teleport successful." + investigate_log("[key_name(usr)]/[user] has teleported with Telescience at [trueX],[trueY],[z_co], in [A ? A.name : "null area"].","telesci") + var/sparks = get_turf(target) + var/datum/effect/effect/system/spark_spread/y = new /datum/effect/effect/system/spark_spread + y.set_up(5, 1, sparks) + y.start() + var/turf/source = target + var/turf/dest = get_turf(telepad) + if(sending) + source = dest + dest = target + flick("pad-beam", telepad) + for(var/atom/movable/ROI in source) + if(!ismob(ROI) && ROI.anchored) continue + do_teleport(ROI, dest, 0) // TO DO: add projectile_trajectory to telesci /obj/machinery/computer/telescience/proc/teleport(mob/user) if(rotation == null || angle == null || z_co == null) - temp_msg = "Error: set a angle, rotation and z level." + temp_msg = "Error: set a angle, rotation and sector." return if(rotation < 0 || rotation > 360) telefail() @@ -156,7 +176,7 @@ return if(z_co == 2 || z_co < 1 || z_co > 7) telefail() - temp_msg = "Error: Z is less than 1, greater than 7, or equal to 2." + temp_msg = "Error: Sector is less than 1, greater than 7, or equal to 2." return if(teles_left > 0) teles_left -= 1 @@ -173,7 +193,7 @@ var/new_rot = input("Please input desired rotation in degrees.", name, rotation) as num if(..()) // Check after we input a value, as they could've moved after they entered something return - rotation = Clamp(new_rot, 1, 9999) + rotation = Clamp(new_rot, 0, 9999) if(href_list["setangle"]) var/new_angle = input("Please input desired angle in degrees.", name, angle) as num @@ -183,14 +203,15 @@ if(href_list["setpower"]) var/pwr = href_list["setpower"] - if(pwr in power_options) + pwr = text2num(pwr) + if(pwr != null && pwr in power_options) power = pwr if(href_list["setz"]) - var/new_z = input("Please input desired Z coordinate.", name, z_co) as num + var/new_z = input("Please input desired sector.", name, z_co) as num if(..()) return - z_co = Clamp(new_z, 1, 9999) + z_co = Clamp(new_z, 1, 10) if(href_list["send"]) sending = 1 @@ -201,10 +222,12 @@ teleport(usr) if(href_list["recal"]) - teles_left = rand(9,12) - rotation_off = rand(-10,10) - power_off = rand(-10,10) + recalibrate() sparks() temp_msg = "Calibration successful." - updateDialog() \ No newline at end of file + updateDialog() + +/obj/machinery/computer/telescience/proc/recalibrate() + teles_left = rand(20,30) + power_off = rand(-10, 10) \ No newline at end of file diff --git a/maps/tgstation.2.1.2.dmm b/maps/tgstation.2.1.2.dmm index 9cab1bf06e8..5dbfe108b3b 100644 --- a/maps/tgstation.2.1.2.dmm +++ b/maps/tgstation.2.1.2.dmm @@ -4736,7 +4736,7 @@ "bNd" = (/obj/structure/closet,/turf/simulated/floor/plating,/area/maintenance/asmaint2) "bNe" = (/obj/structure/rack{dir = 1},/obj/item/clothing/suit/fire/firefighter,/obj/item/weapon/tank/oxygen,/obj/item/clothing/mask/gas,/obj/item/weapon/extinguisher,/obj/item/clothing/head/hardhat/red,/obj/item/clothing/glasses/meson,/turf/simulated/floor/plating,/area/maintenance/asmaint2) "bNf" = (/obj/item/device/radio/beacon,/turf/simulated/floor/engine,/area/toxins/telesci) -"bNg" = (/obj/structure/table/reinforced,/obj/machinery/atmospherics/unary/vent_pump{dir = 1; on = 1},/obj/item/weapon/clipboard,/turf/simulated/floor{icon_state = "white"},/area/toxins/telesci) +"bNg" = (/obj/structure/table/reinforced,/obj/machinery/atmospherics/unary/vent_pump{dir = 1; on = 1},/obj/item/weapon/clipboard,/obj/item/weapon/book/manual/telescience,/turf/simulated/floor{icon_state = "white"},/area/toxins/telesci) "bNh" = (/obj/structure/closet/emcloset,/turf/simulated/floor/plating,/area/maintenance/asmaint2) "bNi" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 8},/obj/machinery/door/poddoor/preopen{id = "telelab"; name = "test chamber blast door"},/turf/simulated/floor/plating,/area/toxins/telesci) "bNj" = (/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden,/obj/structure/cable{d1 = 1; d2 = 2; icon_state = "1-2"},/turf/simulated/floor{icon_state = "white"},/area/toxins/telesci)