Skip to content

Commit

Permalink
Merge pull request #8815 from Atermonera/badassery_runtimes
Browse files Browse the repository at this point in the history
Fix runtimes with uplink random item selections
  • Loading branch information
Spookerton authored Nov 3, 2022
2 parents 2a42eca + bfd5208 commit 263f84d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions code/datums/uplink/badassery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@
name = "Random Items"
desc = "Buys you as many random items you can afford. Convenient packaging NOT included."

/datum/uplink_item/item/badassery/random_many/cost(obj/item/uplink/U, var/telecrystals)
return max(1, telecrystals)
/datum/uplink_item/item/badassery/random_many/cost(obj/item/uplink/U, mob/M)
if(istype(M))
return max(1, M.mind?.tcrystals)
if(istype(M, /datum/mind))
var/datum/mind/m = M
return max(1, m.tcrystals)
return max(1, M)

/datum/uplink_item/item/badassery/random_many/get_goods(var/obj/item/uplink/U, var/loc, var/mob/M)
var/list/bought_items = list()
Expand Down
4 changes: 2 additions & 2 deletions code/datums/uplink/uplink_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ var/global/datum/uplink/uplink = new()
if(!I)
break
bought_items += I
remaining_TC -= I.cost(remaining_TC, U)
remaining_TC -= I.cost(U, remaining_TC)

return bought_items

Expand All @@ -198,6 +198,6 @@ var/global/datum/uplink/uplink = new()
if(!I)
break
bought_items += I
remaining_TC -= I.cost(remaining_TC, U)
remaining_TC -= I.cost(U, remaining_TC)

return bought_items

0 comments on commit 263f84d

Please sign in to comment.