var/datum/telescope_manager/tele_man var/list/telescope_computers = list() /datum/telescope_manager var/list/events_inactive = list() var/list/events_active = list() var/list/events_found = list() proc/setup() var/types = (typesof(/datum/telescope_event) - /datum/telescope_event) for(var/x in types) var/datum/telescope_event/R = new x(src) events_inactive.Add(R.id) events_inactive[R.id] = R if(!R.fixed_location) R.loc_x = rand(0, 600) R.loc_y = rand(0, 400) return proc/tick() return proc/onScan() //TBI update event list of all telecomps if(events_active.len < 3) if(events_inactive.len) var/picked = pick(events_inactive) var/datum/telescope_event/T = events_inactive[picked] events_active.Add(picked) events_active[picked] = T events_inactive.Remove(picked) return /datum/telescope_event/sosvaliant name = "SS Valiant distress signal" name_undiscovered = "Unknown signal 23.23" desc = "This is a distress signal sent by the spaceship 'Valiant'.
The ship is not responding to hails.
It seems like there is currently no way to contact them." id = "valiantdistress" icon = "valiant.png" size = 10 contact_verb = "CONTACT" contact_image = "audio.png" //Alternative image of the object for the contact screen. otherwise icon is used. onActivate(var/obj/machinery/computer/telescope/T) ..() return /datum/telescope_event/geminorum name = "5604 Geminorum V" name_undiscovered = "Unknown beacon A23V" desc = "There appears to be some sort of signal beacon in a cave on this planet.
Scans show that the planet is strangely devoid of any sentient life despite it's lush vegetation.
An expedition would be required to find out more about this place.
Co-ordinates have been uploaded to the science teleporter. (TBI, Sorry about that)" id = "geminorum" icon = "planet3.png" size = 15 contact_verb = "SCAN" contact_image = "blueplanet.png" //Alternative image of the object for the contact screen. otherwise icon is used. onActivate(var/obj/machinery/computer/telescope/T) ..() if(!special_places.Find(name)) special_places.Add(name) var/datum/computer/file/coords/C = new() C.destx = 255 C.desty = 3 C.destz = 2 special_places[id] = C return /datum/telescope_event var/name = "" //Name which is shown after discovery var/name_undiscovered = "" //Name which is shown when you haven't found this event yet. var/desc = "" var/id = "" var/icon = "" //TBI Add rarity controls var/fixed_location = 0 var/loc_x = 0 var/loc_y = 0 var/size = 10 //The size of the spot you need to hit. var/contact_verb = "PING" var/contact_image = "" proc/onActivate(var/obj/machinery/computer/telescope/T) return /obj/machinery/computer/telescope name = "quantuum telescope" icon = 'icons/obj/computer.dmi' icon_state = "computer_generic" var/mob/using = null var/tracking_id = "" //id of the event we're tracking/targeting. var/links = {""} var/js = {" "} New() //TBI REMOVE FROM LIST ON DELETION telescope_computers.Add(src) ..() attack_ai(mob/user as mob) return attack_hand(user) attack_hand(mob/user as mob) if(stat & (BROKEN|NOPOWER)) return if(using && (!using.client || using.client.inactivity >= 1200 || get_dist(src, using) > 1)) using << browse(null, "window=materials") using = null if(using && using != user) boutput(user, "Somebody is already using that machine.") return. using = user //MAKE THE STATIC FLOAT SO STUFF CAN GO UNDER IT. POSITION ABSOLUTE ETC var/html = {" [links] Radio telescope
Scan
Ready ...
[js] "} user.machine = src add_fingerprint(user) user << browse(html, "window=telescope;size=800x435;can_resize=0;can_minimize=0;can_close=1") onclose(user, "telescope", src) spawn(10) callJsFunc(usr, "setRef", list("\ref[src]")) //This is shit but without it, it calls the JS before the window is open and doesn't work. loadContent("Starmap", "#contentInner") return proc/loadContent(var/content, var/divId) var/newHtml = "" switch(content) if("EventList") if(tele_man) for(var/A in tele_man.events_active) var/datum/telescope_event/E = tele_man.events_active[A] newHtml += "
[E.name_undiscovered]
" newHtml += {""} for(var/A in tele_man.events_found) var/datum/telescope_event/E = tele_man.events_found[A] newHtml += "
[E.name]
" newHtml += {""} if("Starmap") var/foundlocs = "" if(tele_man && tele_man.events_found.len) for(var/A in tele_man.events_found) var/datum/telescope_event/E = tele_man.events_found[A] //Clicking on the icons doesnt work. foundlocs += {"
"} //foundlocs += {""} newHtml = {"
[foundlocs]
"} if(length(newHtml) && divId) callJsFunc(usr, "setHtmlId", list(divId, newHtml)) Topic(href, href_list) //boutput(world, href) if(!using || get_dist(using, src) > 1) using << browse(null, "window=telescope") using = null return if(href_list["close"]) using = null else if(href_list["jscall"]) switch(href_list["jscall"]) if("contact") if(tele_man.events_found.Find(tracking_id)) var/datum/telescope_event/E = tele_man.events_found[tracking_id] var/html = "" html += {"
[E.name]"} html += {"

[E.desc]

"} callJsFunc(usr, "setHtmlId", list("#contentInspect", html)) callJsFunc(usr, "showContact", list()) if("trackId") tracking_id = href_list["id"] loadContent("EventList", "#contentSide") if(tele_man && tracking_id) if(tele_man.events_active.Find(tracking_id)) var/datum/telescope_event/E = tele_man.events_active[tracking_id] callJsFunc(usr, "setHtmlId", list("#statusText", "Now tracking: [E.name_undiscovered]")) callJsFunc(usr, "setHtmlId", list("#contentContact", "")) else if(tele_man.events_found.Find(tracking_id)) var/datum/telescope_event/E = tele_man.events_found[tracking_id] callJsFunc(usr, "setHtmlId", list("#statusText", "Now targeting: [E.name]")) callJsFunc(usr, "setHtmlId", list("#contentContact", "[E.contact_verb]")) loadContent("Starmap", "#contentInner") if("scanComplete") if(tele_man) tele_man.onScan() if(tracking_id) if(tele_man.events_active.Find(tracking_id)) var/datum/telescope_event/E = tele_man.events_active[tracking_id] var/posx = text2num(href_list["posx"]) var/posy = text2num(href_list["posy"]) var/distx = abs(posx - E.loc_x) var/disty = abs(posy - E.loc_y) if(distx + disty <= E.size) //REVERT CONDITION TO NORMAL AFTER TESTING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! E.onActivate(src) tele_man.events_active.Remove(tracking_id) tele_man.events_found.Add(tracking_id) tele_man.events_found[tracking_id] = E tracking_id = "" loadContent("Starmap", "#contentInner") callJsFunc(usr, "setHtmlId", list("#statusText", "Distance: [distx + disty] LY")) loadContent("EventList", "#contentSide") if("closeWindow") usr << browse(null, "window=telescope") using = null if("loadContent") var/contentName = href_list["name"] var/targetCont = href_list["target"] loadContent(contentName, targetCont) src.add_fingerprint(usr) callJsFunc(usr, "setRef", list("\ref[src]")) return proc/callJsFunc(var/client, var/funcName, var/list/params) var/paramsJS = list2params(params) client << output(paramsJS,"telescope.browser:[funcName]") return