Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes teleports calibration AGAIN #11257

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tvari
  • Loading branch information
TobyThorne committed Dec 20, 2023
commit e239652625796139c7f3f544eb38006a1906394f
45 changes: 12 additions & 33 deletions code/game/machinery/computer/teleporter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

var/id
var/mode = MODE_TELEPORT
var/calibrating = FALSE
var/list/linked_consoles
var/weakref/target_ref
var/obj/machinery/teleporter_gate/gate
Expand Down Expand Up @@ -62,6 +61,18 @@
id = "[random_id(/obj/machinery/computer/teleporter, 1000, 9999)]"
link_gate()

/obj/machinery/computer/teleporter/verb/set_id(t as text)
set category = "Object"
set name = "Set teleporter ID"
set src in oview(1)
set desc = "ID Tag:"

if(stat & (NOPOWER|BROKEN) || !istype(usr,/mob/living))
return
if(t)
src.id = t
return

/obj/machinery/computer/teleporter/Destroy()
if(gate)
gate.console = null
Expand Down Expand Up @@ -125,7 +136,6 @@
var/list/data = list()
data["gate"] = gate ? TRUE : FALSE
data["panel"] = panel_open
data["calibrating"] = calibrating
data["target"] = !target ? "None" : "[get_area(target)]"

switch(mode)
Expand All @@ -141,34 +151,12 @@
else
data["engaged"] = FALSE

if(gate?.calibrated)
data["calibrated"] = TRUE
else
data["calibrated"] = FALSE

return data

/obj/machinery/computer/teleporter/proc/change_mode()
mode = mode + 1 > 2 ? 0 : mode + 1
set_teleport_target(null)

/obj/machinery/computer/teleporter/proc/finish_calibrating()
calibrating = FALSE
if(!gate)
audible_message(SPAN_WARNING("Failure: Unable to detect gate."))
return
audible_message("Calibration complete.")
gate.calibrated = TRUE
gate.set_state(TRUE)
update_icon()

/obj/machinery/computer/teleporter/proc/start_calibrating(auto = FALSE)
if(auto && gate?.accuracy + gate?.calc_acceleration < MIN_MAX_GATE_LEVEL)
return
calibrating = TRUE
audible_message("Processing hub calibration to target...")
addtimer(CALLBACK(src, nameof(.proc/finish_calibrating)), 2 SECONDS * (4 - gate.calc_acceleration))

/obj/machinery/computer/teleporter/tgui_act(action, params)
. = ..()

Expand All @@ -185,19 +173,10 @@
to_chat(usr, "\The [src]'s maintanence panel is now [panel_open ? "opened" : "closed"].")
if("modeset")
gate.set_state(FALSE)
gate.calibrated = FALSE
change_mode()
if("targetset")
gate.set_state(FALSE)
gate.calibrated = FALSE
set_target(usr)
if("calibrate")
if(!target_ref)
audible_message("Error: No target set to calibrate to.")
return
if(gate.calibrated)
audible_message("Error: Hub is already calibrated!")
start_calibrating()

return TRUE

Expand Down
7 changes: 1 addition & 6 deletions code/game/machinery/teleporter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
light_color = "#7de1e1"

var/engaged = FALSE
var/calibrated = FALSE
var/accuracy
var/calc_acceleration
var/obj/machinery/computer/teleporter/console
Expand Down Expand Up @@ -114,11 +113,7 @@

if(istype(A))
use_power_oneoff(5 KILO WATTS)
do_teleport(A, target, calibrated ? 0 : clamp(DESTINATION_SPREAD_MIN, 10 - accuracy, DESTINATION_SPREAD_MAX))
calibrated = FALSE

console.start_calibrating(TRUE)

do_teleport(A, target)
return

/obj/machinery/teleporter_gate/Crossed(A)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
assembly_icon = 'icons/obj/device.dmi'
assembly_icon_state = "hand_tele"
assembly_w_class = ITEM_SIZE_SMALL
data = {"{'assembly':{'type':'type-c electronic machine','name':'Hand Teleporter'},'components':\[{'type':'button','name':'Open RIft'},{'type':'teleporter locator'},{'type':'bluespace rift generator'}],'wires':\[\[\[1,'A',1],\[3,'A',1]],\[\[2,'O',1],\[3,'I',1]]]}"}
data = {"{'assembly':{'type':'type-c electronic machine','name':'Hand Teleporter'},'components':\[{'type':'button','name':'Open Rift'},{'type':'teleporter locator'},{'type':'bluespace rift generator'}],'wires':\[\[\[1,'A',1],\[3,'A',1]],\[\[2,'O',1],\[3,'I',1]]]}"}
power_cell_type = /obj/item/cell/hyper

/obj/prefab/hand_teleporter
Expand Down
23 changes: 1 addition & 22 deletions tgui/packages/tgui/interfaces/Teleporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Teleporter = (props, context) => {

const UiData = (props, context) => {
const { act, data } = useBackend(context)
const { gate, calibrating, target, mode, calibrated, engaged, panel} = data
const { gate, target, mode, engaged, panel} = data

if(!gate)
return <NoticeBox>Error: No Gate connected.</NoticeBox>
Expand Down Expand Up @@ -58,27 +58,6 @@ const UiData = (props, context) => {
</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex direction="row" justify="space-between">
<Flex.Item>
Calibration:
</Flex.Item>
<Flex.Item>
{
(calibrating && <Box color="average">In Progress</Box>) ||
(!calibrated && <Box color="bad">Sub-Optimal</Box>) ||
(calibrated && <Box color="good">Optimal</Box>)
}
</Flex.Item>
<Flex.Item>
<Button
icon="dot-circle-o"
content="Calibrate!"
onClick={() => {act("calibrate")}}
/>
</Flex.Item>
</Flex>
</Flex.Item>
</Flex>
</Section>
)
Expand Down
2 changes: 1 addition & 1 deletion tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

Loading