ORM points are now claimed by swiping IDs rather than inserting it (#24878)

* Swipe instead of insert ID to claim points

* Build and update tgui

* Fix ORM trying to smelt ID

* Update UIs when points are claimed

* Add fingerprints on claim

* ???? TGUI why

---------

Co-authored-by: Arthri <41360489+a@users.noreply.github.com>
Co-authored-by: /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
Arthri
2024-04-18 21:02:57 +08:00
committed by GitHub
parent 70796cac43
commit 950ce9f791
3 changed files with 15 additions and 98 deletions
+14 -56
View File
@@ -38,8 +38,6 @@
"Virology" = list(MAT_PLASMA, MAT_URANIUM, MAT_GOLD)
)
// Variables
/// The currently inserted ID.
var/obj/item/card/id/inserted_id = null
/// The number of unclaimed points.
var/points = 0
/// Sheet multiplier applied when smelting ore. Updated by [/obj/machinery/proc/RefreshParts].
@@ -126,7 +124,6 @@
/obj/machinery/mineral/ore_redemption/Destroy()
// Move any stuff inside us out
var/turf/T = get_turf(src)
inserted_id?.forceMove(T)
inserted_disk?.forceMove(T)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
materials.retrieve_all()
@@ -151,10 +148,6 @@
if(!..())
return
update_icon(UPDATE_ICON_STATE)
if(inserted_id && !(stat & NOPOWER))
visible_message("<span class='notice'>The ID slot indicator light flickers on [src] as it spits out a card before powering down.</span>")
inserted_id.forceMove(get_turf(src))
inserted_id = null
/obj/machinery/mineral/ore_redemption/update_icon_state()
if(has_power())
@@ -194,7 +187,19 @@
return ..()
if(istype(I, /obj/item/card/id))
try_insert_id(user)
var/obj/item/card/id/ID = I
if(!points)
to_chat(usr, "<span class='warning'>There are no points to claim.</span>");
return
if(anyone_claim || (req_access_claim in ID.access))
ID.mining_points += points
ID.total_mining_points += points
to_chat(usr, "<span class='notice'><b>[points] Mining Points</b> claimed. You have earned a total of <b>[ID.total_mining_points] Mining Points</b> this Shift!</span>")
points = 0
SStgui.update_uis(src)
else
to_chat(usr, "<span class='warning'>Required access not found.</span>")
add_fingerprint(usr)
return
else if(istype(I, /obj/item/disk/design_disk))
@@ -258,7 +263,6 @@
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, "total_points" = inserted_id.total_mining_points) : null
data["points"] = points
data["disk"] = inserted_disk ? list(
"name" = inserted_disk.name,
@@ -301,18 +305,8 @@
. = TRUE
switch(action)
if("claim")
if(!inserted_id || !points)
return
if(anyone_claim || (req_access_claim in inserted_id.access))
inserted_id.mining_points += points
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>")
if("sheet", "alloy")
if(!(check_access(inserted_id) || allowed(usr)))
if(!allowed(usr))
to_chat(usr, "<span class='warning'>Required access not found.</span>")
return FALSE
var/id = params["id"]
@@ -345,18 +339,6 @@
unload_mineral(A)
else
unload_mineral(result)
if("insert_id")
try_insert_id(usr)
if("eject_id")
if(!inserted_id)
return FALSE
if(ishuman(usr))
usr.put_in_hands(inserted_id)
usr.visible_message("<span class='notice'>[usr] retrieves [inserted_id] from [src].</span>", \
"<span class='notice'>You retrieve [inserted_id] from [src].</span>")
else
inserted_id.forceMove(get_turf(src))
inserted_id = null
if("eject_disk")
if(!inserted_disk)
return FALSE
@@ -488,30 +470,6 @@
if(!supply_consoles[C.department] || length(supply_consoles[C.department] - mats_in_stock))
C.createMessage("Ore Redemption Machine", "New Minerals Available!", msg, RQ_NORMALPRIORITY)
/**
* Tries to insert the ID card held by the given user into the machine.
*
* Arguments:
* * user - The ID whose active hand to check for an ID card to insert.
*/
/obj/machinery/mineral/ore_redemption/proc/try_insert_id(mob/user)
. = FALSE
var/obj/item/card/id/I = user.get_active_hand()
if(!istype(I))
return
if(inserted_id)
to_chat(user, "<span class='warning'>There is already an ID inside!</span>")
return
if(!user.drop_item())
return
I.forceMove(src)
inserted_id = I
SStgui.update_uis(src)
interact(user)
user.visible_message("<span class='notice'>[user] inserts [I] into [src].</span>", \
"<span class='notice'>You insert [I] into [src].</span>")
return TRUE
/obj/machinery/mineral/ore_redemption/proc/try_refill_storage(mob/living/silicon/robot/robot)
. = FALSE
if(!istype(robot))