diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index 57e91619691..5f7c628f5d2 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -13986,7 +13986,8 @@ departmentType = 0; name = "Bar RC"; pixel_x = 0; - pixel_y = 32 + pixel_y = 32; + receive_ore_updates = 1 }, /obj/item/weapon/book/manual/barman_recipes, /obj/item/weapon/reagent_containers/food/drinks/shaker, @@ -79701,7 +79702,8 @@ departmentType = 0; name = "Xenobiology RC"; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/machinery/camera{ c_tag = "Xenobiology - Starboard"; @@ -83133,6 +83135,7 @@ name = "Research RC"; pixel_x = 32; pixel_y = 0 + receive_ore_updates = 1 }, /obj/machinery/camera{ c_tag = "Science - Research and Development"; @@ -84652,7 +84655,8 @@ departmentType = 0; name = "Chemistry RC"; pixel_x = 0; - pixel_y = -64 + pixel_y = -64; + receive_ore_updates = 1 }, /obj/effect/turf_decal/stripes/line{ dir = 4 @@ -90819,7 +90823,8 @@ departmentType = 5; name = "Research Director's RC"; pixel_x = -32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/effect/turf_decal/bot, /turf/open/floor/plasteel, @@ -93407,7 +93412,8 @@ departmentType = 0; name = "Robotics RC"; pixel_x = 0; - pixel_y = 32 + pixel_y = 32; + receive_ore_updates = 1 }, /obj/structure/extinguisher_cabinet{ pixel_x = -26 @@ -95889,7 +95895,8 @@ departmentType = 0; name = "Toxins RC"; pixel_x = -32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/effect/turf_decal/delivery, /turf/open/floor/plasteel, @@ -104734,7 +104741,8 @@ departmentType = 0; name = "Virology RC"; pixel_x = 0; - pixel_y = 32 + pixel_y = 32; + receive_ore_updates = 1 }, /obj/item/weapon/folder/white, /obj/item/weapon/pen/red, diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index 26c8d74c509..61f747f4571 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -43116,7 +43116,8 @@ department = "Bar"; departmentType = 2; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/structure/table, /obj/item/weapon/book/manual/barman_recipes{ @@ -67235,7 +67236,8 @@ department = "Chemistry"; departmentType = 2; pixel_x = -30; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/structure/table/glass, /turf/open/floor/plasteel/whiteyellow/side{ @@ -67435,7 +67437,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/machinery/disposal/bin, /obj/structure/disposalpipe/trunk, @@ -69766,7 +69769,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /obj/structure/table, /obj/effect/turf_decal/stripes/line{ @@ -71347,7 +71351,8 @@ departmentType = 5; name = "Research Director RC"; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/machinery/modular_computer/console/preset/research, /turf/open/floor/plasteel/cafeteria{ @@ -76968,7 +76973,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /obj/structure/table/reinforced, /obj/machinery/light, @@ -78448,7 +78454,8 @@ department = "Virology"; name = "Virology Requests Console"; pixel_x = 29; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/item/stack/sheet/mineral/plasma{ layer = 2.9 @@ -79172,7 +79179,8 @@ departmentType = 2; name = "Robotics RC"; pixel_x = -31; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/effect/turf_decal/bot, /turf/open/floor/plasteel, @@ -91458,7 +91466,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/machinery/light{ dir = 1 diff --git a/_maps/map_files/OmegaStation/OmegaStation.dmm b/_maps/map_files/OmegaStation/OmegaStation.dmm index 6ceb63f1eb7..ecc14162912 100644 --- a/_maps/map_files/OmegaStation/OmegaStation.dmm +++ b/_maps/map_files/OmegaStation/OmegaStation.dmm @@ -15489,7 +15489,8 @@ departmentType = 0; name = "Bar RC"; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden{ tag = "icon-manifold (EAST)"; @@ -27891,7 +27892,8 @@ departmentType = 0; name = "Research RC"; pixel_x = 0; - pixel_y = 32 + pixel_y = 32; + receive_ore_updates = 1 }, /turf/open/floor/plasteel/whitepurple/corner{ dir = 4 @@ -29383,7 +29385,8 @@ departmentType = 0; name = "Chemistry RC"; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /turf/open/floor/plasteel/whiteyellow/corner, /area/medical/chemistry) @@ -32199,7 +32202,8 @@ departmentType = 0; name = "Robotics RC"; pixel_x = 0; - pixel_y = 32 + pixel_y = 32; + receive_ore_updates = 1 }, /obj/machinery/light_switch{ pixel_x = 24 @@ -38066,7 +38070,8 @@ departmentType = 0; name = "Xenobiology RC"; pixel_x = 0; - pixel_y = -32 + pixel_y = -32; + receive_ore_updates = 1 }, /obj/structure/cable/white{ tag = "icon-1-4"; diff --git a/_maps/map_files/PubbyStation/PubbyStation.dmm b/_maps/map_files/PubbyStation/PubbyStation.dmm index f9d64afb5d4..13416e16b80 100644 --- a/_maps/map_files/PubbyStation/PubbyStation.dmm +++ b/_maps/map_files/PubbyStation/PubbyStation.dmm @@ -21536,7 +21536,8 @@ department = "Bar"; departmentType = 2; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/machinery/camera{ c_tag = "Bar Access"; @@ -28450,7 +28451,8 @@ department = "Robotics"; departmentType = 2; name = "Robotics RC"; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /turf/open/floor/plasteel, /area/assembly/robotics) @@ -30034,7 +30036,8 @@ dir = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/effect/turf_decal/stripes/line{ dir = 1 @@ -31246,7 +31249,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = -32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/item/weapon/book/manual/research_and_development, /turf/open/floor/plasteel/purple/side{ @@ -33277,7 +33281,8 @@ department = "Chemistry"; departmentType = 2; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/machinery/atmospherics/pipe/simple/supply/hidden, /turf/open/floor/plasteel/white, @@ -35021,7 +35026,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /turf/open/floor/plasteel/whitepurple/side{ dir = 6 @@ -36833,7 +36839,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 32; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/effect/turf_decal/stripes/line{ dir = 4 @@ -38357,7 +38364,8 @@ departmentType = 5; name = "Research Director RC"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /turf/open/floor/plasteel/whitepurple/side, /area/crew_quarters/hor) @@ -40685,7 +40693,8 @@ /obj/machinery/requests_console{ department = "Virology"; name = "Virology Requests Console"; - pixel_x = 32 + pixel_x = 32; + receive_ore_updates = 1 }, /obj/item/weapon/storage/box/monkeycubes{ layer = 3.1 diff --git a/_maps/map_files/TgStation/tgstation.2.1.3.dmm b/_maps/map_files/TgStation/tgstation.2.1.3.dmm index 01378a170d6..adaea9d9876 100644 --- a/_maps/map_files/TgStation/tgstation.2.1.3.dmm +++ b/_maps/map_files/TgStation/tgstation.2.1.3.dmm @@ -20195,7 +20195,8 @@ department = "Bar"; departmentType = 2; pixel_x = 30; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/machinery/camera{ c_tag = "Bar"; @@ -26296,7 +26297,8 @@ department = "Robotics"; departmentType = 2; name = "Robotics RC"; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/machinery/light{ dir = 1 @@ -26694,7 +26696,8 @@ department = "Chemistry"; departmentType = 2; pixel_x = -30; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /obj/machinery/light{ icon_state = "tube1"; @@ -27682,7 +27685,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = -30; - pixel_y = 0 + pixel_y = 0; + receive_ore_updates = 1 }, /turf/open/floor/plasteel/white, /area/toxins/lab) @@ -32431,7 +32435,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /obj/machinery/atmospherics/components/unary/vent_pump{ dir = 1; @@ -34110,7 +34115,8 @@ departmentType = 5; name = "Research Director RC"; pixel_x = -2; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /obj/structure/window/reinforced{ dir = 4 @@ -40330,7 +40336,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /obj/structure/table/reinforced, /turf/open/floor/plasteel/white, @@ -42997,7 +43004,8 @@ departmentType = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + receive_ore_updates = 1 }, /obj/item/weapon/paper_bin{ pixel_x = 1; @@ -43474,7 +43482,8 @@ dir = 2; name = "Science Requests Console"; pixel_x = 0; - pixel_y = 30 + pixel_y = 30; + receive_ore_updates = 1 }, /turf/open/floor/plasteel, /area/toxins/misc_lab) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 1d9ac221d33..a583e579924 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -56,6 +56,7 @@ var/list/obj/machinery/requests_console/allConsoles = list() var/priority = -1 ; //Priority of the message being sent var/obj/item/device/radio/Radio var/emergency //If an emergency has been called by this device. Acts as both a cooldown and lets the responder know where it the emergency was triggered from + var/receive_ore_updates = FALSE //If ore redemption machines will send an update when it receives new ores. obj_integrity = 300 max_integrity = 300 armor = list(melee = 70, bullet = 30, laser = 30, energy = 30, bomb = 0, bio = 0, rad = 0, fire = 90, acid = 90) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 17f76a209ed..49b5a7a7710 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -11,6 +11,7 @@ input_dir = NORTH output_dir = SOUTH req_access = list(access_mineral_storeroom) + var/req_access_reclaim = access_mining_station var/stk_types = list() var/stk_amt = list() var/stack_list = list() //Key: Type. Value: Instance of type. @@ -19,12 +20,14 @@ var/ore_pickup_rate = 15 var/sheet_per_ore = 1 var/point_upgrade = 1 - var/list/ore_values = list(("sand" = 1), ("iron" = 1), ("plasma" = 15), ("silver" = 16), ("gold" = 18), ("titanium" = 30), ("uranium" = 30), ("diamond" = 50), ("bluespace crystal" = 50), ("bananium" = 60)) + var/list/ore_values = list("sand" = 1, "iron" = 1, "plasma" = 15, "silver" = 16, "gold" = 18, "titanium" = 30, "uranium" = 30, "diamond" = 50, "bluespace crystal" = 50, "bananium" = 60) speed_process = 1 + var/message_sent = FALSE + var/list/ore_buffer = list() /obj/machinery/mineral/ore_redemption/New() ..() - var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/ore_redemption(null) + var/obj/item/weapon/circuitboard/machine/ore_redemption/B = new B.apply_default_parts(src) /obj/item/weapon/circuitboard/machine/ore_redemption @@ -55,51 +58,72 @@ /obj/machinery/mineral/ore_redemption/proc/process_sheet(obj/item/weapon/ore/O) var/obj/item/stack/sheet/processed_sheet = SmeltMineral(O) if(processed_sheet) - if(!(processed_sheet in stack_list)) //It's the first of this sheet added - var/obj/item/stack/sheet/s = new processed_sheet(src,0,merge=FALSE) + var/obj/item/stack/sheet/s + if(!stack_list[processed_sheet]) + s = new processed_sheet(src, FALSE) s.amount = 0 stack_list[processed_sheet] = s - var/obj/item/stack/sheet/storage = stack_list[processed_sheet] - storage.amount += sheet_per_ore //Stack the sheets - O.loc = null //Let the old sheet... + s = stack_list[processed_sheet] + s.amount += sheet_per_ore //Stack the sheets + ore_buffer -= O qdel(O) //... garbage collect +/obj/machinery/mineral/ore_redemption/proc/process_ores(list/ores_to_process) + var/current_amount = 0 + for(var/ore in ores_to_process) + if(current_amount >= ore_pickup_rate) + break + process_sheet(ore) + +/obj/machinery/mineral/ore_redemption/proc/send_console_message() + if(z != ZLEVEL_STATION || !LAZYLEN(stack_list)) + return + message_sent = TRUE + var/area/A = get_area(src) + var/msg = "Now available in [A]:
" + for(var/s in stack_list) + var/obj/item/stack/sheet/sheet = stack_list[s] + msg += "[capitalize(sheet.name)]: [sheet.amount] sheets
" + + for(var/obj/machinery/requests_console/D in allConsoles) + if(D.receive_ore_updates) + D.createmessage("Ore Redemption Machine", "New minerals available!", msg, 1, 0) + /obj/machinery/mineral/ore_redemption/process() - if(!panel_open && powered()) //If the machine is partially disassembled and/or depowered, it should not process minerals - var/turf/T = get_step(src, input_dir) - var/i = 0 - if(T) - for(var/obj/item/weapon/ore/O in T) - if (i >= ore_pickup_rate) - break - else if (!O || !O.refined_type) - continue - else - process_sheet(O) - i++ - else - var/obj/structure/ore_box/B = locate() in T - if(B) - for(var/obj/item/weapon/ore/O in B.contents) - if (i >= ore_pickup_rate) - break - else if (!O || !O.refined_type) - continue - else - process_sheet(O) - i++ - if(i > 0 && z == ZLEVEL_STATION) - var/area/orm_area = get_area(src) - var/msg = "Now available in [orm_area.map_name]:" - for(var/s in stack_list) // Making an announcement for cargo - var/obj/item/stack/sheet/mats = stack_list[s] - msg += "\n[capitalize(mats.name)]: [mats.amount] sheets" - for(var/obj/machinery/requests_console/D in allConsoles) - if(D.department == "Science" || D.department == "Robotics" || D.department == "Research Director's Desk" || D.department == "Chemistry" || D.department == "Bar") - D.createmessage("Ore Redemption Machine", "New minerals available!", msg, 1, 0) + if(panel_open || !powered()) + return + var/atom/input = get_step(src, input_dir) + var/obj/structure/ore_box/OB = locate() in input + if(OB) + input = OB + + for(var/obj/item/weapon/ore/O in input) + if(QDELETED(O)) + continue + ore_buffer |= O + O.forceMove(src) + CHECK_TICK + + if(LAZYLEN(ore_buffer)) + message_sent = FALSE + process_ores(ore_buffer) + else if(!message_sent) + send_console_message() /obj/machinery/mineral/ore_redemption/attackby(obj/item/weapon/W, mob/user, params) - if (!powered()) + if(exchange_parts(user, W)) + return + if(default_pry_open(W)) + return + if(default_unfasten_wrench(user, W)) + return + if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", W)) + updateUsrDialog() + return + if(default_deconstruction_crowbar(W)) + return + + if(!powered()) return if(istype(W,/obj/item/weapon/card/id)) var/obj/item/weapon/card/id/I = user.get_active_held_item() @@ -110,33 +134,20 @@ inserted_id = I interact(user) return + if(istype(W, /obj/item/device/multitool) && panel_open) input_dir = turn(input_dir, -90) output_dir = turn(output_dir, -90) to_chat(user, "You change [src]'s I/O settings, setting the input to [dir2text(input_dir)] and the output to [dir2text(output_dir)].") return - if(exchange_parts(user, W)) - return - - if(default_pry_open(W)) - return - - if(default_unfasten_wrench(user, W)) - return - if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", W)) - updateUsrDialog() - return - if(default_deconstruction_crowbar(W)) - return - return ..() /obj/machinery/mineral/ore_redemption/on_deconstruction() empty_content() /obj/machinery/mineral/ore_redemption/proc/SmeltMineral(obj/item/weapon/ore/O) - if(O.refined_type) + if(O && O.refined_type) var/obj/item/stack/sheet/M = O.refined_type points += O.points * point_upgrade return M @@ -149,24 +160,19 @@ interact(user) /obj/machinery/mineral/ore_redemption/interact(mob/user) - var/obj/item/stack/sheet/s - var/dat + var/dat = "This machine only accepts ore. Gibtonite and Slag are not accepted.

" + dat += "Current unclaimed points: [points]
" - dat += text("This machine only accepts ore. Gibtonite and Slag are not accepted.

") - dat += text("Current unclaimed points: [points]
") - - if(istype(inserted_id)) - dat += text("You have [inserted_id.mining_points] mining points collected. Eject ID.
") - dat += text("Claim points.
") + if(inserted_id) + dat += "You have [inserted_id.mining_points] mining points collected. Eject ID.
" + dat += "Claim points.

" else - dat += text("No ID inserted. Insert ID.
") + dat += "No ID inserted. Insert ID.

" for(var/O in stack_list) - s = stack_list[O] - if(s.amount > 0) - if(O == stack_list[1]) - dat += "
" //just looks nicer - dat += text("[capitalize(s.name)]: [s.amount] Release
") + var/obj/item/stack/sheet/s = stack_list[O] + if(s.amount) + dat += "[capitalize(s.name)]: [s.amount] Release
" var/obj/item/stack/sheet/metalstack if(/obj/item/stack/sheet/metal in stack_list) @@ -181,10 +187,10 @@ titaniumstack = stack_list[/obj/item/stack/sheet/mineral/titanium] if(metalstack && plasmastack && min(metalstack.amount, plasmastack.amount)) - dat += text("Plasteel Alloy (Metal + Plasma): Smelt
") + dat += "Plasteel Alloy (Metal + Plasma): Smelt
" if(titaniumstack && plasmastack && min(titaniumstack.amount, plasmastack.amount)) - dat += text("Plastitanium Alloy (Titanium + Plasma): Smelt
") - dat += text("
Mineral Value List:
[get_ore_values()]
") + dat += "Plastitanium Alloy (Titanium + Plasma): Smelt
" + dat += "
Mineral Value List:
[get_ore_values()]
" var/datum/browser/popup = new(user, "console_stacking_machine", "Ore Redemption Machine", 400, 500) popup.set_content(dat) @@ -202,34 +208,34 @@ /obj/machinery/mineral/ore_redemption/Topic(href, href_list) if(..()) return - if(href_list["choice"]) - if(istype(inserted_id)) - if(href_list["choice"] == "eject") - inserted_id.loc = loc - inserted_id.verb_pickup() - inserted_id = null - if(href_list["choice"] == "claim") - if(access_mining_station in inserted_id.access) - inserted_id.mining_points += points - points = 0 - else - to_chat(usr, "Required access not found.") - else if(href_list["choice"] == "insert") - var/obj/item/weapon/card/id/I = usr.get_active_held_item() - if(istype(I)) - if(!usr.drop_item()) - return - I.loc = src - inserted_id = I - else to_chat(usr, "No valid ID.") + if(href_list["eject_id"]) + usr.put_in_hands(inserted_id) + inserted_id = null + if(href_list["claim"]) + if(inserted_id) + if(req_access_reclaim in inserted_id.access) + inserted_id.mining_points += points + points = 0 + else + to_chat(usr, "Required access not found.") + else if(href_list["insert_id"]) + var/obj/item/weapon/card/id/I = usr.get_active_held_item() + if(istype(I)) + if(!usr.drop_item()) + return + I.forceMove(src) + inserted_id = I + else + to_chat(usr, "Not a valid ID!") if(href_list["release"]) if(check_access(inserted_id) || allowed(usr)) //Check the ID inside, otherwise check the user. - if(!(text2path(href_list["release"]) in stack_list)) return + if(!(text2path(href_list["release"]) in stack_list)) + return var/obj/item/stack/sheet/inp = stack_list[text2path(href_list["release"])] var/obj/item/stack/sheet/out = new inp.type(src,merge=FALSE) - var/desired = input("How much?", "How much to eject?", 1) as num + var/desired = input("How many sheets?", "How many sheets to eject?", 1) as null|num out.amount = round(min(desired,50,inp.amount)) - if(out.amount >= 1) + if(out.amount) inp.amount -= out.amount unload_mineral(out) if(inp.amount < 1) @@ -242,17 +248,25 @@ var/alloytype2 = text2path(href_list["alloytype2"]) var/alloytypeout = text2path(href_list["alloytypeout"]) if(check_access(inserted_id) || allowed(usr)) - if(!(alloytype1 in stack_list)) return - if(!(alloytype2 in stack_list)) return + if(!(alloytype1 in stack_list)) + return + if(!(alloytype2 in stack_list)) + return var/obj/item/stack/sheet/stack1 = stack_list[alloytype1] var/obj/item/stack/sheet/stack2 = stack_list[alloytype2] - var/desired = input("How much?", "How much would you like to smelt?", 1) as num + var/desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num var/obj/item/stack/sheet/alloyout = new alloytypeout alloyout.amount = round(min(desired,50,stack1.amount,stack2.amount)) if(alloyout.amount >= 1) stack1.amount -= alloyout.amount stack2.amount -= alloyout.amount unload_mineral(alloyout) + if(stack1.amount < 1) + stack_list -= stack1 + qdel(stack1) + if(stack2.amount < 1) + stack_list -= stack2 + qdel(stack2) else to_chat(usr, "Required access not found.") updateUsrDialog() @@ -273,7 +287,7 @@ while(s.amount > s.max_amount) new s.type(loc,s.max_amount) s.use(s.max_amount) - s.loc = loc + s.forceMove(get_turf(src)) s.layer = initial(s.layer) s.plane = initial(s.plane) @@ -286,4 +300,4 @@ icon_state = initial(icon_state) else icon_state = "[initial(icon_state)]-off" - return + return \ No newline at end of file