Total Mining Points on ID/Ore Redemption Machine (#22143)

* it begins

* Revert "it begins"

This reverts commit 02f90f4ce9.

* oopsies, restart

* here we go again

* oopsie again

* god i finally figured out TGUI

* henri review

* tgui update

* Update tgui.bundle.js

* tgui

* Update tgui.bundle.js
This commit is contained in:
matttheficus
2023-09-10 19:07:30 -05:00
committed by GitHub
parent a2922ad5fd
commit 072a958398
4 changed files with 18 additions and 7 deletions
+7 -2
View File
@@ -109,7 +109,10 @@
desc = "A card used to provide ID and determine access across the station."
icon_state = "id"
item_state = "card-id"
var/mining_points = 0 //For redeeming at mining equipment lockers
/// For redeeming at mining equipment lockers
var/mining_points = 0
/// Total mining points for the Shift.
var/total_mining_points = 0
var/list/access = list()
var/registered_name = "Unknown" // The name registered_name on the card
slot_flags = SLOT_ID
@@ -174,7 +177,7 @@
user.visible_message("[user] shows you: [bicon(src)] [src.name]. The assignment on the card: [src.assignment]",\
"You flash your ID card: [bicon(src)] [src.name]. The assignment on the card: [src.assignment]")
if(mining_points)
to_chat(user, "There's [mining_points] mining equipment redemption points loaded onto this card.")
to_chat(user, "There's <b>[mining_points] Mining Points</b> loaded onto this card. This card has earned <b>[total_mining_points] Mining Points</b> this Shift!")
src.add_fingerprint(user)
return
@@ -330,6 +333,7 @@
data["account"] = associated_account_number
data["owner"] = registered_name
data["mining"] = mining_points
data["total_mining"] = total_mining_points
return data
/obj/item/card/id/deserialize(list/data)
@@ -343,6 +347,7 @@
associated_account_number = data["account"]
registered_name = data["owner"]
mining_points = data["mining"]
total_mining_points = data["total_mining"]
// We'd need to use icon serialization(b64) to save the photo, and I don't feel like i
UpdateName()
RebuildHTML()
+3 -2
View File
@@ -252,7 +252,7 @@
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
// General info
data["id"] = inserted_id ? list("name" = "[inserted_id.registered_name] ([inserted_id.assignment])", "points" = inserted_id.mining_points) : null
data["id"] = inserted_id ? list("name" = "[inserted_id.registered_name] ([inserted_id.assignment])", "points" = inserted_id.mining_points, "total_points" = inserted_id.total_mining_points) : null
data["points"] = points
data["disk"] = inserted_disk ? list(
"name" = inserted_disk.name,
@@ -300,7 +300,8 @@
return
if(anyone_claim || (req_access_claim in inserted_id.access))
inserted_id.mining_points += points
to_chat(usr, "<span class='notice'>[points] points claimed.</span>")
inserted_id.total_mining_points += points
to_chat(usr, "<span class='notice'><b>[points] Mining Points</b> claimed. You have earned a total of <b>[inserted_id.total_mining_points] Mining Points</b> this Shift!</span>")
points = 0
else
to_chat(usr, "<span class='warning'>Required access not found.</span>")
@@ -68,12 +68,17 @@ const IdDisk = (properties, context) => {
)}
</LabeledList.Item>
{id && (
<LabeledList.Item label="Collected points">
<LabeledList.Item label="Current Mining Points">
<Box bold>{formatPoints(id.points)}</Box>
</LabeledList.Item>
)}
{id && (
<LabeledList.Item label="Total Mining Points">
<Box bold>{formatPoints(id.total_points)}</Box>
</LabeledList.Item>
)}
<LabeledList.Item
label="Unclaimed points"
label="Unclaimed Points"
color={points > 0 ? 'good' : 'grey'}
bold={points > 0 && 'good'}
>
File diff suppressed because one or more lines are too long