Adds salvage redemption machine (#30359)

* Adds salvage redemption machine

* Added flammable flag to credit redemption slip

* Linters

* Linters!

* Machine icon, animations, and spellcheck

* Better sprites + animation timing

* Removes vestigial code
This commit is contained in:
PollardTheDragon
2025-09-18 17:36:00 +00:00
committed by GitHub
parent 5285e0ad52
commit 9797083cdd
13 changed files with 225 additions and 31 deletions
+22 -21
View File
@@ -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
+1 -2
View File
@@ -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"
+8 -4
View File
@@ -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
+8 -4
View File
@@ -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
+1
View File
@@ -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"
},
+4
View File
@@ -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
+2
View File
@@ -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)
. = ..()
@@ -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("<span class='notice'>[user] inserts [credit_slip] into [src].</span>")
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
+167
View File
@@ -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)
. = ..()
. += "<span class='notice'>There are currently [points] claimable points. [points ? "Swipe your ID to claim them." : ""]</span>"
/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, "<span class='warning'>The machine is currently processing salvage at the moment.</span>");
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/card/id))
var/obj/item/card/id/ID = used
if(!points)
to_chat(user, "<span class='warning'>There are no points to claim.</span>");
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, "<span class='notice'><b>[points] Salvage Points</b> claimed. You have earned a total of <b>[ID.total_mining_points] Salvage Points</b> this Shift!</span>")
points = 0
claimed = TRUE
break
if(!claimed)
to_chat(user, "<span class='warning'>Required access not found.</span>")
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, "<span class='warning'>You have no salvage to redeem.</span>");
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, "<span class='warning'>[used] is stuck to your hand!</span>")
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)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+1
View File
@@ -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"
Binary file not shown.