From da31fd3b5c6f280954434a7f952ea4cfb3717482 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Sun, 27 Apr 2025 16:34:48 -0700 Subject: [PATCH] [MIRROR] Recycler hotfix 1 (#10795) Co-authored-by: eghughguhhhhhh --- .../maint_recycler/code/maint_vendor.dm | 6 +++- .../vendor_datums/entries/hangout_entries.dm | 3 +- .../vendor_datums/entries/weapons_and_arms.dm | 6 ++-- .../vendor_datums/recycler_vendor_entry.dm | 2 ++ code/modules/mob/living/silicon/pai/pai.dm | 1 - code/unit_tests/recycler_vendor_tests.dm | 30 +++++++++++++++++++ vorestation.dme | 1 + 7 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 code/unit_tests/recycler_vendor_tests.dm diff --git a/code/modules/maint_recycler/code/maint_vendor.dm b/code/modules/maint_recycler/code/maint_vendor.dm index 8345f92d13..afe268b8ce 100644 --- a/code/modules/maint_recycler/code/maint_vendor.dm +++ b/code/modules/maint_recycler/code/maint_vendor.dm @@ -1,5 +1,5 @@ /obj/machinery/maint_vendor - name = "Decrepit Machine" + name = "Large Decrepit Machine" desc = "A long since abandoned \"trash 4 cash\" rewards kiosk. Now featuring a state of the art, monochrome holographic tube display!" icon = 'code/modules/maint_recycler/icons/maint_vendor.dmi' icon_state = "default" @@ -111,6 +111,10 @@ return /obj/machinery/maint_vendor/proc/dispense_item_from_datum(var/mob/user, var/datum/maint_recycler_vendor_entry/used_entry) + if(!used_entry || !used_entry.object_type_to_spawn) + to_chat(user,span_warning("What the fuck?? this is a scam! Nothing happened!")) + return; + playsound(src, 'code/modules/maint_recycler/sfx/ejectgoodies.ogg', 75, 1) used_entry.spawn_with_delay(src); audible_message("[src] states, \"[used_entry.tagline]\" ", "\The [src]'s screen briefly flashes an $!" , runemessage = "$$$") diff --git a/code/modules/maint_recycler/code/vendor_datums/entries/hangout_entries.dm b/code/modules/maint_recycler/code/vendor_datums/entries/hangout_entries.dm index 1048630dda..c820b3e4fc 100644 --- a/code/modules/maint_recycler/code/vendor_datums/entries/hangout_entries.dm +++ b/code/modules/maint_recycler/code/vendor_datums/entries/hangout_entries.dm @@ -11,13 +11,14 @@ /datum/maint_recycler_vendor_entry/DIY_HardWood //this one writes itself name = "Hard... Knotty Wood... " - desc = "Seriously! this tree sucked! Unusuable for professional construction due to how hard the knots are, the savings are passed onto YOU!!!" + desc = "Seriously! this tree sucked! unsuitable for professional construction due to how hard the knots are, the savings (and various aches and pains) are passed onto YOU!!!" tagline = "Hehehehehe" ad_message = "🤤" icon_state = "knotty_wood" vendor_category = MAINTVENDOR_CONSTRUCTION per_person_cap = 1 per_round_cap = 3 //limited supply! + object_type_to_spawn = /obj/item/stack/material/wood/hard{amount = 20} /datum/maint_recycler_vendor_entry/DIY_Steel diff --git a/code/modules/maint_recycler/code/vendor_datums/entries/weapons_and_arms.dm b/code/modules/maint_recycler/code/vendor_datums/entries/weapons_and_arms.dm index a80d456700..cb134423ef 100644 --- a/code/modules/maint_recycler/code/vendor_datums/entries/weapons_and_arms.dm +++ b/code/modules/maint_recycler/code/vendor_datums/entries/weapons_and_arms.dm @@ -40,6 +40,7 @@ item_cost = 25 per_person_cap = 1 vendor_category = MAINTVENDOR_WEAPONS + object_type_to_spawn = /obj/item/gun/projectile/shotgun/pump/toy /datum/maint_recycler_vendor_entry/sword name = "SORD" @@ -48,6 +49,7 @@ item_cost = 15 per_person_cap = 2 //ARES. MY LIFE IS YOURS. vendor_category = MAINTVENDOR_WEAPONS + object_type_to_spawn = /obj/item/material/sword/foam /datum/maint_recycler_vendor_entry/shark name = "BLOOD REACTIVE BIO-ORGANIC MISSILE" @@ -57,10 +59,10 @@ object_type_to_spawn = /obj/item/toy/plushie/shark vendor_category = MAINTVENDOR_WEAPONS -/datum/maint_recycler_vendor_entry/shark/post_purchase_handling(obj/bought) +/datum/maint_recycler_vendor_entry/shark/post_purchase_handling(obj/bought) //mostly an example of use . = ..() var/primary = pick("blood","dark","evil","s0ul","death","kill","fr4g","stab","torture","pain","shadow","tear","revenge") var/secondary = pick("claw","fang","blade","sword","tooth","murder","laser","montage") - bought.name = "Bio-Missile [primary][secondary]" + bought.name = "Bio-Missile [primary]-[secondary]" bought.desc = "What the fuck?" bought.color = "#880808" //blood red diff --git a/code/modules/maint_recycler/code/vendor_datums/recycler_vendor_entry.dm b/code/modules/maint_recycler/code/vendor_datums/recycler_vendor_entry.dm index 57c5159e1c..7d749ae1ef 100644 --- a/code/modules/maint_recycler/code/vendor_datums/recycler_vendor_entry.dm +++ b/code/modules/maint_recycler/code/vendor_datums/recycler_vendor_entry.dm @@ -18,6 +18,8 @@ var/vendor_category = MAINTVENDOR_GENERIC var/icon_state + var/is_scam = FALSE //if we spawn nothing, this needs to be true - special handling for this in the vendor later. + /datum/maint_recycler_vendor_entry/proc/initialize() if(!icon_state) icon_state = "generic[rand(1,10)]" diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 7e11351ee4..6b166911e6 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -146,7 +146,6 @@ var/datum/data/pda/app/messenger/M = pda.find_program(/datum/data/pda/app/messenger) if(M) M.toff = FALSE - . = ..() /mob/living/silicon/pai/Login() ..() diff --git a/code/unit_tests/recycler_vendor_tests.dm b/code/unit_tests/recycler_vendor_tests.dm new file mode 100644 index 0000000000..2a3ace9144 --- /dev/null +++ b/code/unit_tests/recycler_vendor_tests.dm @@ -0,0 +1,30 @@ +/datum/unit_test/recycler_vendor_entry_invalid + name = "RECYCLER: Recycler Vendor Entry shall have valid definitions" + +/datum/unit_test/recycler_vendor_entry_invalid/start_test() + var/failed = FALSE + + + + for(var/datum/maint_recycler_vendor_entry/R in subtypesof(/datum/maint_recycler_vendor_entry)) + var/item_to_spawn = initial(R.object_type_to_spawn) + var/item_cost = initial(R.item_cost) + var/global_item_cap = initial(R.per_round_cap) + var/individual_item_cap = initial(R.per_person_cap) + var/is_scam = initial(R.is_scam) + if(!item_to_spawn && !is_scam) + log_unit_test("[R] : Vendor Entry - Missing Object Type on non-scam entry") + failed = TRUE + if(item_cost < 0) + log_unit_test("[R] : Vendor Entry - Negative Cost") + failed = TRUE + if((item_cost == 0) && ((global_item_cap < 0)&&(individual_item_cap < 0))) //nobody SHOULD set the cost to 0 but it's possible i guess. maybe for future scams + log_unit_test("[R] : Vendor Entry - Infinite Item Spawning due to no individual or global item cap") + failed = TRUE + + if(failed) + fail("One or more /datum/maint_recycler_vendor_entry had invalid results or definitions.") + else + pass("All /datum/maint_recycler_vendor_entry subtypes had correct settings.") + + return TRUE diff --git a/vorestation.dme b/vorestation.dme index 9f839a5754..4179ba86bc 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -4769,6 +4769,7 @@ #include "code\unit_tests\mob_tests.dm" #include "code\unit_tests\reagent_tests.dm" #include "code\unit_tests\recipe_tests.dm" +#include "code\unit_tests\recycler_vendor_tests.dm" #include "code\unit_tests\research_tests.dm" #include "code\unit_tests\robot_tests.dm" #include "code\unit_tests\sqlite_tests.dm"