From 4140cffc984a4a5a927b338a632e95ccdd4febf4 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 4 May 2017 18:08:14 -0500 Subject: [PATCH] Nuke op TC consoles can donate all TCs at once, and other small changes. --- .../machinery/computer/telecrystalconsoles.dm | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/code/game/machinery/computer/telecrystalconsoles.dm b/code/game/machinery/computer/telecrystalconsoles.dm index 4bb872b347..fd026e4686 100644 --- a/code/game/machinery/computer/telecrystalconsoles.dm +++ b/code/game/machinery/computer/telecrystalconsoles.dm @@ -58,7 +58,12 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E /obj/machinery/computer/telecrystals/uplinker/proc/donateTC(amt, addLog = 1) if(uplinkholder && linkedboss) - if(amt <= uplinkholder.hidden_uplink.telecrystals) + if(amt < 0) + linkedboss.storedcrystals += uplinkholder.hidden_uplink.telecrystals + if(addLog) + linkedboss.logTransfer("[src] donated [uplinkholder.hidden_uplink.telecrystals] telecrystals to [linkedboss].") + uplinkholder.hidden_uplink.telecrystals = 0 + else if(amt <= uplinkholder.hidden_uplink.telecrystals) uplinkholder.hidden_uplink.telecrystals -= amt linkedboss.storedcrystals += amt if(addLog) @@ -66,7 +71,12 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E /obj/machinery/computer/telecrystals/uplinker/proc/giveTC(amt, addLog = 1) if(uplinkholder && linkedboss) - if(amt <= linkedboss.storedcrystals) + if(amt < 0) + uplinkholder.hidden_uplink.telecrystals += linkedboss.storedcrystals + if(addLog) + linkedboss.logTransfer("[src] received [linkedboss.storedcrystals] telecrystals from [linkedboss].") + linkedboss.storedcrystals = 0 + else if(amt <= linkedboss.storedcrystals) uplinkholder.hidden_uplink.telecrystals += amt linkedboss.storedcrystals -= amt if(addLog) @@ -89,7 +99,7 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E if(uplinkholder) dat += "[uplinkholder.hidden_uplink.telecrystals] telecrystals remain in this uplink.
" if(linkedboss) - dat += "Donate TC: 1 | 5" + dat += "Donate TC: 1 | 5 | All" dat += "
Eject Uplink" @@ -103,11 +113,9 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E if(..()) return - if(href_list["donate1"]) - donateTC(1) - - if(href_list["donate5"]) - donateTC(5) + if(href_list["donate"]) + var/tcamt = text2num(href_list["donate"]) + donateTC(tcamt) if(href_list["eject"]) ejectuplink() @@ -162,7 +170,7 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E var/dat = "" dat += "Scan for TC stations.
" - dat += "This [src] has [storedcrystals] telecrystals available for distribution.
" + dat += "[storedcrystals] telecrystals are available for distribution.
" dat += "

" @@ -171,10 +179,10 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E if(A.uplinkholder) dat += "[A.uplinkholder.hidden_uplink.telecrystals] telecrystals." if(storedcrystals) - dat+= "
Add TC: 1 | 5" + dat+= "
Add TC: 1 | 5 | 10 | All" dat += "
" - if(TCstations.len) + if(TCstations.len && storedcrystals) dat += "

Evenly distribute remaining TC.

" @@ -195,13 +203,11 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E 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["give"]) + var/tcamt = text2num(href_list["give"]) + if(TCstations.len) // sanity + var/obj/machinery/computer/telecrystals/uplinker/A = locate(href_list["target"]) in TCstations + A.giveTC(tcamt) if(href_list["distrib"]) var/sanity = 0