#define NUKESCALINGMODIFIER 1 var/list/possible_uplinker_IDs = list("Alfa","Bravo","Charlie","Delta","Echo","Foxtrot","Zero", "Niner") /obj/machinery/computer/telecrystals name = "\improper Telecrystal assignment station" desc = "A device used to manage telecrystals during group operations. You shouldn't be looking at this particular one..." icon_state = "tcstation" icon_keyboard = "tcstation_key" icon_screen = "syndie" clockwork = TRUE //it'd look weird, at least if ratvar ever got there ///////////////////////////////////////////// /obj/machinery/computer/telecrystals/uplinker name = "\improper Telecrystal upload/receive station" desc = "A device used to manage telecrystals during group operations. To use, simply insert your uplink. With your uplink installed \ you can upload your telecrystals to the group's pool using the console, or be assigned additional telecrystals by your lieutenant." var/obj/item/uplinkholder = null var/obj/machinery/computer/telecrystals/boss/linkedboss = null /obj/machinery/computer/telecrystals/uplinker/New() ..() var/ID if(possible_uplinker_IDs.len) ID = pick(possible_uplinker_IDs) possible_uplinker_IDs -= ID name = "[name] [ID]" else name = "[name] [rand(1,999)]" /obj/machinery/computer/telecrystals/uplinker/attackby(obj/item/O, mob/user, params) if(uplinkholder) user << "The [src] already has an uplink in it." return if(O.hidden_uplink) var/obj/item/I = user.get_active_hand() if(!user.drop_item()) return uplinkholder = I I.loc = src I.add_fingerprint(user) update_icon() updateUsrDialog() else user << "The [O] doesn't appear to be an uplink..." /obj/machinery/computer/telecrystals/uplinker/update_icon() ..() if(uplinkholder) add_overlay("[initial(icon_state)]-closed") /obj/machinery/computer/telecrystals/uplinker/proc/ejectuplink() if(uplinkholder) uplinkholder.loc = get_turf(src.loc) uplinkholder = null update_icon() /obj/machinery/computer/telecrystals/uplinker/proc/donateTC(amt, addLog = 1) if(uplinkholder && linkedboss) if(amt <= uplinkholder.hidden_uplink.telecrystals) uplinkholder.hidden_uplink.telecrystals -= amt linkedboss.storedcrystals += amt if(addLog) linkedboss.logTransfer("[src] donated [amt] telecrystals to [linkedboss].") /obj/machinery/computer/telecrystals/uplinker/proc/giveTC(amt, addLog = 1) if(uplinkholder && linkedboss) if(amt <= linkedboss.storedcrystals) uplinkholder.hidden_uplink.telecrystals += amt linkedboss.storedcrystals -= amt if(addLog) linkedboss.logTransfer("[src] received [amt] telecrystals from [linkedboss].") /////// /obj/machinery/computer/telecrystals/uplinker/attack_hand(mob/user) if(..()) return src.add_fingerprint(user) user.set_machine(src) var/dat = "" if(linkedboss) dat += "[linkedboss] has [linkedboss.storedcrystals] telecrystals available for distribution.

" else dat += "No linked management consoles detected. Scan for uplink stations using the management console.

" if(uplinkholder) dat += "[uplinkholder.hidden_uplink.telecrystals] telecrystals remain in this uplink.
" if(linkedboss) dat += "Donate TC: 1 | 5" dat += "
Eject Uplink" var/datum/browser/popup = new(user, "computer", "Telecrystal Upload/Receive Station", 700, 500) popup.set_content(dat) popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) popup.open() return /obj/machinery/computer/telecrystals/uplinker/Topic(href, href_list) if(..()) return if(href_list["donate1"]) donateTC(1) if(href_list["donate5"]) donateTC(5) if(href_list["eject"]) ejectuplink() src.updateUsrDialog() ///////////////////////////////////////// /obj/machinery/computer/telecrystals/boss name = "team Telecrystal management console" desc = "A device used to manage telecrystals during group operations. To use, simply initialize the machine by scanning for nearby uplink stations. \ Once the consoles are linked up, you can assign any telecrystals amongst your operatives; be they donated by your agents or rationed to the squad \ based on the danger rating of the mission." icon_state = "computer" icon_screen = "tcboss" icon_keyboard = "syndie_key" var/virgin = 1 var/scanrange = 10 var/storedcrystals = 0 var/list/TCstations = list() var/list/transferlog = list() /obj/machinery/computer/telecrystals/boss/proc/logTransfer(logmessage) transferlog += ("[worldtime2text()] [logmessage]") /obj/machinery/computer/telecrystals/boss/proc/scanUplinkers() for(var/obj/machinery/computer/telecrystals/uplinker/A in urange(scanrange, src.loc)) if(!A.linkedboss) TCstations += A A.linkedboss = src if(virgin) getDangerous() virgin = 0 /obj/machinery/computer/telecrystals/boss/proc/getDangerous()//This scales the TC assigned with the round population. ..() var/danger danger = joined_player_list.len - ticker.mode.syndicates.len danger = Ceiling(danger, 10) scaleTC(danger) /obj/machinery/computer/telecrystals/boss/proc/scaleTC(amt)//Its own proc, since it'll probably need a lot of tweaks for balance, use a fancier algorhithm, etc. storedcrystals += amt * NUKESCALINGMODIFIER ///////// /obj/machinery/computer/telecrystals/boss/attack_hand(mob/user) if(..()) return src.add_fingerprint(user) user.set_machine(src) var/dat = "" dat += "Scan for TC stations.
" dat += "This [src] has [storedcrystals] telecrystals available for distribution.
" dat += "

" for(var/obj/machinery/computer/telecrystals/uplinker/A in TCstations) dat += "[A.name] | " if(A.uplinkholder) dat += "[A.uplinkholder.hidden_uplink.telecrystals] telecrystals." if(storedcrystals) dat+= "
Add TC: 1 | 5" dat += "
" if(TCstations.len) dat += "

Evenly distribute remaining TC.

" for(var/entry in transferlog) dat += "[entry]
" var/datum/browser/popup = new(user, "computer", "Team Telecrystal Management Console", 700, 500) popup.set_content(dat) popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) popup.open() return /obj/machinery/computer/telecrystals/boss/Topic(href, href_list) if(..()) return if(href_list["scan"]) scanUplinkers() if(href_list["give1"]) var/obj/machinery/computer/telecrystals/uplinker/A = locate(href_list["give1"]) A.giveTC(1) if(href_list["give5"]) var/obj/machinery/computer/telecrystals/uplinker/A = locate(href_list["give5"]) A.giveTC(5) if(href_list["distrib"]) var/sanity = 0 while(storedcrystals && sanity < 100) for(var/obj/machinery/computer/telecrystals/uplinker/A in TCstations) A.giveTC(1,0) sanity++ logTransfer("[src] evenly distributed telecrystals.") src.updateUsrDialog() return #undef NUKESCALINGMODIFIER