Skip to content

Commit

Permalink
Refactor uplink: Shows effective TC use, better logic for illegal tec…
Browse files Browse the repository at this point in the history
…h flag to items, etc (#10147)

* uplink refactor

* better tooltip

* tooltip

* random space

* More make it sure

* Fixes the wrong close

* words

* Update tgui/packages/tgui/interfaces/Uplink.js

Co-authored-by: Miliviu <[email protected]>

---------

Co-authored-by: Miliviu <[email protected]>
  • Loading branch information
EvilDragonfiend and Miliviu authored Mar 28, 2024
1 parent 2d08ce5 commit 0bbf53f
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 75 deletions.
2 changes: 2 additions & 0 deletions code/datums/components/uplink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@
"name" = I.name,
"cost" = I.cost,
"desc" = I.desc,
"is_illegal" = I.illegal_tech,
"are_contents_illegal" = I.contents_are_illegal_tech
))
data["categories"] += list(cat)
return data
Expand Down
13 changes: 7 additions & 6 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1636,15 +1636,16 @@
/**
* Log for buying items from the uplink
*
* 1 argument is for the user that bought the item
* 2 argument is for the item that was purchased
* 3 argument is for the uplink type (traitor/contractor)
* [buyer]: is for the user that bought the item
* [object]: is for the item that was purchased
* [type]: is for the uplink type (traitor/contractor)
* [is_bonus]: is given TRUE when an item is given for free
*/
/proc/log_uplink_purchase(mob/buyer, atom/object, type = "\improper uplink")
var/message = "has bought [object] from \a [type]"
/proc/log_uplink_purchase(mob/buyer, atom/object, type = "\improper uplink", is_bonus = FALSE)
var/message = "has [!is_bonus ? "bought" : "received a bonus item"] [object] from \a [type]"
buyer.log_message(message, LOG_GAME)
if(isnull(locate(/datum/antagonist) in buyer.mind?.antag_datums))
message_admins("[ADMIN_LOOKUPFLW(buyer)] has bought [object] from \a [type] as a non-antagonist.")
message_admins("[ADMIN_LOOKUPFLW(buyer)] has [!is_bonus ? "bought" : "received a bonus item"] [object] from \a [type] as a non-antagonist.")

/atom/proc/add_filter(name,priority,list/params)
LAZYINITLIST(filter_data)
Expand Down
5 changes: 4 additions & 1 deletion code/modules/antagonists/incursion/incursion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@

var/purchases = ""
var/TC_uses = 0
var/effective_tc = 0
LAZYINITLIST(GLOB.uplink_purchase_logs_by_key)
for(var/I in members)
var/datum/mind/syndicate = I
var/datum/uplink_purchase_log/H = GLOB.uplink_purchase_logs_by_key[syndicate.key]
if(H)
TC_uses += H.total_spent
effective_tc += H.effective_amount
purchases += H.generate_render(show_key = FALSE)
parts += "(Syndicates used [TC_uses] TC) [purchases]"
var/effective_message = TC_uses < effective_tc ? " / effectively worth [effective_tc] TC" : ""
parts += "(Syndicates used [TC_uses] TC[effective_message]) [purchases]"

if(win)
parts += "<span class='greentext'>The Syndicate were successful with their operation!</span>"
Expand Down
5 changes: 4 additions & 1 deletion code/modules/antagonists/nukeop/nukeop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,19 @@
var/text = "<br><span class='header'>The syndicate operatives were:</span>"
var/purchases = ""
var/TC_uses = 0
var/effective_tc = 0
LAZYINITLIST(GLOB.uplink_purchase_logs_by_key)
for(var/I in members)
var/datum/mind/syndicate = I
var/datum/uplink_purchase_log/H = GLOB.uplink_purchase_logs_by_key[syndicate.key]
if(H)
TC_uses += H.total_spent
effective_tc += H.effective_amount
purchases += H.generate_render(show_key = FALSE)
text += printplayerlist(members)
text += "<br>"
text += "(Syndicates used [TC_uses] TC) [purchases]"
var/effective_message = TC_uses < effective_tc ? " / effectively worth [effective_tc] TC" : ""
text += "(Syndicates used [TC_uses] TC[effective_message]) [purchases]"
if(TC_uses == 0 && SSticker.mode.station_was_nuked && !operatives_dead())
text += "<BIG>[icon2html('icons/badass.dmi', world, "badass")]</BIG>"

Expand Down
5 changes: 4 additions & 1 deletion code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@
result += printplayer(owner)

var/TC_uses = 0
var/effective_tc = 0
var/uplink_true = FALSE
var/purchases = ""
LAZYINITLIST(GLOB.uplink_purchase_logs_by_key)
var/datum/uplink_purchase_log/H = GLOB.uplink_purchase_logs_by_key[owner.key]
if(H)
TC_uses = H.total_spent
effective_tc = H.effective_amount
uplink_true = TRUE
purchases += H.generate_render(FALSE)

Expand All @@ -225,7 +227,8 @@
count++

if(uplink_true)
var/uplink_text = "(used [TC_uses] TC) [purchases]"
var/effective_message = TC_uses < effective_tc ? " / effectively worth [effective_tc] TC" : ""
var/uplink_text = "(used [TC_uses] TC[effective_message]) [purchases]"
if(TC_uses==0 && traitorwin)
var/static/icon/badass = icon('icons/badass.dmi', "badass")
uplink_text += "<BIG>[icon2html(badass, world)]</BIG>"
Expand Down
Loading

0 comments on commit 0bbf53f

Please sign in to comment.