From 444666499701006dc1c208042cfe94f1f6d46cd3 Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Fri, 31 May 2019 19:37:25 +0200 Subject: [PATCH 1/3] Update labor stacker --- .../game/objects/items/stacks/sheets/glass.dm | 4 + .../objects/items/stacks/sheets/mineral.dm | 9 + .../items/stacks/sheets/sheet_types.dm | 2 + .../objects/items/stacks/sheets/sheets.dm | 16 +- code/modules/mining/laborcamp/laborstacker.dm | 255 +++++++++--------- code/modules/telesci/bscrystal.dm | 1 + nano/templates/labor_claim_console.tmpl | 1 + 7 files changed, 145 insertions(+), 143 deletions(-) create mode 100644 nano/templates/labor_claim_console.tmpl diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index dfb756d8c25..def012e2663 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -32,6 +32,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \ created_window = /obj/structure/window/basic full_window = /obj/structure/window/full/basic merge_type = /obj/item/stack/sheet/glass + point_value = 1 /obj/item/stack/sheet/glass/fifty amount = 50 @@ -90,6 +91,7 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \ created_window = /obj/structure/window/reinforced full_window = /obj/structure/window/full/reinforced merge_type = /obj/item/stack/sheet/rglass + point_value = 4 /obj/item/stack/sheet/rglass/cyborg materials = list() @@ -113,6 +115,7 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( \ origin_tech = "plasmatech=2;materials=2" created_window = /obj/structure/window/plasmabasic full_window = /obj/structure/window/full/plasmabasic + point_value = 19 /obj/item/stack/sheet/plasmaglass/New(loc, amount) recipes = GLOB.pglass_recipes @@ -154,6 +157,7 @@ GLOBAL_LIST_INIT(prglass_recipes, list ( \ created_window = /obj/structure/window/plasmareinforced full_window = /obj/structure/window/full/plasmareinforced armor = list("melee" = 20, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0) + point_value = 23 /obj/item/stack/sheet/plasmarglass/New(loc, amount) recipes = GLOB.prglass_recipes diff --git a/code/game/objects/items/stacks/sheets/mineral.dm b/code/game/objects/items/stacks/sheets/mineral.dm index 72c0bef16ff..8c60bcefa11 100644 --- a/code/game/objects/items/stacks/sheets/mineral.dm +++ b/code/game/objects/items/stacks/sheets/mineral.dm @@ -144,6 +144,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( origin_tech = "materials=6" sheettype = "diamond" materials = list(MAT_DIAMOND=MINERAL_MATERIAL_AMOUNT) + point_value = 25 /obj/item/stack/sheet/mineral/diamond/New() ..() @@ -156,6 +157,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( origin_tech = "materials=5" sheettype = "uranium" materials = list(MAT_URANIUM=MINERAL_MATERIAL_AMOUNT) + point_value = 20 /obj/item/stack/sheet/mineral/uranium/New() ..() @@ -170,6 +172,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( materials = list(MAT_PLASMA=MINERAL_MATERIAL_AMOUNT) burn_state = FLAMMABLE burntime = 5 + point_value = 20 /obj/item/stack/sheet/mineral/plasma/New() ..() @@ -196,6 +199,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( origin_tech = "materials=4" sheettype = "gold" materials = list(MAT_GOLD=MINERAL_MATERIAL_AMOUNT) + point_value = 20 /obj/item/stack/sheet/mineral/gold/New() ..() @@ -208,6 +212,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( origin_tech = "materials=4" sheettype = "silver" materials = list(MAT_SILVER=MINERAL_MATERIAL_AMOUNT) + point_value = 20 /obj/item/stack/sheet/mineral/silver/New() ..() @@ -220,6 +225,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( origin_tech = "materials=4" sheettype = "bananium" materials = list(MAT_BANANIUM=MINERAL_MATERIAL_AMOUNT) + point_value = 50 /obj/item/stack/sheet/mineral/bananium/New(loc, amount=null) ..() @@ -233,6 +239,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( sheettype = "tranquillite" materials = list(MAT_TRANQUILLITE=MINERAL_MATERIAL_AMOUNT) wall_allowed = FALSE //no tranquilite walls in code + point_value = 50 /obj/item/stack/sheet/mineral/tranquillite/New(loc, amount=null) ..() @@ -253,6 +260,7 @@ var/global/list/datum/stack_recipe/snow_recipes = list( throw_range = 3 sheettype = "titanium" materials = list(MAT_TITANIUM=MINERAL_MATERIAL_AMOUNT) + point_value = 20 var/global/list/datum/stack_recipe/titanium_recipes = list ( new/datum/stack_recipe("titanium tile", /obj/item/stack/tile/mineral/titanium, 1, 4, 20), @@ -282,6 +290,7 @@ var/global/list/datum/stack_recipe/titanium_recipes = list ( throw_range = 3 sheettype = "plastitanium" materials = list(MAT_TITANIUM=2000, MAT_PLASMA=2000) + point_value = 45 var/global/list/datum/stack_recipe/plastitanium_recipes = list ( new/datum/stack_recipe("plas-titanium tile", /obj/item/stack/tile/mineral/plastitanium, 1, 4, 20), diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 2c1222154b0..27b091321e3 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -105,6 +105,7 @@ var/global/list/datum/stack_recipe/metal_recipes = list( flags = CONDUCT origin_tech = "materials=1" merge_type = /obj/item/stack/sheet/metal + point_value = 2 /obj/item/stack/sheet/metal/cyborg materials = list() @@ -151,6 +152,7 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list( flags = CONDUCT origin_tech = "materials=2" merge_type = /obj/item/stack/sheet/plasteel + point_value = 23 /obj/item/stack/sheet/plasteel/New(var/loc, var/amount=null) recipes = plasteel_recipes diff --git a/code/game/objects/items/stacks/sheets/sheets.dm b/code/game/objects/items/stacks/sheets/sheets.dm index 100704ed658..13774b0db4b 100644 --- a/code/game/objects/items/stacks/sheets/sheets.dm +++ b/code/game/objects/items/stacks/sheets/sheets.dm @@ -9,22 +9,10 @@ attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") var/perunit = MINERAL_MATERIAL_AMOUNT var/sheettype = null //this is used for girders in the creation of walls/false walls + var/point_value = 0 //turn-in value for the gulag stacker - loosely relative to its rarity. + var/created_window = null //apparently glass sheets don't share a base type for glass specifically, so each had to define these vars individually var/full_window = null //moving the var declaration to here so this can be checked cleaner until someone is willing to make them share a base type properly usesound = 'sound/items/deconstruct.ogg' toolspeed = 1 var/wall_allowed = TRUE //determines if sheet can be used in wall construction or not. - - -// Since the sheetsnatcher was consolidated into weapon/storage/bag we now use -// item/attackby() properly, making this unnecessary - -/*/obj/item/stack/sheet/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/storage/bag/sheetsnatcher)) - var/obj/item/storage/bag/sheetsnatcher/S = W - if(!S.mode) - S.add(src,user) - else - for(var/obj/item/stack/sheet/stack in locate(src.x,src.y,src.z)) - S.add(stack,user) - ..()*/ diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index d3e22e5bca2..ad2bfa5017b 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -1,3 +1,5 @@ +GLOBAL_LIST(labor_sheet_values) + /**********************Prisoners' Console**************************/ /obj/machinery/mineral/labor_claim_console @@ -5,153 +7,146 @@ desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners." icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "console" - density = 0 - anchored = 1 - var/obj/machinery/mineral/stacking_machine/laborstacker/machine = null + 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/use_release_door = 0 var/obj/item/radio/intercom/announcer - -/obj/machinery/mineral/labor_claim_console/New() - ..() +/obj/machinery/mineral/labor_claim_console/Initialize() + . = ..() announcer = new /obj/item/radio/intercom(null) announcer.config(list("Security" = 0)) + locate_stacking_machine() - spawn(7) - src.machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir)) - var/t - for(var/obj/machinery/door/airlock/d in range(5,src)) - t = d.id_tag - if(t == src.door_tag) - src.release_door = d - if(machine && (release_door || !use_release_door)) - machine.CONSOLE = src + if(!GLOB.labor_sheet_values) + var/sheet_list = list() + for(var/sheet_type in subtypesof(/obj/item/stack/sheet)) + var/obj/item/stack/sheet/sheet = sheet_type + if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes + continue + sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value))) + GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list) + +/obj/machinery/mineral/labor_claim_console/Destroy() + . = ..() + QDEL_NULL(announcer) + +/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/prisoner)) + if(!inserted_id) + if(!user.unEquip(I)) + return + inserted_id = I + to_chat(user, "You insert [I].") + return else - qdel(src) + to_chat(user, "There's an ID inserted already.") + return ..() + +/obj/machinery/mineral/labor_claim_console/attack_ghost(mob/user) + attack_hand(user) + +/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = default_state) + ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open) + if(!ui) + ui = new(user, src, ui_key, "labor_claim_console.tmpl", name, 450, 475, state) + ui.open() + +/obj/machinery/mineral/labor_claim_console/ui_data(mob/user) + var/list/data = list() + var/can_go_home = FALSE + + data["emagged"] = (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(check_auth()) + can_go_home = TRUE + + if(stacking_machine) + data["unclaimed_points"] = stacking_machine.points + + data["ores"] = GLOB.labor_sheet_values + data["can_go_home"] = can_go_home + + return data + +/obj/machinery/mineral/labor_claim_console/Topic (action, params) + if(..()) + return TRUE + + switch(action) + if("handle_id") + if(inserted_id) + if(!usr.put_in_hands(inserted_id)) + inserted_id.forceMove(get_turf(src)) + inserted_id = null + else + var/obj/item/I = usr.get_active_hand() + if(istype(I, /obj/item/card/id/prisoner)) + if(!usr.unEquip(I)) + return + inserted_id = I + if("claim_points") + inserted_id.points += stacking_machine.points + stacking_machine.points = 0 + to_chat(usr, "Points transferred.") + if("move_shuttle") + if(!alone_in_area(get_area(src), usr)) + to_chat(usr, "Prisoners are only allowed to be released while alone.") + else + switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE)) + if(1) + to_chat(usr, "Shuttle not found.") + if(2) + to_chat(usr, "Shuttle already at station.") + if(3) + to_chat(usr, "No permission to dock could be granted.") + else + if(!(emagged)) + var/message = "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval." + announcer.autosay(message, "Labor Camp Controller", "Security") + to_chat(usr, "Shuttle received message and will be sent shortly.") /obj/machinery/mineral/labor_claim_console/proc/check_auth() - if(emagged) return 1 //Shuttle is emagged, let any ol' person through + if(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. +/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) + stacking_machine.CONSOLE = src + else + qdel(src) -/obj/machinery/mineral/labor_claim_console/attack_hand(user as mob) - var/dat - dat += text("Point Claim Console

") - if(emagged) //Shit's broken - dat += text("QU&#t0A In%aL*D
") - else if(istype(inserted_id)) //There's an ID in there. - dat += text("ID: [inserted_id.registered_name] Eject ID.
") - dat += text("Points Collected:[inserted_id.points]
") - dat += text("Point Quota: [inserted_id.goal] - Reach your quota to earn your release
") - dat += text("Unclaimed Collection Points: [machine.points]. Claim points.
") - else //No ID in sight. Complain about it. - dat += text("No ID inserted. Insert ID.
") - if(check_auth()) - dat += text("Proceed to station.
") - if(use_release_door) - dat += text("Open release door.
") - if(machine) - dat += text("
Mineral Value List:
[machine.get_ore_values()]") - - - user << browse("[dat]", "window=console_stacking_machine") - - -/obj/machinery/mineral/labor_claim_console/attackby(obj/item/I as obj, mob/user as mob, params) - if(istype(I, /obj/item/card/id)) - return attack_hand(user) - ..() - -/obj/machinery/mineral/labor_claim_console/emag_act(user as mob) - emag(user) - -/obj/machinery/mineral/labor_claim_console/proc/emag(mob/user as mob) - if(!emagged) - emagged = 1 +/obj/machinery/mineral/labor_claim_console/emag_act(mob/user) + if(!(emagged)) + emagged = TRUE to_chat(user, "PZZTTPFFFT") - -/obj/machinery/mineral/labor_claim_console/Topic(href, href_list) - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["choice"]) - if(istype(inserted_id)) //Sanity check against href spoofs - if(href_list["choice"] == "eject") - inserted_id.loc = loc - inserted_id.verb_pickup() - inserted_id = null - if(href_list["choice"] == "claim") - inserted_id.points += machine.points - machine.points = 0 - to_chat(src, "Points transferred.") - else if(href_list["choice"] == "insert") - var/obj/item/card/id/prisoner/I = usr.get_active_hand() - if(istype(I)) - usr.drop_item() - I.loc = src - inserted_id = I - else - to_chat(usr, "Invalid ID.") - if(check_auth()) //Sanity check against hef spoofs - if(href_list["choice"] == "station") - if(!alone_in_area(get_area(src), usr)) - to_chat(usr, "Prisoners are only allowed to be released while alone.") - else - switch(SSshuttle.moveShuttle("laborcamp","laborcamp_home")) - if(1) - to_chat(usr, "Shuttle not found") - if(2) - to_chat(usr, "Shuttle already at station") - if(3) - to_chat(usr, "No permission to dock could be granted.") - else - var/message = "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval." - announcer.autosay(message, "Labor Camp Controller", "Security") - to_chat(usr, "Shuttle received message and will be sent shortly.") - - if(href_list["choice"] == "release") - if(alone_in_area(get_area(loc), usr)) - var/obj/docking_port/stationary/S = SSshuttle.getDock("laborcamp_home") - if(S && S.get_docked()) - if(release_door && release_door.density) - release_door.open() - else - to_chat(usr, "Prisoners can only be released while docked with the station.") - else - to_chat(usr, "Prisoners are only allowed to be released while alone.") - - src.updateUsrDialog() - return - - /**********************Prisoner Collection Unit**************************/ - - /obj/machinery/mineral/stacking_machine/laborstacker - var/points = 0 //The unclaimed value of ore stacked. Value for each ore loosely relative to its rarity. - var/list/ore_values = list(("glass" = 1), ("metal" = 2), ("solid plasma" = 20), ("plasteel" = 23), ("reinforced glass" = 4), ("gold" = 20), ("silver" = 20), ("uranium" = 20), ("diamond" = 25), ("bananium" = 50), ("tranquillite" = 50)) - -/obj/machinery/mineral/stacking_machine/laborstacker/proc/get_ore_values() - var/dat = "" - for(var/ore in ore_values) - var/value = ore_values[ore] - dat += "" - dat += "
[capitalize(ore)][value]
" - return dat + var/points = 0 //The unclaimed value of ore stacked. /obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp) - if(istype(inp)) - var/n = inp.name - var/a = inp.amount - if(n in ore_values) - points += ore_values[n] * a + points += inp.point_value * inp.amount ..() +/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user) + if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I)) + var/obj/item/stack/sheet/inp = I + points += inp.point_value * inp.amount + return ..() /**********************Point Lookup Console**************************/ /obj/machinery/mineral/labor_points_checker @@ -159,13 +154,15 @@ desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID." icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "console" - density = 0 - anchored = 1 + density = FALSE /obj/machinery/mineral/labor_points_checker/attack_hand(mob/user) - user.examine(src) + . = ..() + if(.) + return + user.examinate(src) -/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I as obj, mob/user as mob, params) +/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/card/id)) if(istype(I, /obj/item/card/id/prisoner)) var/obj/item/card/id/prisoner/prisoner_id = I @@ -175,5 +172,5 @@ to_chat(user, "Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.") else to_chat(user, "Error: Invalid ID") - return - ..() + else + return ..() \ No newline at end of file diff --git a/code/modules/telesci/bscrystal.dm b/code/modules/telesci/bscrystal.dm index 8f98f1b4158..b0b2941b3d2 100644 --- a/code/modules/telesci/bscrystal.dm +++ b/code/modules/telesci/bscrystal.dm @@ -66,6 +66,7 @@ var/global/list/datum/stack_recipe/bluespace_crystal_recipes = list(new/datum/st attack_verb = list("bluespace polybashed", "bluespace polybattered", "bluespace polybludgeoned", "bluespace polythrashed", "bluespace polysmashed") toolspeed = 1 usesound = 'sound/items/deconstruct.ogg' + point_value = 30 /obj/item/stack/sheet/bluespace_crystal/New() ..() diff --git a/nano/templates/labor_claim_console.tmpl b/nano/templates/labor_claim_console.tmpl new file mode 100644 index 00000000000..c59d9b6344f --- /dev/null +++ b/nano/templates/labor_claim_console.tmpl @@ -0,0 +1 @@ +d \ No newline at end of file From cd78f9ebe114f87594829055fa6c0697ade1b9be Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Sat, 1 Jun 2019 00:53:13 +0200 Subject: [PATCH 2/3] Refactor the labor stacker --- code/modules/mining/laborcamp/laborstacker.dm | 80 ++++++++++--------- nano/templates/labor_claim_console.tmpl | 79 +++++++++++++++++- 2 files changed, 121 insertions(+), 38 deletions(-) diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index ad2bfa5017b..4d9a98cb077 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -28,7 +28,7 @@ GLOBAL_LIST(labor_sheet_values) if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes continue sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value))) - GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list) + GLOB.labor_sheet_values = sheet_list /obj/machinery/mineral/labor_claim_console/Destroy() . = ..() @@ -42,6 +42,7 @@ GLOBAL_LIST(labor_sheet_values) if(!inserted_id) if(!user.unEquip(I)) return + I.forceMove(src) inserted_id = I to_chat(user, "You insert [I].") return @@ -49,20 +50,23 @@ GLOBAL_LIST(labor_sheet_values) to_chat(user, "There's an ID inserted already.") return ..() +/obj/machinery/mineral/labor_claim_console/attack_hand(mob/user) + ui_interact(user) + /obj/machinery/mineral/labor_claim_console/attack_ghost(mob/user) attack_hand(user) /obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/topic_state/state = default_state) ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open) if(!ui) - ui = new(user, src, ui_key, "labor_claim_console.tmpl", name, 450, 475, state) + ui = new(user, src, ui_key, "labor_claim_console.tmpl", name, 450, 625, state) ui.open() /obj/machinery/mineral/labor_claim_console/ui_data(mob/user) var/list/data = list() var/can_go_home = FALSE - data["emagged"] = (emagged) ? 1 : 0 + data["emagged"] = (emagged) ? TRUE : FALSE if(inserted_id) data["id"] = inserted_id data["id_name"] = inserted_id.registered_name @@ -79,46 +83,48 @@ GLOBAL_LIST(labor_sheet_values) return data -/obj/machinery/mineral/labor_claim_console/Topic (action, params) +/obj/machinery/mineral/labor_claim_console/Topic(href, href_list) if(..()) return TRUE - switch(action) - if("handle_id") - if(inserted_id) - if(!usr.put_in_hands(inserted_id)) - inserted_id.forceMove(get_turf(src)) - inserted_id = null - else - var/obj/item/I = usr.get_active_hand() - if(istype(I, /obj/item/card/id/prisoner)) - if(!usr.unEquip(I)) - return - inserted_id = I - if("claim_points") - inserted_id.points += stacking_machine.points - stacking_machine.points = 0 - to_chat(usr, "Points transferred.") - if("move_shuttle") - if(!alone_in_area(get_area(src), usr)) - to_chat(usr, "Prisoners are only allowed to be released while alone.") - else - switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE)) - if(1) - to_chat(usr, "Shuttle not found.") - if(2) - to_chat(usr, "Shuttle already at station.") - if(3) - to_chat(usr, "No permission to dock could be granted.") - else - if(!(emagged)) - var/message = "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval." - announcer.autosay(message, "Labor Camp Controller", "Security") - to_chat(usr, "Shuttle received message and will be sent shortly.") + if(href_list["handle_id"]) + if(inserted_id) + if(!usr.put_in_hands(inserted_id)) + inserted_id.forceMove(get_turf(src)) + inserted_id = null + else + var/obj/item/I = usr.get_active_hand() + if(istype(I, /obj/item/card/id/prisoner)) + if(!usr.unEquip(I)) + return + I.forceMove(src) + inserted_id = I + if(href_list["claim_points"]) + inserted_id.points += stacking_machine.points + stacking_machine.points = 0 + to_chat(usr, "Points transferred.") + if(href_list["move_shuttle"]) + if(!alone_in_area(get_area(src), usr)) + to_chat(usr, "Prisoners are only allowed to be released while alone.") + else + switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE)) + if(1) + to_chat(usr, "Shuttle not found.") + if(2) + to_chat(usr, "Shuttle already at station.") + if(3) + to_chat(usr, "No permission to dock could be granted.") + else + if(!(emagged)) + var/message = "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval." + announcer.autosay(message, "Labor Camp Controller", "Security") + to_chat(usr, "Shuttle received message and will be sent shortly.") + + return TRUE /obj/machinery/mineral/labor_claim_console/proc/check_auth() if(emagged) - return 1 //Shuttle is emagged, let any ol' person through + return TRUE //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. /obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine() diff --git a/nano/templates/labor_claim_console.tmpl b/nano/templates/labor_claim_console.tmpl index c59d9b6344f..26a2921aedc 100644 --- a/nano/templates/labor_claim_console.tmpl +++ b/nano/templates/labor_claim_console.tmpl @@ -1 +1,78 @@ -d \ No newline at end of file + + + + +

Ore values

+
+ {{for data.ores}} +
+
+ {{:value.ore}}: +
+
+ {{:value.value}} +
+
+ {{/for}} +
+ +

Points

+
+
+
+ ID: +
+
+ {{:helper.link(data.id ? data.id_name : '-------------', null, { 'handle_id' : 1 })}} +
+
+ {{if data.id}} +
+
+ Points collected: +
+
+ {{:data.points}} +
+
+
+
+ Goal: +
+
+ {{:data.goal}} +
+
+
+
+ Unclaimed points: +
+
+
{{:data.unclaimed_points}}
+ {{:helper.link('Claim points', null, { 'claim_points' : 1 }, data.unclaimed_points ? null : 'disabled')}} +
+
+ {{/if}} +
+ +
+
+ {{:helper.link('Move shuttle', null, { 'move_shuttle' : 1 }, data.can_go_home ? null : 'disabled', 'link centerButton')}} +
+
\ No newline at end of file From b55b18248db734c30ff3375e3e365936fbba8713 Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Sat, 1 Jun 2019 01:00:08 +0200 Subject: [PATCH 3/3] Remove useless center and update UI on ID insert --- code/modules/mining/laborcamp/laborstacker.dm | 1 + nano/templates/labor_claim_console.tmpl | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index 4d9a98cb077..fb2b915f146 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -45,6 +45,7 @@ GLOBAL_LIST(labor_sheet_values) I.forceMove(src) inserted_id = I to_chat(user, "You insert [I].") + SSnanoui.update_uis(src) return else to_chat(user, "There's an ID inserted already.") diff --git a/nano/templates/labor_claim_console.tmpl b/nano/templates/labor_claim_console.tmpl index 26a2921aedc..efbdb5796d6 100644 --- a/nano/templates/labor_claim_console.tmpl +++ b/nano/templates/labor_claim_console.tmpl @@ -72,7 +72,5 @@ Used In File(s): \code\modules\mining\laborcamp\laborstacker.dm
-
{{:helper.link('Move shuttle', null, { 'move_shuttle' : 1 }, data.can_go_home ? null : 'disabled', 'link centerButton')}} -
\ No newline at end of file