mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
Console alt-clicking tweaks (#45193)
* * reworked consoles so you can: * use attackby to insert id * use alt-click to eject id * examine to see if alt-click is available * moved eject_id and insert_id procs to _computer.dm * added some sound effects * * prisoner management console new features: insert id with attackby and eject with altclick * * prisoner management console can't have multiple prisoner id's inserted * removed unnecessary src. and changed usr --> user * made gulag teleporter consistent with attackby, altclick and examine. simplified attackby on card.dm * equipment reclaimer station consistent with id attackby, altclick-eject and examine. point claim console consistent with id attackby, altclick-eject and examine. * ore redemption machine and mining equipment vendor made consistent with id attackby, altclick-eject and examine. * * reworked all eject/insert ID copypastacodes into procs in _machinery.dm * * 0's to FALSE * hopefully i didnt mess up any more things in the resolve * everything now uses id_insert-proc and doesn't work. * compiles but doesn't work * works
This commit is contained in:
@@ -10,12 +10,10 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
density = FALSE
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
var/obj/item/card/id/prisoner/inserted_id
|
||||
var/obj/machinery/door/airlock/release_door
|
||||
var/door_tag = "prisonshuttle"
|
||||
var/obj/item/radio/Radio //needed to send messages to sec radio
|
||||
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/Initialize()
|
||||
. = ..()
|
||||
Radio = new/obj/item/radio(src)
|
||||
@@ -35,16 +33,11 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
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/prisoner))
|
||||
if(!inserted_id)
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return
|
||||
inserted_id = I
|
||||
to_chat(user, "<span class='notice'>You insert [I].</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='notice'>There's an ID inserted already.</span>")
|
||||
return ..()
|
||||
if(istype(I, /obj/item/card/id))
|
||||
id_insert(user, I, inserted_prisoner_id)
|
||||
inserted_prisoner_id = I
|
||||
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)
|
||||
@@ -58,11 +51,11 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(inserted_id)
|
||||
data["id"] = inserted_id
|
||||
data["id_name"] = inserted_id.registered_name
|
||||
data["points"] = inserted_id.points
|
||||
data["goal"] = inserted_id.goal
|
||||
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())
|
||||
can_go_home = TRUE
|
||||
|
||||
@@ -79,21 +72,11 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
return
|
||||
switch(action)
|
||||
if("handle_id")
|
||||
if(inserted_id)
|
||||
if(!usr.get_active_held_item())
|
||||
usr.put_in_hands(inserted_id)
|
||||
inserted_id = null
|
||||
else
|
||||
inserted_id.forceMove(get_turf(src))
|
||||
inserted_id = null
|
||||
else
|
||||
var/obj/item/I = usr.get_active_held_item()
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
if(!usr.transferItemToLoc(I, src))
|
||||
return
|
||||
inserted_id = I
|
||||
if(inserted_prisoner_id)
|
||||
id_eject(usr, inserted_prisoner_id)
|
||||
inserted_prisoner_id = null
|
||||
if("claim_points")
|
||||
inserted_id.points += stacking_machine.points
|
||||
inserted_prisoner_id.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "Points transferred.")
|
||||
if("move_shuttle")
|
||||
@@ -110,13 +93,13 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval.", 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)
|
||||
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_id) && inserted_id.points >= inserted_id.goal) //Otherwise, only let them out if the prisoner's reached his quota.
|
||||
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))
|
||||
@@ -130,10 +113,8 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
|
||||
|
||||
/**********************Prisoner Collection Unit**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker
|
||||
force_connect = TRUE
|
||||
var/points = 0 //The unclaimed value of ore stacked.
|
||||
@@ -149,6 +130,7 @@ GLOBAL_LIST(labor_sheet_values)
|
||||
return ..()
|
||||
|
||||
/**********************Point Lookup Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker
|
||||
name = "points checking console"
|
||||
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
speed_process = TRUE
|
||||
circuit = /obj/item/circuitboard/machine/ore_redemption
|
||||
layer = BELOW_OBJ_LAYER
|
||||
var/obj/item/card/id/inserted_id
|
||||
var/points = 0
|
||||
var/ore_pickup_rate = 15
|
||||
var/sheet_per_ore = 1
|
||||
@@ -75,7 +74,7 @@
|
||||
else
|
||||
var/mats = O.materials & mat_container.materials
|
||||
var/amount = O.amount
|
||||
var/id = inserted_id && inserted_id.registered_name
|
||||
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
|
||||
@@ -179,11 +178,11 @@
|
||||
return ..()
|
||||
if(istype(W, /obj/item/card/id))
|
||||
var/obj/item/card/id/I = user.get_active_held_item()
|
||||
if(istype(I) && !istype(inserted_id))
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return
|
||||
inserted_id = I
|
||||
if(istype(I))
|
||||
id_insert(user, I, inserted_prisoner_id)
|
||||
inserted_prisoner_id = I
|
||||
interact(user)
|
||||
return
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/disk/design_disk))
|
||||
@@ -215,9 +214,9 @@
|
||||
/obj/machinery/mineral/ore_redemption/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["unclaimedPoints"] = points
|
||||
if(inserted_id)
|
||||
if(inserted_scan_id)
|
||||
data["hasID"] = TRUE
|
||||
if (inserted_id.registered_account)
|
||||
if (inserted_scan_id.registered_account)
|
||||
data["hasAccount"] = TRUE
|
||||
|
||||
data["materials"] = list()
|
||||
@@ -259,22 +258,21 @@
|
||||
var/datum/component/material_container/mat_container = materials.mat_container
|
||||
switch(action)
|
||||
if("Eject")
|
||||
if(!inserted_id)
|
||||
if(!inserted_scan_id)
|
||||
return
|
||||
usr.put_in_hands(inserted_id)
|
||||
inserted_id = null
|
||||
id_eject(usr, inserted_prisoner_id)
|
||||
inserted_prisoner_id = null
|
||||
return TRUE
|
||||
if("Insert")
|
||||
var/obj/item/card/id/I = usr.get_active_held_item()
|
||||
if(istype(I))
|
||||
if(!usr.transferItemToLoc(I,src))
|
||||
return
|
||||
inserted_id = I
|
||||
id_insert(usr, I, inserted_prisoner_id)
|
||||
inserted_prisoner_id = I
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Not a valid ID!</span>")
|
||||
return TRUE
|
||||
if("Claim")
|
||||
if(inserted_id && inserted_id.registered_account.adjust_money(points))
|
||||
if(inserted_scan_id && inserted_scan_id.registered_account.adjust_money(points))
|
||||
points = 0
|
||||
return TRUE
|
||||
if("Release")
|
||||
@@ -283,7 +281,7 @@
|
||||
|
||||
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_id) && !allowed(usr)) //Check the ID inside, otherwise check the user
|
||||
else if(!check_access(inserted_scan_id) && !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"])
|
||||
@@ -304,7 +302,7 @@
|
||||
desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num
|
||||
|
||||
var/sheets_to_remove = round(min(desired,50,stored_amount))
|
||||
|
||||
|
||||
var/count = mat_container.retrieve_sheets(sheets_to_remove, mat, get_step(src, output_dir))
|
||||
var/list/mats = list()
|
||||
mats[mat] = MINERAL_MATERIAL_AMOUNT
|
||||
@@ -338,7 +336,7 @@
|
||||
return
|
||||
var/alloy_id = params["id"]
|
||||
var/datum/design/alloy = stored_research.isDesignResearchedID(alloy_id)
|
||||
if((check_access(inserted_id) || allowed(usr)) && alloy)
|
||||
if((check_access(inserted_scan_id) || allowed(usr)) && alloy)
|
||||
var/smelt_amount = can_smelt_alloy(alloy)
|
||||
var/desired = 0
|
||||
if (params["sheets"])
|
||||
|
||||
@@ -63,6 +63,11 @@
|
||||
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
|
||||
@@ -105,17 +110,21 @@
|
||||
if(href_list["choice"])
|
||||
if(istype(inserted_id))
|
||||
if(href_list["choice"] == "eject")
|
||||
to_chat(usr, "<span class='notice'>You eject the ID from [src]'s card slot.</span>")
|
||||
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
|
||||
to_chat(usr, "<span class='notice'>You insert the ID into [src]'s card slot.</span>")
|
||||
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)
|
||||
@@ -149,13 +158,18 @@
|
||||
RedeemVoucher(I, user)
|
||||
return
|
||||
if(istype(I, /obj/item/card/id))
|
||||
var/obj/item/card/id/C = usr.get_active_held_item()
|
||||
if(istype(C) && !istype(inserted_id))
|
||||
if(!usr.transferItemToLoc(C, src))
|
||||
return
|
||||
inserted_id = C
|
||||
to_chat(usr, "<span class='notice'>You insert the ID into [src]'s card slot.</span>")
|
||||
interact(user)
|
||||
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()
|
||||
@@ -200,6 +214,21 @@
|
||||
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**************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user