Skip to content

Commit

Permalink
Total Mining Points on ID/Ore Redemption Machine (#22143)
Browse files Browse the repository at this point in the history
* it begins

* Revert "it begins"

This reverts commit 02f90f4.

* 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
  • Loading branch information
matttheficus authored Sep 11, 2023
1 parent a2922ad commit 072a958
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions code/game/objects/items/weapons/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions code/modules/mining/machine_redemption.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>")
Expand Down
9 changes: 7 additions & 2 deletions tgui/packages/tgui/interfaces/OreRedemption.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
>
Expand Down
Loading

0 comments on commit 072a958

Please sign in to comment.