diff --git a/_maps/map_files/stations/boxstation.dmm b/_maps/map_files/stations/boxstation.dmm index 2f212e06665..174539de977 100644 --- a/_maps/map_files/stations/boxstation.dmm +++ b/_maps/map_files/stations/boxstation.dmm @@ -23462,6 +23462,7 @@ "bDJ" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/light, +/obj/machinery/salvage_redemption, /turf/simulated/floor/plasteel{ icon_state = "brown" }, @@ -39024,7 +39025,7 @@ /obj/machinery/atmospherics/pipe/simple/visible/yellow{ dir = 10 }, -/obj/structure/lattice/catwalk, +/obj/structure/lattice, /turf/space, /area/space/nearstation) "cNF" = ( @@ -49236,6 +49237,13 @@ /obj/structure/closet, /turf/simulated/floor/plating, /area/station/maintenance/asmaint) +"euR" = ( +/obj/machinery/atmospherics/pipe/simple/visible/yellow{ + dir = 9 + }, +/obj/structure/lattice/catwalk, +/turf/space, +/area/space/nearstation) "euX" = ( /obj/machinery/door/firedoor, /obj/machinery/door/airlock/research/glass, @@ -54156,7 +54164,7 @@ /obj/machinery/atmospherics/pipe/simple/visible/yellow{ dir = 9 }, -/obj/structure/lattice/catwalk, +/obj/structure/lattice, /turf/space, /area/space/nearstation) "gNX" = ( @@ -82232,6 +82240,13 @@ icon_state = "whiteblue" }, /area/station/medical/surgery/secondary) +"uxh" = ( +/obj/machinery/atmospherics/pipe/simple/visible/yellow{ + dir = 10 + }, +/obj/structure/lattice/catwalk, +/turf/space, +/area/space/nearstation) "uxB" = ( /obj/effect/decal/cleanable/dirt, /obj/item/stack/cable_coil, @@ -85379,13 +85394,6 @@ icon_state = "caution" }, /area/station/public/dorms) -"wfZ" = ( -/obj/machinery/atmospherics/pipe/simple/visible/yellow{ - dir = 9 - }, -/obj/structure/lattice, -/turf/space, -/area/space/nearstation) "wgt" = ( /obj/structure/table/wood, /obj/item/ashtray/glass, @@ -88828,13 +88836,6 @@ /obj/effect/decal/cleanable/dirt, /turf/simulated/floor/plating, /area/station/maintenance/abandonedservers) -"xPT" = ( -/obj/machinery/atmospherics/pipe/simple/visible/yellow{ - dir = 10 - }, -/obj/structure/lattice, -/turf/space, -/area/space/nearstation) "xQB" = ( /obj/effect/spawner/window/reinforced/tinted, /obj/structure/disposalpipe/segment{ @@ -125867,7 +125868,7 @@ aab cQp aab cZh -cNE +uxh dba djE dcS @@ -125879,7 +125880,7 @@ djE djE djE djE -gNQ +euR aab aab aab @@ -127171,7 +127172,7 @@ igi igi igi igi -wfZ +gNQ fPY wyD wyD @@ -127400,7 +127401,7 @@ cep cjq cep cxO -xPT +cNE igi igi igi @@ -127418,7 +127419,7 @@ igi igi igi igi -wfZ +gNQ dgS eQU eQU diff --git a/_maps/map_files/stations/cerestation.dmm b/_maps/map_files/stations/cerestation.dmm index 779b29bed62..5a229f8c199 100644 --- a/_maps/map_files/stations/cerestation.dmm +++ b/_maps/map_files/stations/cerestation.dmm @@ -103891,13 +103891,12 @@ }, /area/station/medical/reception) "uyZ" = ( -/obj/structure/table, /obj/machinery/camera{ c_tag = "Expedition Access"; dir = 8; network = list("SS13","QM") }, -/obj/item/toy/figure/crew/explorer, +/obj/machinery/salvage_redemption, /turf/simulated/floor/plasteel{ dir = 4; icon_state = "darkbrown" diff --git a/_maps/map_files/stations/deltastation.dmm b/_maps/map_files/stations/deltastation.dmm index 084ab2487be..1a1059f651b 100644 --- a/_maps/map_files/stations/deltastation.dmm +++ b/_maps/map_files/stations/deltastation.dmm @@ -35348,9 +35348,7 @@ name = "south bump"; pixel_y = -24 }, -/obj/structure/chair/stool/bar, -/obj/effect/landmark/start/explorer, -/obj/effect/spawner/random/dirt/often, +/obj/machinery/salvage_redemption, /turf/simulated/floor/plasteel{ icon_state = "brown" }, @@ -68741,6 +68739,12 @@ }, /turf/simulated/floor/plating, /area/station/maintenance/fore) +"lKR" = ( +/obj/effect/landmark/start/explorer, +/obj/effect/spawner/random/dirt/often, +/obj/structure/chair/stool/bar, +/turf/simulated/floor/plasteel, +/area/station/supply/expedition) "lKV" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply{ dir = 4 @@ -140580,7 +140584,7 @@ cDa cDa cyt fZa -cDa +lKR cCW cyv cEZ diff --git a/_maps/map_files/stations/emeraldstation.dmm b/_maps/map_files/stations/emeraldstation.dmm index 8f58eafc3f1..7aa8c9efd8f 100644 --- a/_maps/map_files/stations/emeraldstation.dmm +++ b/_maps/map_files/stations/emeraldstation.dmm @@ -66733,13 +66733,11 @@ }, /area/station/science/lobby) "npL" = ( -/obj/structure/rack, -/obj/item/storage/toolbox/emergency, -/obj/item/crowbar, /obj/machinery/camera{ c_tag = "Expedition"; dir = 8 }, +/obj/machinery/salvage_redemption, /turf/simulated/floor/plasteel{ dir = 4; icon_state = "brown" @@ -120055,6 +120053,12 @@ icon_state = "dark" }, /area/station/science/server) +"xQK" = ( +/obj/structure/rack, +/obj/item/storage/toolbox/emergency, +/obj/item/crowbar, +/turf/simulated/floor/plasteel, +/area/station/supply/expedition) "xQP" = ( /obj/item/clothing/under/color/orange/prison, /obj/item/clothing/shoes/orange, @@ -149264,7 +149268,7 @@ frH frH frH npL -frH +xQK eFW cqd vwR diff --git a/_maps/map_files/stations/metastation.dmm b/_maps/map_files/stations/metastation.dmm index d6e8be969da..36a1ecd272e 100644 --- a/_maps/map_files/stations/metastation.dmm +++ b/_maps/map_files/stations/metastation.dmm @@ -86566,6 +86566,7 @@ /area/station/maintenance/aft2) "wIu" = ( /obj/machinery/requests_console/directional/south, +/obj/machinery/salvage_redemption, /turf/simulated/floor/plasteel{ icon_state = "brown" }, diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 55f3b9884dd..80eb4527e10 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -115,3 +115,7 @@ #define ORM_BASE_SHEET_MULT 0.90 #define ORM_POINT_MULT_ADD_PER_RATING 0.10 #define ORM_SHEET_MULT_ADD_PER_RATING 0.10 + +/// Salvage machine point defines +#define SALVAGE_REDEMPTION_BASE_POINT_MULT 0.6 +#define SALVAGE_REDEMPTION_POINT_MULT_ADD_PER_RATING 0.1 diff --git a/code/game/objects/items/salvage.dm b/code/game/objects/items/salvage.dm index 681fe1564b2..5e75e9dbdae 100644 --- a/code/game/objects/items/salvage.dm +++ b/code/game/objects/items/salvage.dm @@ -9,6 +9,8 @@ hitsound = 'sound/items/handling/salvagepickup.ogg' pickup_sound = 'sound/items/handling/salvagepickup.ogg' drop_sound = 'sound/items/handling/salvagedrop.ogg' + /// How much is the salvage worth? + var/value = 100 /obj/item/salvage/examine(mob/user) . = ..() diff --git a/code/modules/economy/economy_machinery/atm.dm b/code/modules/economy/economy_machinery/atm.dm index 2afb0eac480..ba2f38fdf23 100644 --- a/code/modules/economy/economy_machinery/atm.dm +++ b/code/modules/economy/economy_machinery/atm.dm @@ -87,6 +87,9 @@ if(istype(used, /obj/item/stack/spacecash) && has_power()) insert_cash(used, user) return ITEM_INTERACT_COMPLETE + if(istype(used, /obj/item/credit_redemption_slip) && has_power()) + redeem_credits(used, user) + return ITEM_INTERACT_COMPLETE return ..() @@ -97,6 +100,14 @@ cash_money.use(cash_money.amount) return TRUE +/obj/machinery/economy/atm/proc/redeem_credits(obj/item/credit_redemption_slip/credit_slip, mob/user) + visible_message("[user] inserts [credit_slip] into [src].") + account_database.credit_account(authenticated_account, credit_slip.value * (1 - credit_slip.department_cut), "Credit Redemption", name, FALSE) + account_database.credit_account(credit_slip.department_account, credit_slip.value * credit_slip.department_cut, "Credit Redemption", name, FALSE) + qdel(credit_slip) + playsound(src, 'sound/machines/notif2.ogg', 50, FALSE) + return TRUE + /obj/machinery/economy/atm/proc/handle_id_insert(obj/item/card/id, mob/user) if(held_card) return diff --git a/code/modules/mining/salvage_redemption.dm b/code/modules/mining/salvage_redemption.dm new file mode 100644 index 00000000000..32b78d5d73b --- /dev/null +++ b/code/modules/mining/salvage_redemption.dm @@ -0,0 +1,167 @@ +/obj/machinery/salvage_redemption + name = "salvage redemption machine" + desc = "An electronic deposit bin that scans recovered salvage for useful information, and dispenses credit tickets based on the salvage's value." + icon = 'icons/obj/machines/mining_machines.dmi' + icon_state = "salvage_redemption" + anchored = TRUE + density = TRUE + /// Access to claim points + var/list/req_access_claim = list(ACCESS_MINING_STATION, ACCESS_FREE_GOLEMS, ACCESS_EXPEDITION) + /// The number of unclaimed points. + var/points = 0 + /// Point multiplier + var/point_upgrade = 1 + /// List of salvage yet to process + var/list/obj/item/salvage/salvage_buffer = list() + /// If TRUE, [/obj/machinery/salvage_redemption/var/req_access_claim] is ignored and any ID may be used to claim points. + var/anyone_claim = FALSE + /// Current animation state + var/animating = FALSE + +/obj/machinery/salvage_redemption/Initialize(mapload) + . = ..() + // Stock parts + component_parts = list() + component_parts += new /obj/item/circuitboard/smart_hopper(null) + component_parts += new /obj/item/stock_parts/scanning_module(null) + component_parts += new /obj/item/stock_parts/scanning_module(null) + component_parts += new /obj/item/stock_parts/scanning_module(null) + component_parts += new /obj/item/stock_parts/manipulator(null) + component_parts += new /obj/item/stack/sheet/glass(null) + RefreshParts() + +/obj/machinery/salvage_redemption/examine(mob/user) + . = ..() + . += "There are currently [points] claimable points. [points ? "Swipe your ID to claim them." : ""]" + +/obj/machinery/salvage_redemption/update_icon_state() + . = ..() + icon_state = "salvage_redemption" + if(panel_open) + icon_state += "-open" + return + +/obj/machinery/salvage_redemption/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/I) + . = ..() + update_icon(UPDATE_ICON_STATE) + +/obj/machinery/salvage_redemption/RefreshParts() + var/point_mult = SALVAGE_REDEMPTION_BASE_POINT_MULT + for(var/obj/item/stock_parts/component in component_parts) + point_mult += SALVAGE_REDEMPTION_POINT_MULT_ADD_PER_RATING * component.rating + // Update our values + point_upgrade = point_mult + SStgui.update_uis(src) + +// Interactions +/obj/machinery/salvage_redemption/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/storage/part_replacer)) + return ..() + + if(!has_power() || panel_open) + return ..() + + if(animating) + to_chat(user, "The machine is currently processing salvage at the moment."); + return ITEM_INTERACT_COMPLETE + + if(istype(used, /obj/item/card/id)) + var/obj/item/card/id/ID = used + if(!points) + to_chat(user, "There are no points to claim."); + return ITEM_INTERACT_COMPLETE + var/claimed = FALSE + for(var/access in req_access_claim) + if(anyone_claim || (access in ID.access)) + ID.mining_points += points + ID.total_mining_points += points + to_chat(user, "[points] Salvage Points claimed. You have earned a total of [ID.total_mining_points] Salvage Points this Shift!") + points = 0 + claimed = TRUE + break + if(!claimed) + to_chat(user, "Required access not found.") + add_fingerprint(user) + return ITEM_INTERACT_COMPLETE + + if(istype(used, /obj/item/storage/bag/expedition)) + var/obj/item/storage/bag/expedition/bag = used + if(!bag.contents) + to_chat(user, "You have no salvage to redeem."); + return ITEM_INTERACT_COMPLETE + for(var/obj/item/salvage/loot in bag.contents) + salvage_buffer |= loot + loot.forceMove(src) + process_salvage(user) + return ITEM_INTERACT_COMPLETE + + if(istype(used, /obj/item/salvage)) + if(used.flags & NODROP || !user.drop_item() || !used.forceMove(src)) + to_chat(user, "[used] is stuck to your hand!") + return ITEM_INTERACT_COMPLETE + var/obj/item/salvage/loot = used + salvage_buffer |= loot + process_salvage(user) + return ITEM_INTERACT_COMPLETE + return ..() + +/obj/machinery/salvage_redemption/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return TRUE + +/obj/machinery/salvage_redemption/screwdriver_act(mob/user, obj/item/I) + if(!I.use_tool(src, user, 0, volume = 0)) + return + . = TRUE + default_deconstruction_screwdriver(user, icon_state, icon_state, I) + +/obj/machinery/salvage_redemption/Destroy() + if(salvage_buffer) + for(var/obj/item/salvage/loot in salvage_buffer) + loot.forceMove(src.loc) + return ..() + +/obj/machinery/salvage_redemption/proc/process_salvage(mob/user) + var/total_value = 0 + for(var/obj/item/salvage/loot in salvage_buffer) + // Award points + points += loot.value * point_upgrade + total_value += loot.value + // Delete the salvage + salvage_buffer -= loot + qdel(loot) + // Do a little animation. It delays the slip slightly, but it looks cool + animating = TRUE + flick("salvage_redemption-active", src) + addtimer(CALLBACK(src, PROC_REF(print_slip), total_value, user), 2.5 SECONDS) + +/obj/machinery/salvage_redemption/proc/print_slip(total_value, mob/user) + // Print the credit slip + playsound(src, 'sound/machines/banknote_counter.ogg', 30, FALSE) + var/obj/item/credit_redemption_slip/slip = new /obj/item/credit_redemption_slip(src, total_value) + if(ishuman(user) && Adjacent(user)) + var/mob/living/carbon/human/H = user + H.put_in_hands(slip) + else + slip.forceMove(get_turf(src)) + +/// Credit redemption slip +/obj/item/credit_redemption_slip + name = "credit redemption slip" + desc = "A coupon worth a pre-determined amount of credits. Use this on an ATM to redeem them to your account." + icon = 'icons/obj/card.dmi' + icon_state = "credit_redemption" + w_class = WEIGHT_CLASS_TINY + resistance_flags = FLAMMABLE + /// How much is it worth? + var/value = 100 + /// Percent given to department + var/department_cut = 0.75 + /// Department to award + var/datum/money_account/department_account + +/obj/item/credit_redemption_slip/Initialize(mapload, new_value, department = DEPARTMENT_SUPPLY) + . = ..() + value = new_value + name += " ([value * (1- department_cut)])" + department_account = GLOB.station_money_database.get_account_by_department(department) diff --git a/icons/obj/card.dmi b/icons/obj/card.dmi index 83146f701ba..05a0d5ae5fd 100644 Binary files a/icons/obj/card.dmi and b/icons/obj/card.dmi differ diff --git a/icons/obj/machines/mining_machines.dmi b/icons/obj/machines/mining_machines.dmi index 1a9591be75d..3a6b3600ca1 100644 Binary files a/icons/obj/machines/mining_machines.dmi and b/icons/obj/machines/mining_machines.dmi differ diff --git a/paradise.dme b/paradise.dme index b0f493fbeaf..079e8879b48 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2361,6 +2361,7 @@ #include "code\modules\mining\mint.dm" #include "code\modules\mining\money_bag.dm" #include "code\modules\mining\ores_coins.dm" +#include "code\modules\mining\salvage_redemption.dm" #include "code\modules\mining\satchel_ore_boxdm.dm" #include "code\modules\mining\shelters.dm" #include "code\modules\mining\equipment\explorer_gear.dm" diff --git a/sound/machines/banknote_counter.ogg b/sound/machines/banknote_counter.ogg new file mode 100644 index 00000000000..93c7c348dad Binary files /dev/null and b/sound/machines/banknote_counter.ogg differ