diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 718cf89ecc6..a32c3d72c11 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -329,4 +329,42 @@ 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 + 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) diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index 4150b78286a..e22cfe454b4 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -106,6 +106,14 @@ 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. +/proc/SimplifyDegrees(degrees) + degrees = degrees % 360 + if(degrees < 0) + degrees += 360 + return degrees + // 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/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/gps.dm b/code/modules/telesci/gps.dm index 1f42e0de4f7..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 = 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 8d0c92cf12c..3dbd24ad0d8 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -1,24 +1,30 @@ /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 - 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/power_off + + var/rotation = 0 + var/angle = 45 + var/power + + // Based on the power used + var/teleport_cooldown = 0 + var/list/power_options = list(5, 10, 25, 50, 100) // + var/teleporting = 0 /obj/machinery/computer/telescience/New() ..() - teles_left = rand(8,12) - x_off = rand(-10,10) - y_off = rand(-10,10) + recalibrate() + power = power_options[1] initialize() /obj/machinery/computer/telescience/initialize() @@ -50,16 +56,39 @@ /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 += "

Send" + var/t = "
[temp_msg]

" + t += "Set Bearing" + t += "
[rotation]°
" + t += "Set Elevation" + t += "
[angle]°
" + t += "Set Power" + t += "
" + + for(var/pwr in power_options) + if(power == pwr) + t += "[pwr]" + continue + t += "[pwr]" + + t += "
" + t += "Set Sector" + t += "
[z_co ? z_co : "NULL"]
" + + t += "
Send" t += " Receive" - t += "

Recalibrate" - var/datum/browser/popup = new(user, "telesci", name) + 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]m
" + t += "Time: [last_tele_data.time] secs
" + t += "
" + + var/datum/browser/popup = new(user, "telesci", name, 300, 500) popup.set_content(t) popup.open() return @@ -79,78 +108,125 @@ 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(teleport_cooldown > world.time) + 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." + 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/spawn_time = round(proj_data.time) * 10 + 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) - return - return + + 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.
" + 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 + 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) + 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(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 sector." 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!
Bearing 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!
Elevation is less than 1 or greater than 90." 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 doteleport(user) else telefail() + temp_msg = "ERROR!
Calibration required." return return /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 bearing 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(round(new_rot, 0.1), -9999, 9999) + rotation = SimplifyDegrees(rotation) - 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 elevation in degrees.", name, angle) as num if(..()) return - y_co = Clamp(new_y, 1, 9999) + angle = Clamp(round(new_angle, 0.1), 1, 9999) + + if(href_list["setpower"]) + var/pwr = href_list["setpower"] + 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 @@ -161,10 +237,12 @@ teleport(usr) if(href_list["recal"]) - teles_left = rand(9,12) - x_off = rand(-10,10) - y_off = rand(-10,10) + recalibrate() sparks() - temp_msg = "Calibration successful." + temp_msg = "NOTICE:
Calibration successful." - updateDialog() \ No newline at end of file + updateDialog() + +/obj/machinery/computer/telescience/proc/recalibrate() + teles_left = rand(40, 50) + power_off = rand(-10, 10) \ No newline at end of file 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:

+ +

6 November 2013

diff --git a/maps/tgstation.2.1.2.dmm b/maps/tgstation.2.1.2.dmm index 09a641ee7c0..d37c1735ddf 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)