mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
No ID insertion for everything except the hop console (fixes the ORM) (#45693)
About The Pull Request machines and consoles that previously required an inserted ID now check access on worn and inhand ids. They otherwise function identically. Affected things: ORM: click claim to claim cash to connected ID (also fixes it) Mining vendor: uses ID on person or in hand. medical console: checks worn ID security records console: checks worn ID gulag consoles: claim points to worn ID, checks access and point requirements from worn ID Also some backend refactoring to prisoner management and gulag teleporter consoles hop console will be next to strip out the shitcode entirely but this at least gets things functional in the mean time, but fully tested this time. It's very late here and I need to sleep. Due to the nature of it it's more elaborate of a rework. Changelog cl tweak: Medical and Security consoles now check access on worn or inhand ID instead of requiring an inserted ID tweak: mining vendor now reads from ID in hand or on person instead of requiring an inserted ID fix: ORM is functional again (for real this time) tweak: ORM claim points button transfers points to worn/inhand ID instead of to an inserted ID, no longer accepts insertions tweak: Same for gulag consoles /cl
This commit is contained in:
@@ -32,12 +32,6 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
/proc/cmp_sheet_list(list/a, list/b)
|
||||
return a["value"] - b["value"]
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/card/id))
|
||||
id_insert_prisoner(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
@@ -50,14 +44,20 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(inserted_prisoner_id)
|
||||
data["id"] = inserted_prisoner_id
|
||||
data["id_name"] = inserted_prisoner_id.registered_name
|
||||
data["points"] = inserted_prisoner_id.points
|
||||
data["goal"] = inserted_prisoner_id.goal
|
||||
if(check_auth())
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
data["id_points"] = P.points
|
||||
if(P.points >= P.goal)
|
||||
can_go_home = TRUE
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
|
||||
@@ -70,16 +70,16 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("handle_id")
|
||||
if(inserted_prisoner_id)
|
||||
if(!usr.get_active_held_item())
|
||||
id_eject_prisoner(usr)
|
||||
else
|
||||
id_insert_prisoner(usr)
|
||||
if("claim_points")
|
||||
inserted_prisoner_id.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "Points transferred.")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
if(!alone_in_area(get_area(src), usr))
|
||||
to_chat(usr, "<span class='warning'>Prisoners are only allowed to be released while alone.</span>")
|
||||
@@ -94,14 +94,9 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "[inserted_prisoner_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/check_auth()
|
||||
if(obj_flags & EMAGGED)
|
||||
return 1 //Shuttle is emagged, let any ol' person through
|
||||
return (istype(inserted_prisoner_id) && inserted_prisoner_id.points >= inserted_prisoner_id.goal) //Otherwise, only let them out if the prisoner's reached his quota.
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if(stacking_machine)
|
||||
|
||||
@@ -74,11 +74,8 @@
|
||||
else
|
||||
var/mats = O.materials & mat_container.materials
|
||||
var/amount = O.amount
|
||||
var/id = inserted_scan_id && inserted_scan_id.registered_name
|
||||
if (id)
|
||||
id = " (ID: [id])"
|
||||
mat_container.insert_item(O, sheet_per_ore) //insert it
|
||||
materials.silo_log(src, "smelted", amount, "ores[id]", mats)
|
||||
materials.silo_log(src, "smelted", amount, "someone", mats)
|
||||
qdel(O)
|
||||
|
||||
/obj/machinery/mineral/ore_redemption/proc/can_smelt_alloy(datum/design/D)
|
||||
@@ -176,13 +173,6 @@
|
||||
|
||||
if(!powered())
|
||||
return ..()
|
||||
if(istype(W, /obj/item/card/id))
|
||||
var/obj/item/card/id/I = user.get_active_held_item()
|
||||
if(istype(I))
|
||||
id_insert_prisoner(user)
|
||||
interact(user)
|
||||
return
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/disk/design_disk))
|
||||
if(user.transferItemToLoc(W, src))
|
||||
@@ -213,10 +203,6 @@
|
||||
/obj/machinery/mineral/ore_redemption/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["unclaimedPoints"] = points
|
||||
if(inserted_scan_id)
|
||||
data["hasID"] = TRUE
|
||||
if (inserted_scan_id.registered_account)
|
||||
data["hasAccount"] = TRUE
|
||||
|
||||
data["materials"] = list()
|
||||
var/datum/component/material_container/mat_container = materials.mat_container
|
||||
@@ -256,28 +242,23 @@
|
||||
return
|
||||
var/datum/component/material_container/mat_container = materials.mat_container
|
||||
switch(action)
|
||||
if("Eject")
|
||||
if(!inserted_scan_id)
|
||||
return
|
||||
id_eject_prisoner(usr)
|
||||
return TRUE
|
||||
if("Insert")
|
||||
var/obj/item/card/id/I = usr.get_active_held_item()
|
||||
if(istype(I))
|
||||
id_insert_prisoner(usr)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Not a valid ID!</span>")
|
||||
return TRUE
|
||||
if("Claim")
|
||||
if(inserted_scan_id && inserted_scan_id.registered_account.adjust_money(points))
|
||||
points = 0
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(points)
|
||||
if(I && I.registered_account.adjust_money(points))
|
||||
points = 0
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>No ID detected.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>No points to claim.</span>")
|
||||
return TRUE
|
||||
if("Release")
|
||||
if(!mat_container)
|
||||
return
|
||||
if(materials.on_hold())
|
||||
to_chat(usr, "<span class='warning'>Mineral access is on hold, please contact the quartermaster.</span>")
|
||||
else if(!check_access(inserted_scan_id) && !allowed(usr)) //Check the ID inside, otherwise check the user
|
||||
else if(!allowed(usr)) //Check the ID inside, otherwise check the user
|
||||
to_chat(usr, "<span class='warning'>Required access not found.</span>")
|
||||
else
|
||||
var/datum/material/mat = locate(params["id"])
|
||||
|
||||
@@ -63,11 +63,6 @@
|
||||
var/equipment_path = null
|
||||
var/cost = 0
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/examine(mob/user)
|
||||
. = ..()
|
||||
if(inserted_id)
|
||||
. += "<span class='notice'>Alt-click to eject the ID card.</span>"
|
||||
|
||||
/datum/data/mining_equipment/New(name, path, cost)
|
||||
src.equipment_name = name
|
||||
src.equipment_path = path
|
||||
@@ -86,15 +81,7 @@
|
||||
/obj/machinery/mineral/equipment_vendor/ui_interact(mob/user)
|
||||
. = ..()
|
||||
var/list/dat = list()
|
||||
dat +="<div class='statusDisplay'>"
|
||||
if(istype(inserted_id))
|
||||
if (inserted_id.registered_account)
|
||||
dat += "You have [inserted_id.registered_account.account_balance] credits. <a href='?src=[REF(src)];choice=eject'>Eject ID.</a><br>"
|
||||
else
|
||||
dat += "No account registered with this ID. <a href='?src=[REF(src)];choice=eject'>Eject ID.</a><br>"
|
||||
else
|
||||
dat += "No ID inserted. <A href='?src=[REF(src)];choice=insert'>Insert ID.</A><br>"
|
||||
dat += "</div><br><b>Equipment point cost list:</b><BR><table border='0' width='300'>"
|
||||
dat += "<br><b>Equipment point cost list:</b><BR><table border='0' width='300'>"
|
||||
for(var/datum/data/mining_equipment/prize in prize_list)
|
||||
dat += "<tr><td>[prize.equipment_name]</td><td>[prize.cost]</td><td><A href='?src=[REF(src)];purchase=[REF(prize)]'>Purchase</A></td></tr>"
|
||||
dat += "</table>"
|
||||
@@ -107,37 +94,19 @@
|
||||
/obj/machinery/mineral/equipment_vendor/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(href_list["choice"])
|
||||
if(istype(inserted_id))
|
||||
if(href_list["choice"] == "eject")
|
||||
inserted_id.forceMove(loc)
|
||||
inserted_id.verb_pickup()
|
||||
inserted_id = null
|
||||
usr.visible_message("<span class='notice'>[usr] gets an ID card from the console.</span>", \
|
||||
"<span class='notice'>You get the ID card from the console.</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
|
||||
else if(href_list["choice"] == "insert")
|
||||
var/obj/item/card/id/I = usr.get_active_held_item()
|
||||
if(istype(I))
|
||||
if(!usr.transferItemToLoc(I, src))
|
||||
return
|
||||
inserted_id = I
|
||||
usr.visible_message("<span class='notice'>[usr] inserts an ID card into the console.</span>", \
|
||||
"<span class='notice'>You insert the ID card into the console.</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Error: No valid ID!</span>")
|
||||
flick(icon_deny, src)
|
||||
if(href_list["purchase"])
|
||||
if(istype(inserted_id) && inserted_id.registered_account)
|
||||
var/datum/bank_account/account = inserted_id.registered_account
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I) && I.registered_account)
|
||||
var/datum/bank_account/account = I.registered_account
|
||||
var/datum/data/mining_equipment/prize = locate(href_list["purchase"]) in prize_list
|
||||
to_chat(world, "credits on detected ID:")
|
||||
if (!prize || !(prize in prize_list))
|
||||
to_chat(usr, "<span class='warning'>Error: Invalid choice!</span>")
|
||||
flick(icon_deny, src)
|
||||
return
|
||||
if(prize.cost > account.account_balance)
|
||||
to_chat(usr, "<span class='warning'>Error: Insufficient points for [prize.equipment_name]!</span>")
|
||||
to_chat(usr, "<span class='warning'>Error: Insufficient credits for [prize.equipment_name] on [I]!</span>")
|
||||
flick(icon_deny, src)
|
||||
else
|
||||
if (account.adjust_money(-prize.cost))
|
||||
@@ -148,7 +117,7 @@
|
||||
to_chat(usr, "<span class='warning'>Error: Transaction failure, please try again later!</span>")
|
||||
flick(icon_deny, src)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Error: Please insert a valid ID!</span>")
|
||||
to_chat(usr, "<span class='warning'>Error: An ID with a registered account is required!</span>")
|
||||
flick(icon_deny, src)
|
||||
updateUsrDialog()
|
||||
return
|
||||
@@ -157,20 +126,6 @@
|
||||
if(istype(I, /obj/item/mining_voucher))
|
||||
RedeemVoucher(I, user)
|
||||
return
|
||||
if(istype(I, /obj/item/card/id))
|
||||
var/obj/item/card/id/C = user.get_active_held_item()
|
||||
if(istype(C))
|
||||
if(!inserted_id)
|
||||
if(!user.transferItemToLoc(C, src))
|
||||
return
|
||||
inserted_id = C
|
||||
user.visible_message("<span class='notice'>[user] inserts an ID card into the console.</span>", \
|
||||
"<span class='notice'>You insert the ID card into the console.</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
|
||||
interact(user)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There's already an ID card in the console!</span>")
|
||||
return
|
||||
if(default_deconstruction_screwdriver(user, "mining-open", "mining", I))
|
||||
updateUsrDialog()
|
||||
return
|
||||
@@ -214,22 +169,6 @@
|
||||
if(prob(50 / severity) && severity < 3)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/AltClick(mob/user)
|
||||
if(!user.canUseTopic(src, issilicon(user)))
|
||||
return
|
||||
if(!inserted_id)
|
||||
to_chat(user, "<span class='warning'>There's no ID card in the console!</span>")
|
||||
if(inserted_id)
|
||||
inserted_id.forceMove(drop_location())
|
||||
if(!issilicon(user) && Adjacent(user))
|
||||
user.put_in_hands(inserted_id)
|
||||
inserted_id = null
|
||||
user.visible_message("<span class='notice'>[user] gets an ID card from the console.</span>", \
|
||||
"<span class='notice'>You get the ID card from the console.</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
|
||||
updateUsrDialog()
|
||||
|
||||
|
||||
/****************Golem Point Vendor**************************/
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/golem
|
||||
|
||||
Reference in New Issue
Block a user