Skip to content

Commit

Permalink
[MIRROR] Logs holochip credits worth zero or less credits and prevent…
Browse files Browse the repository at this point in the history
…s 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 <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Feb 26, 2024
1 parent 8b75a3d commit 8c3120a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions code/datums/components/payment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion code/game/objects/items/credit_holochip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/neck/_neck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
var/true_price = round(price*profit_scaling)
to_chat(user, span_notice("[selling ? "Sold" : "Getting the price of"] [I], value: <b>[true_price]</b> credits[I.contents.len ? " (exportable contents included)" : ""].[profit_scaling < 1 && selling ? "<b>[round(price-true_price)]</b> 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."))

Expand Down
10 changes: 4 additions & 6 deletions code/modules/shuttle/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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." : ""]")
Expand Down

0 comments on commit 8c3120a

Please sign in to comment.