Adds a signal to buying items from the uplink (& fixes TC misinfo) (#81372)

## About The Pull Request

Adds a signal when someone buys an item from the uplink and removes
single-letter vars from the ``spawn_item`` proc, and adds/standardizes
add/removing of telecrystals from uplinks (and admin setting how much TC
they have) to ensure the UI always has the right amount of telecrystals
displayed in it.

## Why It's Good For The Game

There are reasons why someone would want to hook up to a traitor's
uplink and listen to items they purchase to do any special effect
on-purchase, so this adds support to do anything in the future with it.
Also tells players how much TC they actually have without forcing them
to close/reopen the UI every time they insert some TC in it by hand.

## Changelog

🆑
fix: Uplinks now update their UI when you add telecrystals in them, so
you don't need to close and reopen it.
/🆑
This commit is contained in:
John Willard
2024-02-10 18:57:19 +01:00
committed by GitHub
parent d850977c7c
commit fdcd4d3979
13 changed files with 60 additions and 39 deletions
+1 -10
View File
@@ -113,15 +113,6 @@
new /obj/effect/decal/cleanable/ash(get_turf(uplink_item))
qdel(uplink_item)
/// Adds telecrystals to the uplink. It is bad practice to use this outside of the component itself.
/datum/component/uplink/proc/add_telecrystals(telecrystals_added)
set_telecrystals(uplink_handler.telecrystals + telecrystals_added)
/// Sets the telecrystals of the uplink. It is bad practice to use this outside of the component itself.
/datum/component/uplink/proc/set_telecrystals(new_telecrystal_amount)
uplink_handler.telecrystals = new_telecrystal_amount
uplink_handler.on_update()
/datum/component/uplink/InheritComponent(datum/component/uplink/uplink)
lockable |= uplink.lockable
active |= uplink.active
@@ -135,7 +126,7 @@
if(!silent)
to_chat(user, span_notice("You slot [telecrystals] into [parent] and charge its internal uplink."))
var/amt = telecrystals.amount
uplink_handler.telecrystals += amt
uplink_handler.add_telecrystals(amt)
telecrystals.use(amt)
log_uplink("[key_name(user)] loaded [amt] telecrystals into [parent]'s uplink")