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.
This commit is contained in:
Giacomand
2013-11-09 15:03:23 +00:00
parent edbc321511
commit 0c5cd7d8ac
3 changed files with 92 additions and 52 deletions
@@ -84,6 +84,23 @@
</html>
"}
/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 = {"
<html><head>
</head>
<body>
<iframe width='100%' height='97%' src="http://wiki.nanotrasen.com/index.php?title=Telescience&printable=yes&remove_links=1" frameborder="0" id="main_frame"></iframe>
</body>
</html>
"}
/obj/item/weapon/book/manual/engineering_hacking
name = "Hacking"
icon_state ="bookHacking"
+74 -51
View File
@@ -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.<BR>"
// 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 = "<div class='statusDisplay'>[temp_msg]</div>"
var/t = "<div class='statusDisplay'>[temp_msg]</div><BR>"
t += "<A href='?src=\ref[src];setrotation=1'>Set Rotation</A>"
t += "<div class='statusDisplay'>[rotation ? rotation : "NULL"]°</div>"
t += "<A href='?src=\ref[src];setangle=1'>Set Angle</A>:"
t += "<div class='statusDisplay'>[rotation]°</div>"
t += "<A href='?src=\ref[src];setangle=1'>Set Angle</A>"
t += "<div class='statusDisplay'>[angle ? angle : "NULL"]°</div>"
t += "<span class='linkOn'>Set Power</span>:"
t += "<span class='linkOn'>Set Power</span>"
t += "<div class='statusDisplay'>"
for(var/pwr in power_options)
@@ -72,24 +71,24 @@
t += "<A href='?src=\ref[src];setpower=[pwr]'>[pwr]</A>"
t += "</div>"
t += "<A href='?src=\ref[src];setz=1'>Set Z Level</A>:"
t += "<A href='?src=\ref[src];setz=1'>Set Sector</A>"
t += "<div class='statusDisplay'>[z_co ? z_co : "NULL"]</div>"
t += "<BR><BR><A href='?src=\ref[src];send=1'>Send</A>"
t += "<BR><A href='?src=\ref[src];send=1'>Send</A>"
t += " <A href='?src=\ref[src];receive=1'>Receive</A>"
t += "<BR><BR><A href='?src=\ref[src];recal=1'>Recalibrate</A>"
t += "<BR><A href='?src=\ref[src];recal=1'>Recalibrate</A>"
// Information about the last teleport
t += "<BR><div class='statusDisplay'>"
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])<BR>"
t += "Distance: [last_tele_data.distance]ft<BR>"
t += "Time: [last_tele_data.time]secs<BR>"
t += "</div>"
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.<BR>"
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()
updateDialog()
/obj/machinery/computer/telescience/proc/recalibrate()
teles_left = rand(20,30)
power_off = rand(-10, 10)
+1 -1
View File
@@ -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)