From 8c3120aca738adb5999496cd9d84e2de228e431b Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:29:17 -0500 Subject: [PATCH] [MIRROR] Logs holochip credits worth zero or less credits and prevents them from spawning. (#1139) * Logs holochip credits worth zero or less credits and prevents them from spawning. (#81605) * Logs holochip credits worth zero or less credits and prevents them from spawning. --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> --- code/datums/components/payment.dm | 3 +-- code/game/objects/items/credit_holochip.dm | 5 ++++- code/modules/clothing/neck/_neck.dm | 2 +- code/modules/shuttle/special.dm | 10 ++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/datums/components/payment.dm b/code/datums/components/payment.dm index 005cd1fe03e..1220614e9c3 100644 --- a/code/datums/components/payment.dm +++ b/code/datums/components/payment.dm @@ -114,8 +114,7 @@ physical_cash_total -= total_cost if(physical_cash_total > 0) - var/obj/item/holochip/holochange = new /obj/item/holochip(user.loc) //Change is made in holocredits exclusively. - holochange.credits = physical_cash_total + var/obj/item/holochip/holochange = new /obj/item/holochip(user.loc, physical_cash_total) //Change is made in holocredits exclusively. holochange.name = "[holochange.credits] credit holochip" if(ishuman(user)) var/mob/living/carbon/human/paying_customer = user diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index eecef73fd43..8e9fb78172f 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -9,10 +9,13 @@ w_class = WEIGHT_CLASS_TINY var/credits = 0 -/obj/item/holochip/Initialize(mapload, amount) +/obj/item/holochip/Initialize(mapload, amount = 1) . = ..() if(amount) credits = amount + if(credits <= 0 && !mapload) + stack_trace("Holochip created with 0 or less credits in [get_area_name(src)]!") + return INITIALIZE_HINT_QDEL update_appearance() /obj/item/holochip/examine(mob/user) diff --git a/code/modules/clothing/neck/_neck.dm b/code/modules/clothing/neck/_neck.dm index a4c6393ed6f..93f6e8d15fc 100644 --- a/code/modules/clothing/neck/_neck.dm +++ b/code/modules/clothing/neck/_neck.dm @@ -469,7 +469,7 @@ var/true_price = round(price*profit_scaling) to_chat(user, span_notice("[selling ? "Sold" : "Getting the price of"] [I], value: [true_price] credits[I.contents.len ? " (exportable contents included)" : ""].[profit_scaling < 1 && selling ? "[round(price-true_price)] credit\s taken as processing fee\s." : ""]")) if(selling) - new /obj/item/holochip(get_turf(user),true_price) + new /obj/item/holochip(get_turf(user), true_price) else to_chat(user, span_warning("There is no export value for [I] or any items within it.")) diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index e5b8d5e87ff..d9240285991 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -378,15 +378,13 @@ var/change = FALSE if(payees[AM] > 0) change = TRUE - var/obj/item/holochip/HC = new /obj/item/holochip(AM.loc) //Change is made in holocredits exclusively. - HC.credits = payees[AM] - HC.name = "[HC.credits] credit holochip" + var/obj/item/holochip/holocred = new /obj/item/holochip(AM.loc, payees[AM]) //Change is made in holocredits exclusively. if(ishuman(AM)) var/mob/living/carbon/human/H = AM - if(!H.put_in_hands(HC)) - AM.pulling = HC + if(!H.put_in_hands(holocred)) + AM.pulling = holocred else - AM.pulling = HC + AM.pulling = holocred payees[AM] -= payees[AM] say("Welcome to first class, [driver_holdout ? "[driver_holdout]" : "[AM]" ]![change ? " Here is your change." : ""]")