/* All telecommunications interactions: */ #define STATION_Z 1 #define TELECOMM_Z 3 /obj/machinery/telecomms var/temp = "" // output message /obj/machinery/telecomms/attackby(obj/item/P, mob/user, params) var/icon_closed = initial(icon_state) var/icon_open = "[initial(icon_state)]_o" if(!on) icon_closed = "[initial(icon_state)]_off" icon_open = "[initial(icon_state)]_o_off" if(default_deconstruction_screwdriver(user, icon_open, icon_closed, P)) return else if(exchange_parts(user, P)) return // Using a multitool lets you access the receiver's interface else if(istype(P, /obj/item/device/multitool)) attack_hand(user) else if(default_deconstruction_crowbar(P)) return else return ..() /obj/machinery/telecomms/attack_ai(mob/user) attack_hand(user) /obj/machinery/telecomms/attack_hand(mob/user) // You need a multitool to use this, or be silicon if(!issilicon(user)) // istype returns false if the value is null if(!istype(user.get_active_held_item(), /obj/item/device/multitool)) return if(stat & (BROKEN|NOPOWER)) return var/obj/item/device/multitool/P = get_multitool(user) user.set_machine(src) var/dat dat = "[src.name]

[src.name] Access

" dat += "
[temp]
" dat += "
Power Status: [src.toggled ? "On" : "Off"]" if(on && toggled) if(id != "" && id) dat += "
Identification String: [id]" else dat += "
Identification String: NULL" dat += "
Network: [network]" dat += "
Prefabrication: [autolinkers.len ? "TRUE" : "FALSE"]" if(hide) dat += "
Shadow Link: ACTIVE" //Show additional options for certain machines. dat += Options_Menu() dat += "
Linked Network Entities:
    " var/i = 0 for(var/obj/machinery/telecomms/T in links) i++ if(T.hide && !src.hide) continue dat += "
  1. \ref[T] [T.name] ([T.id]) \[X\]
  2. " dat += "
" dat += "
Filtering Frequencies: " i = 0 if(length(freq_listening)) for(var/x in freq_listening) i++ if(i < length(freq_listening)) dat += "[format_frequency(x)] GHz\[X\]; " else dat += "[format_frequency(x)] GHz\[X\]" else dat += "NONE" dat += "
\[Add Filter\]" dat += "
" if(P) var/obj/machinery/telecomms/T = P.buffer if(istype(T)) dat += "

MULTITOOL BUFFER: [T] ([T.id]) \[Link\] \[Flush\]" else dat += "

MULTITOOL BUFFER:
\[Add Machine\]" dat += "
" temp = "" user << browse(dat, "window=tcommachine;size=520x500;can_resize=0") onclose(user, "dormitory") // Off-Site Relays // // You are able to send/receive signals from the station's z level (changeable in the STATION_Z #define) if // the relay is on the telecomm satellite (changable in the TELECOMM_Z #define) /obj/machinery/telecomms/relay/proc/toggle_level() var/turf/position = get_turf(src) // Toggle on/off getting signals from the station or the current Z level if(src.listening_level == STATION_Z) // equals the station src.listening_level = position.z return 1 else if(position.z == TELECOMM_Z) src.listening_level = STATION_Z return 1 return 0 // Returns a multitool from a user depending on their mobtype. /obj/machinery/telecomms/proc/get_multitool(mob/user) var/obj/item/device/multitool/P = null // Let's double check if(!issilicon(user) && istype(user.get_active_held_item(), /obj/item/device/multitool)) P = user.get_active_held_item() else if(isAI(user)) var/mob/living/silicon/ai/U = user P = U.aiMulti else if(iscyborg(user) && in_range(user, src)) if(istype(user.get_active_held_item(), /obj/item/device/multitool)) P = user.get_active_held_item() return P // Additional Options for certain machines. Use this when you want to add an option to a specific machine. // Example of how to use below. /obj/machinery/telecomms/proc/Options_Menu() return "" // The topic for Additional Options. Use this for checking href links for your specific option. // Example of how to use below. /obj/machinery/telecomms/proc/Options_Topic(href, href_list) return // RELAY /obj/machinery/telecomms/relay/Options_Menu() var/dat = "" if(src.z == TELECOMM_Z) dat += "
Signal Locked to Station: [listening_level == STATION_Z ? "TRUE" : "FALSE"]" dat += "
Broadcasting: [broadcasting ? "YES" : "NO"]" dat += "
Receiving: [receiving ? "YES" : "NO"]" return dat /obj/machinery/telecomms/relay/Options_Topic(href, href_list) if(href_list["receive"]) receiving = !receiving temp = "-% Receiving mode changed. %-" if(href_list["broadcast"]) broadcasting = !broadcasting temp = "-% Broadcasting mode changed. %-" if(href_list["change_listening"]) //Lock to the station OR lock to the current position! //You need at least two receivers and two broadcasters for this to work, this includes the machine. var/result = toggle_level() if(result) temp = "-% [src]'s signal has been successfully changed." else temp = "-% [src] could not lock its signal onto the station. Two broadcasters or receivers required." // BUS /obj/machinery/telecomms/bus/Options_Menu() var/dat = "
Change Signal Frequency: [change_frequency ? "YES ([change_frequency])" : "NO"]" return dat /obj/machinery/telecomms/bus/Options_Topic(href, href_list) if(href_list["change_freq"]) var/newfreq = input(usr, "Specify a new frequency for new signals to change to. Enter null to turn off frequency changing. Decimals assigned automatically.", src, network) as null|num if(canAccess(usr)) if(newfreq) if(findtext(num2text(newfreq), ".")) newfreq *= 10 // shift the decimal one place if(newfreq < 10000) change_frequency = newfreq temp = "-% New frequency to change to assigned: \"[newfreq] GHz\" %-" else change_frequency = 0 temp = "-% Frequency changing deactivated %-" /obj/machinery/telecomms/Topic(href, href_list) if(..()) return if(!issilicon(usr)) if(!istype(usr.get_active_held_item(), /obj/item/device/multitool)) return var/obj/item/device/multitool/P = get_multitool(usr) if(href_list["input"]) switch(href_list["input"]) if("toggle") src.toggled = !src.toggled temp = "-% [src] has been [src.toggled ? "activated" : "deactivated"]." update_power() /* if("hide") src.hide = !hide temp = "-% Shadow Link has been [src.hide ? "activated" : "deactivated"]." */ if("id") var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID for this machine", src, id) as null|text),1,MAX_MESSAGE_LEN) if(newid && canAccess(usr)) id = newid temp = "-% New ID assigned: \"[id]\" %-" if("network") var/newnet = stripped_input(usr, "Specify the new network for this machine. This will break all current links.", src, network) if(newnet && canAccess(usr)) if(length(newnet) > 15) temp = "-% Too many characters in new network tag %-" else for(var/obj/machinery/telecomms/T in links) T.links.Remove(src) network = newnet links = list() temp = "-% New network tag assigned: \"[network]\" %-" if("freq") var/newfreq = input(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, network) as null|num if(newfreq && canAccess(usr)) if(findtext(num2text(newfreq), ".")) newfreq *= 10 // shift the decimal one place if(newfreq == GLOB.SYND_FREQ) temp = "-% Error: Interference preventing filtering frequency: \"[newfreq] GHz\" %-" else if(!(newfreq in freq_listening) && newfreq < 10000) freq_listening.Add(newfreq) temp = "-% New frequency filter assigned: \"[newfreq] GHz\" %-" if(href_list["delete"]) // changed the layout about to workaround a pesky runtime -- Doohl var/x = text2num(href_list["delete"]) temp = "-% Removed frequency filter [x] %-" freq_listening.Remove(x) if(href_list["unlink"]) if(text2num(href_list["unlink"]) <= length(links)) var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])] if(T) temp = "-% Removed \ref[T] [T.name] from linked entities. %-" // Remove link entries from both T and src. if(T.links) T.links.Remove(src) links.Remove(T) else temp = "-% Unable to locate machine to unlink from, try again. %-" if(href_list["link"]) if(P) var/obj/machinery/telecomms/T = P.buffer if(istype(T) && T != src) if(!(src in T.links)) T.links.Add(src) if(!(T in src.links)) src.links.Add(T) temp = "-% Successfully linked with \ref[T] [T.name] %-" else temp = "-% Unable to acquire buffer %-" if(href_list["buffer"]) P.buffer = src temp = "-% Successfully stored \ref[P.buffer] [P.buffer.name] in buffer %-" if(href_list["flush"]) temp = "-% Buffer successfully flushed. %-" P.buffer = null src.Options_Topic(href, href_list) usr.set_machine(src) updateUsrDialog() /obj/machinery/telecomms/proc/canAccess(mob/user) if(issilicon(user) || in_range(user, src)) return 1 return 0 #undef TELECOMM_Z #undef STATION_Z