From fbd79a6c025f2d65091c59c5001be1a811ca29fb Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 13:02:15 +0000 Subject: [PATCH 1/7] Initial commit for telescience which uses projectile trajectory to obtain a destination coordinate. --- code/__HELPERS/game.dm | 41 ++++++++- code/__HELPERS/maths.dm | 6 ++ code/__HELPERS/type2type.dm | 5 +- code/datums/mixed.dm | 2 +- code/modules/telesci/telesci_computer.dm | 104 ++++++++++++++++------- 5 files changed, 120 insertions(+), 38 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 0d3baa00bd8..29ecd736372 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -325,4 +325,43 @@ proc/isInSight(var/atom/A, var/atom/B) if(O.started_as_observer) // Exclude people who started as observers continue active_players++ - return active_players \ No newline at end of file + return active_players + + +/datum/projectile_data + var/src_x + var/src_y + var/time + var/distance + var/power_x + var/power_y + var/dest_x + var/dest_y + +/datum/projectile_data/New(var/src_x, var/src_y, var/time, var/distance, \ + var/power_x, var/power_y, var/dest_x, var/dest_y) + src.src_x = src_x + src.src_y = src_y + src.time = time + src.distance = distance + src.power_x = power_x + src.power_y = power_y + src.dest_x = dest_x + src.dest_y = dest_y + +/proc/projectile_trajectory(var/src_x, var/src_y, var/rotation, var/angle, var/power) + + // returns the destination (Vx,y) that a projectile shot at [src_x], [src_y], with an angle of [angle], + // rotated at [rotation] and with the power of [power] + // Thanks to VistaPOWA for this function + + var/power_x = power * cos(angle) + var/power_y = power * sin(angle) + var/time = 2* power_y / 10 //10 = g + + var/distance = time * power_x + + var/dest_x = src_x + distance*sin(rotation); + var/dest_y = src_y + distance*cos(rotation); + + return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y) \ No newline at end of file diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index 4150b78286a..54aaf0d3483 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -106,6 +106,12 @@ var/const/Sqrt2 = 1.41421356 // Pi / 180 return degrees * 0.0174532925 +// Will filter out extra rotations and negative rotations +// E.g: 540 becomes 180. -180 becomes 180. +// Thanks to Flexicode for the formula. +/proc/SimplifyDegrees(degrees) + return ((degrees % 360 + 22.5) + 360) % 365 + // min is inclusive, max is exclusive /proc/Wrap(val, min, max) var/d = max - min diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm index 7e3b58c1980..b62d1947db6 100644 --- a/code/__HELPERS/type2type.dm +++ b/code/__HELPERS/type2type.dm @@ -189,10 +189,7 @@ proc/tg_list2text(list/list, glue=",") //Converts an angle (degrees) into an ss13 direction /proc/angle2dir(var/degree) - // Will filter out extra rotations and negative rotations - // E.g: 540 becomes 180. -180 becomes 180. - // Thanks to Flexicode for the formula. - degree = ((degree % 360 + 22.5) + 360) % 365 + degree = SimplifyDegrees(degree) if(degree < 45) return NORTH if(degree < 90) return NORTHEAST diff --git a/code/datums/mixed.dm b/code/datums/mixed.dm index c815d34cbe9..616c4eee99a 100644 --- a/code/datums/mixed.dm +++ b/code/datums/mixed.dm @@ -16,4 +16,4 @@ /datum/debug - var/list/debuglist + var/list/debuglist \ No newline at end of file diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 8d0c92cf12c..9700b1c51fd 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -8,17 +8,24 @@ // VARIABLES // var/teles_left // How many teleports left until it becomes uncalibrated - var/x_off // X offset - var/y_off // Y offset - var/x_co // X coordinate - var/y_co // Y coordinate - var/z_co // Z coordinate + var/datum/projectile_data/last_tele_data = null + var/z_co = 1 + var/rotation_off + var/power_off + + var/rotation + var/angle + var/power = 25 + + // Based on the power used + var/teleport_cooldown = 0 + var/list/power_options = list(50, 200, 500) // /obj/machinery/computer/telescience/New() ..() teles_left = rand(8,12) - x_off = rand(-10,10) - y_off = rand(-10,10) + rotation_off = rand(-10,10) + power_off = rand(-10,10) initialize() /obj/machinery/computer/telescience/initialize() @@ -51,14 +58,37 @@ /obj/machinery/computer/telescience/interact(mob/user) var/t = "
[temp_msg]
" - t += "Set X" - t += "Set Y" - t += "Set Z" - t += "

Current set coordinates:" - t += "([x_co ? x_co : "null"], [y_co ? y_co : "null"], [z_co ? z_co : "null"])" + t += "Set Rotation" + t += "
[rotation ? rotation : "NULL"]°
" + t += "Set Angle:" + t += "
[angle ? angle : "NULL"]°
" + t += "Set Power:" + t += "
" + + for(var/pwr in power_options) + if(power == pwr) + t += "[pwr]" + continue + t += "[pwr]" + + t += "
" + t += "Set Z Level:" + t += "
[z_co ? z_co : "NULL"]
" + t += "

Send" t += " Receive" 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 += "Distance: [last_tele_data.distance]ft
" + t += "Time: [last_tele_data.time]secs
" + t += "
" + var/datum/browser/popup = new(user, "telesci", name) popup.set_content(t) popup.open() @@ -79,11 +109,15 @@ return /obj/machinery/computer/telescience/proc/doteleport(mob/user) - var/trueX = (x_co + x_off) - var/trueY = (y_co + y_off) - trueX = Clamp(trueX, 1, world.maxx) - trueY = Clamp(trueY, 1, world.maxy) + 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) + + var/trueX = proj_data.dest_x + var/trueY = proj_data.dest_y + 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 @@ -104,20 +138,21 @@ for(var/atom/movable/ROI in source) if(!ismob(ROI) && ROI.anchored) continue do_teleport(ROI, dest, 0) - return - return + last_tele_data = proj_data + +// TO DO: add projectile_trajectory to telesci /obj/machinery/computer/telescience/proc/teleport(mob/user) - if(x_co == null || y_co == null || z_co == null) - temp_msg = "Error: set coordinates." + if(rotation == null || angle == null || z_co == null) + temp_msg = "Error: set a angle, rotation and z level." return - if(x_co < 1 || x_co > 255) + if(rotation < 0 || rotation > 360) telefail() - temp_msg = "Error: X is less than 1 or greater than 255." + temp_msg = "Error: Rotation is less than 0 or greater than 360." return - if(y_co < 1 || y_co > 255) + if(angle < 1 || angle > 90) telefail() - temp_msg = "Error: Y is less than 1 or greater than 255." + temp_msg = "Error: Angle is less than 1 or greater than 90." return if(z_co == 2 || z_co < 1 || z_co > 7) telefail() @@ -134,17 +169,22 @@ /obj/machinery/computer/telescience/Topic(href, href_list) if(..()) return - if(href_list["setx"]) - var/new_x = input("Please input desired X coordinate.", name, x_co) as num + if(href_list["setrotation"]) + 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 - x_co = Clamp(new_x, 1, 9999) + rotation = Clamp(new_rot, 1, 9999) - if(href_list["sety"]) - var/new_y = input("Please input desired Y coordinate.", name, y_co) as num + if(href_list["setangle"]) + var/new_angle = input("Please input desired angle in degrees.", name, angle) as num if(..()) return - y_co = Clamp(new_y, 1, 9999) + angle = Clamp(new_angle, 1, 9999) + + if(href_list["setpower"]) + var/pwr = href_list["setpower"] + if(pwr in power_options) + power = pwr if(href_list["setz"]) var/new_z = input("Please input desired Z coordinate.", name, z_co) as num @@ -162,8 +202,8 @@ if(href_list["recal"]) teles_left = rand(9,12) - x_off = rand(-10,10) - y_off = rand(-10,10) + rotation_off = rand(-10,10) + power_off = rand(-10,10) sparks() temp_msg = "Calibration successful." From 0c5cd7d8acc6c02486dec1bdb397bb9002e835f9 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 15:03:23 +0000 Subject: [PATCH 2/7] 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) From a9506400306acaa9ce55f17d37a0ea3c6dfbf6f0 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 15:23:14 +0000 Subject: [PATCH 3/7] Added a changelog. --- html/changelog.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/html/changelog.html b/html/changelog.html index 6da67b0f417..98f40394f4e 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -53,7 +53,13 @@ should be listed in the changelog upon commit tho. Thanks. --> - +
+

9 November 2013

+

Giacom, SuperSayu, Iamgoofball, VistaPOWA updated:

+
    +
  • Added Telescience! I would explain how it works but then it wouldn't be very sciencey! Have fun figuring it out. The room is near Xenobiology.
  • +
+

6 November 2013

From 1e9ede42eefc8842c48e95fae68cfc3ece07fccb Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 18:33:39 +0000 Subject: [PATCH 4/7] * Renamed rotation to bearing. * Renamed angle to elevation. --- code/modules/telesci/telesci_computer.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index f517afb3b7a..461939cd27f 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -57,9 +57,9 @@ /obj/machinery/computer/telescience/interact(mob/user) var/t = "
[temp_msg]

" - t += "Set Rotation" + t += "Set Bearing" t += "
[rotation]°
" - t += "Set Angle" + t += "Set Elevation" t += "
[angle ? angle : "NULL"]°
" t += "Set Power" t += "
" @@ -168,11 +168,11 @@ return if(rotation < 0 || rotation > 360) telefail() - temp_msg = "Error: Rotation is less than 0 or greater than 360." + temp_msg = "Error: Bearing is less than 0 or greater than 360." return if(angle < 1 || angle > 90) telefail() - temp_msg = "Error: Angle is less than 1 or greater than 90." + temp_msg = "Error: Elevation is less than 1 or greater than 90." return if(z_co == 2 || z_co < 1 || z_co > 7) telefail() @@ -190,13 +190,13 @@ if(..()) return if(href_list["setrotation"]) - var/new_rot = input("Please input desired rotation in degrees.", name, rotation) as num + var/new_rot = input("Please input desired bearing 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, 0, 9999) if(href_list["setangle"]) - var/new_angle = input("Please input desired angle in degrees.", name, angle) as num + var/new_angle = input("Please input desired elevation in degrees.", name, angle) as num if(..()) return angle = Clamp(new_angle, 1, 9999) From 1ee41eb9955796e98f5b5b803a2301102c82c9f1 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sat, 9 Nov 2013 21:56:10 +0000 Subject: [PATCH 5/7] * Added sound effects for charging and teleporting. * Cleaned up the UI so it doesn't move around. * You can now enter -90 into the bearing to get 270. --- code/__HELPERS/maths.dm | 6 ++- code/modules/telesci/telesci_computer.dm | 49 ++++++++++++++++-------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index 54aaf0d3483..e22cfe454b4 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -108,9 +108,11 @@ var/const/Sqrt2 = 1.41421356 // Will filter out extra rotations and negative rotations // E.g: 540 becomes 180. -180 becomes 180. -// Thanks to Flexicode for the formula. /proc/SimplifyDegrees(degrees) - return ((degrees % 360 + 22.5) + 360) % 365 + degrees = degrees % 360 + if(degrees < 0) + degrees += 360 + return degrees // min is inclusive, max is exclusive /proc/Wrap(val, min, max) diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 461939cd27f..377f1b89faf 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -1,10 +1,10 @@ /obj/machinery/computer/telescience - name = "telepad control console" + name = "\improper Telepad Control Console" desc = "Used to teleport objects to and from the telescience telepad." 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.
Welcome." // VARIABLES // var/teles_left // How many teleports left until it becomes uncalibrated @@ -110,11 +110,11 @@ /obj/machinery/computer/telescience/proc/doteleport(mob/user) if(teleport_cooldown > world.time) - temp_msg = "Telepad is recharging power, please wait [round((teleport_cooldown - world.time) / 10)] seconds." + temp_msg = "Telepad is recharging power.
Please wait [round((teleport_cooldown - world.time) / 10)] seconds." return if(teleporting) - temp_msg = "Telepad is in use. Please wait.
" + temp_msg = "Telepad is in use.
Please wait." return if(telepad) @@ -127,24 +127,36 @@ 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/spawn_time = round(proj_data.time) * 10 var/turf/target = locate(trueX, trueY, z_co) var/area/A = get_area(target) flick("pad-beam", telepad) - // Wait depending on the time the projectile took to get there - teleporting = 1 - temp_msg = "Powering up bluespace crystals." + if(spawn_time > 15) // 1.5 seconds + playsound(telepad.loc, 'sound/weapons/flash.ogg', 25, 1) + // Wait depending on the time the projectile took to get there + teleporting = 1 + temp_msg = "Powering up bluespace crystals.
Please wait." + spawn(round(proj_data.time) * 10) // in seconds teleporting = 0 teleport_cooldown = world.time + (power * 2) + teles_left -= 1 + + // use a lot of power + use_power(power * 10) 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." + temp_msg = "Teleport successful.
" + if(teles_left < 10) + temp_msg += "
Calibration required soon." + else + temp_msg += "Data printed below." 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 @@ -156,33 +168,35 @@ source = dest dest = target flick("pad-beam", telepad) + playsound(telepad.loc, 'sound/weapons/emitter2.ogg', 25, 1) for(var/atom/movable/ROI in source) if(!ismob(ROI) && ROI.anchored) continue do_teleport(ROI, dest, 0) + updateDialog() // 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 sector." + temp_msg = "ERROR!
Set a angle, rotation and sector." return if(rotation < 0 || rotation > 360) telefail() - temp_msg = "Error: Bearing is less than 0 or greater than 360." + temp_msg = "ERROR!
Bearing is less than 0 or greater than 360." return if(angle < 1 || angle > 90) telefail() - temp_msg = "Error: Elevation is less than 1 or greater than 90." + temp_msg = "ERROR!
Elevation is less than 1 or greater than 90." return if(z_co == 2 || z_co < 1 || z_co > 7) telefail() - temp_msg = "Error: Sector 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 doteleport(user) else telefail() + temp_msg = "ERROR!
Calibration required." return return @@ -193,13 +207,14 @@ var/new_rot = input("Please input desired bearing 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, 0, 9999) + rotation = Clamp(round(new_rot, 0.1), -9999, 9999) + rotation = SimplifyDegrees(rotation) if(href_list["setangle"]) var/new_angle = input("Please input desired elevation in degrees.", name, angle) as num if(..()) return - angle = Clamp(new_angle, 1, 9999) + angle = Clamp(round(new_angle, 0.1), 1, 9999) if(href_list["setpower"]) var/pwr = href_list["setpower"] @@ -224,10 +239,10 @@ if(href_list["recal"]) recalibrate() sparks() - temp_msg = "Calibration successful." + temp_msg = "NOTICE:
Calibration successful." updateDialog() /obj/machinery/computer/telescience/proc/recalibrate() - teles_left = rand(20,30) + teles_left = rand(40, 50) power_off = rand(-10, 10) \ No newline at end of file From 0d0997b5f2700eec8c62a7e1c45295f6cc537a37 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sun, 10 Nov 2013 14:36:19 +0000 Subject: [PATCH 6/7] GPS will now uppercase all new tags. Elevation now starts at 45 degrees. --- code/modules/telesci/gps.dm | 2 +- code/modules/telesci/telesci_computer.dm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/telesci/gps.dm b/code/modules/telesci/gps.dm index 1f42e0de4f7..2bf3765337e 100644 --- a/code/modules/telesci/gps.dm +++ b/code/modules/telesci/gps.dm @@ -57,7 +57,7 @@ var/list/GPS_list = list() ..() if(href_list["tag"] ) var/a = input("Please enter desired tag.", name, gpstag) as text - a = copytext(sanitize(a), 1, 20) + a = uppertext(copytext(sanitize(a), 1, 20)) if(src.loc == usr) if(length(a) != 4) usr << " The tag must be four letters long!" diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 377f1b89faf..aae619b514a 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -13,7 +13,7 @@ var/power_off var/rotation = 0 - var/angle + var/angle = 45 var/power // Based on the power used @@ -60,7 +60,7 @@ t += "Set Bearing" t += "
[rotation]°
" t += "Set Elevation" - t += "
[angle ? angle : "NULL"]°
" + t += "
[angle]°
" t += "Set Power" t += "
" From f635ad3dc1f10bf826127eb7cb9a787630ca87b1 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sun, 10 Nov 2013 15:02:08 +0000 Subject: [PATCH 7/7] Changed the distance measurement from feet to meters. GPS will now take the first 4 characters, instead of rejecting large texts. --- code/modules/telesci/gps.dm | 12 ++++-------- code/modules/telesci/telesci_computer.dm | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/code/modules/telesci/gps.dm b/code/modules/telesci/gps.dm index 2bf3765337e..3850d439d21 100644 --- a/code/modules/telesci/gps.dm +++ b/code/modules/telesci/gps.dm @@ -57,15 +57,11 @@ var/list/GPS_list = list() ..() if(href_list["tag"] ) var/a = input("Please enter desired tag.", name, gpstag) as text - a = uppertext(copytext(sanitize(a), 1, 20)) + a = uppertext(copytext(sanitize(a), 1, 5)) if(src.loc == usr) - if(length(a) != 4) - usr << " The tag must be four letters long!" - return - else - gpstag = a - name = "global positioning system ([gpstag])" - attack_self(usr) + gpstag = a + name = "global positioning system ([gpstag])" + attack_self(usr) /obj/item/device/gps/science icon_state = "gps-s" diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index aae619b514a..3dbd24ad0d8 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -84,8 +84,8 @@ t += "No teleport data found." else 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 += "Distance: [last_tele_data.distance]m
" + t += "Time: [last_tele_data.time] secs
" t += "
" var/datum/browser/popup = new(user, "telesci", name, 300, 500)