diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 7bc4c2367be..86bb8fcab5f 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -17,9 +17,12 @@ /obj/machinery/teleport/pad/Initialize() . = ..() - station = locate() in range(2, src) + find_station() queue_icon_update() +/obj/machinery/teleport/pad/proc/find_station() + station = locate() in range(2, src) + /obj/machinery/teleport/pad/Destroy() station = null return ..() @@ -77,11 +80,33 @@ /obj/machinery/teleport/station/Initialize() . = ..() - pad = locate() in range(2, src) + find_pad() set_dir(get_dir(src, pad)) id = "[rand(1000, 9999)]" queue_icon_update() +/obj/machinery/teleport/station/proc/find_pad() + pad = locate() in range(2, src) + if(pad) + return TRUE + return FALSE + +/obj/machinery/teleport/station/examine(mob/user) + . = ..() + to_chat(user, SPAN_NOTICE("\The [src]'s station ID is: [id].")) + +/obj/machinery/teleport/station/machinery_process() + var/old_engaged = engaged + if(locked_obj) + if(stat & (NOPOWER|BROKEN)) + engaged = FALSE + else + engaged = TRUE + if(old_engaged != engaged) + update_icon() + if(pad) + pad.update_icon() + /obj/machinery/teleport/station/update_icon() . = ..() cut_overlays() @@ -116,12 +141,13 @@ data["calibration"] = 100 - calibration var/list/area_index = list() + var/obj/selected_beacon = locked_obj ? locked_obj.resolve() : null var/list/teleport_beacon_info = list() for(var/obj/item/device/radio/beacon/R in teleportbeacons) var/turf/BT = get_turf(R) if(!BT) continue - if(isNotStationLevel(BT.z)) + if(isAdminLevel(BT.z) || !AreConnectedZLevels(z, BT.z)) continue var/tmpname = BT.loc.name if(area_index[tmpname]) @@ -130,7 +156,8 @@ area_index[tmpname] = 1 var/list/teleporter_info = list( "beacon_name" = tmpname, - "ref" = "\ref[R]" + "ref" = "\ref[R]", + "selected_beacon" = (selected_beacon == R) ? TRUE : FALSE ) teleport_beacon_info[++teleport_beacon_info.len] = teleporter_info data["teleport_beacons"] = teleport_beacon_info @@ -141,13 +168,12 @@ continue else var/mob/M = I.loc - if(M.stat == DEAD) - if(M.timeofdeath + 6000 < world.time) - continue + if(M.stat == DEAD && M.timeofdeath + 6000 < world.time) + continue var/turf/IT = get_turf(M) if(!IT) continue - if(isNotStationLevel(IT.z)) + if(isAdminLevel(IT.z) || !AreConnectedZLevels(z, IT.z)) continue var/tmpname = M.real_name if(area_index[tmpname]) @@ -156,7 +182,8 @@ area_index[tmpname] = 1 var/list/implant_info = list( "implant_name" = tmpname, - "ref" = "\ref[I]" + "ref" = "\ref[I]", + "selected_implant" = (selected_beacon == I) ? TRUE : FALSE ) teleport_implant_info[++teleport_implant_info.len] = implant_info data["teleport_implants"] = teleport_implant_info @@ -175,6 +202,7 @@ var/obj/LO = locked_obj.resolve() if(LO == O) disengage() + SSvueui.check_uis_for_change(src) return locked_obj = WEAKREF(O) locked_obj_name = href_list["name"] @@ -187,6 +215,7 @@ var/obj/LO = locked_obj.resolve() if(LO == O) disengage() + SSvueui.check_uis_for_change(src) return locked_obj = WEAKREF(O) locked_obj_name = href_list["name"] @@ -200,6 +229,9 @@ if(stat & (BROKEN|NOPOWER)) return + if(!pad && !find_pad()) + return + use_power(5000) update_use_power(2) pad.update_use_power(2) @@ -214,13 +246,15 @@ return update_use_power(1) - pad.update_use_power(1) + if(pad) + pad.update_use_power(1) locked_obj = null locked_obj_name = null visible_message(SPAN_NOTICE("Teleporter disengaged!")) add_fingerprint(usr) engaged = FALSE - pad.queue_icon_update() + if(pad) + pad.queue_icon_update() queue_icon_update() /obj/machinery/teleport/station/power_change() diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 823c7a8a7db..54e219d626d 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -156,6 +156,8 @@ Frequency: var/obj/machinery/teleport/station/linked_station var/list/active_teleporters + var/max_portals = 2 + /obj/item/hand_tele/examine(mob/user, distance) . = ..() if(linked_station) @@ -168,7 +170,7 @@ Frequency: /obj/item/hand_tele/attack_self(mob/user) var/turf/current_location = get_turf(user)//What turf is the user on? - if(!current_location || isNotStationLevel(current_location.z)) + if(!current_location || isAdminLevel(current_location.z)) to_chat(user, SPAN_WARNING("\The [src] can't get a bearing on anything right now.")) return @@ -177,13 +179,20 @@ Frequency: to_chat(user, SPAN_DANGER("\The [src] can't seem to find a lock. Something in the area must be preventing the portal from opening...")) return - if(LAZYLEN(active_teleporters) >= 3) + if(LAZYLEN(active_teleporters) >= max_portals) user.show_message(SPAN_WARNING("\The [src] is recharging!")) return - var/teleport_turf - if(linked_station && linked_station.locked_obj) - teleport_turf = get_turf(linked_station.locked_obj.resolve()) + var/turf/teleport_turf + if(linked_station) + if(linked_station.stat & (NOPOWER|BROKEN)) + to_chat(user, SPAN_WARNING("The station \the [src] is connected doesn't seem to be responding!")) + return + if(!AreConnectedZLevels(current_location.z, linked_station.z)) + to_chat(user, SPAN_WARNING("The station \the [src] is connected to isn't close enough to lock onto now!")) + return + if(linked_station.locked_obj) + teleport_turf = get_turf(linked_station.locked_obj.resolve()) else var/list/potential_turfs = list() for(var/turf/T in orange(10)) @@ -201,10 +210,13 @@ Frequency: if(!teleport_turf) to_chat(user, SPAN_WARNING("\The [src] was unable to get a lock onto anything!")) return + if(isAdminLevel(teleport_turf.z)) + to_chat(user, SPAN_WARNING("The signal to the beacon seems to be scrambled!")) + return var/obj/effect/portal/P = new /obj/effect/portal(get_turf(src), teleport_turf, src) LAZYADD(active_teleporters, P) - if(LAZYLEN(active_teleporters) >= 3) + if(LAZYLEN(active_teleporters) >= max_portals) check_maptext(SMALL_FONTS(6, "Charge")) add_fingerprint(user) @@ -216,12 +228,14 @@ Frequency: /obj/item/hand_tele/CtrlClick(mob/user) if(user == loc) + var/turf/current_location = get_turf(src) var/list/teleport_options = list() for(var/obj/machinery/teleport/station/S in SSmachinery.all_machines) - if(S.engaged) - teleport_options["[S.id] (Active)"] = S - else - teleport_options["[S.id] (Inactive)"] = S + if(AreConnectedZLevels(current_location.z, S.z)) + if(S.engaged) + teleport_options["[S.id] (Active)"] = S + else + teleport_options["[S.id] (Inactive)"] = S teleport_options["None (Dangerous)"] = null var/teleport_choice = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") as null|anything in teleport_options if(!teleport_choice) @@ -241,7 +255,7 @@ Frequency: /obj/item/hand_tele/proc/remove_portal(var/obj/effect/portal/P) LAZYREMOVE(active_teleporters, P) - if(LAZYLEN(active_teleporters) < 3) + if(LAZYLEN(active_teleporters) < max_portals) check_maptext(SMALL_FONTS(7, "Ready")) /obj/item/closet_teleporter diff --git a/html/changelogs/geeves-teleportation_kneecapping.yml b/html/changelogs/geeves-teleportation_kneecapping.yml new file mode 100644 index 00000000000..8dbf8d84c30 --- /dev/null +++ b/html/changelogs/geeves-teleportation_kneecapping.yml @@ -0,0 +1,10 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "You can now clearly unset whatever the teleporter station is locked on to, turning off the telepad." + - rscadd: "The teleportation station hub will now show you its station ID when you examine it." + - bugfix: "Teleportation stations will now go offline and prevent hand-teles from locking on to them when they're depowered." + - tweak: "Teleportation stations now check whether the hand-tele and beacon is on a Z-level connected to it before locking on." + - tweak: "Hand-teles can now only support two active portals before having to recharge, making it more difficult to hop around endlessly." \ No newline at end of file diff --git a/vueui/src/components/view/machinery/teleporter.vue b/vueui/src/components/view/machinery/teleporter.vue index 2d022bcc881..6e582098f00 100644 --- a/vueui/src/components/view/machinery/teleporter.vue +++ b/vueui/src/components/view/machinery/teleporter.vue @@ -12,7 +12,7 @@ {{ beacon.beacon_name }} - Lock On + {{beacon.selected_beacon == true ? "Unset" : "Lock On"}} @@ -25,7 +25,7 @@ {{ implant.implant_name }} - Lock On + {{implant.selected_implant == true ? "Unset" : "Lock On"}} diff --git a/vueui/src/components/view/mcomputer/command/teleporter.vue b/vueui/src/components/view/mcomputer/command/teleporter.vue index 4140db977b2..a458db2b816 100644 --- a/vueui/src/components/view/mcomputer/command/teleporter.vue +++ b/vueui/src/components/view/mcomputer/command/teleporter.vue @@ -13,7 +13,7 @@ {{ beacon.beacon_name }} - Lock On + {{beacon.selected_beacon == true ? "Unset" : "Lock On"}} @@ -26,7 +26,7 @@ {{ implant.implant_name }} - Lock On + {{implant.selected_implant == true ? "Unset" : "Lock On"}}