Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

148 lines
4.4 KiB
Plaintext

/obj/item/stack/spacecash //Don't use base space cash stacks. Any other space cash stack can merge with them, and could cause potential money duping exploits.
name = "space cash"
singular_name = "bill"
icon = 'icons/obj/economy.dmi'
icon_state = null
worn_icon_state = "nothing"
amount = 1
max_amount = INFINITY
throwforce = 0
throw_speed = 2
throw_range = 2
w_class = WEIGHT_CLASS_TINY
full_w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
var/value = 0
/obj/item/stack/spacecash/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
. = ..()
add_traits(list(TRAIT_FISHING_BAIT, TRAIT_BAIT_ALLOW_FISHING_DUD), INNATE_TRAIT)
update_desc()
/obj/item/stack/spacecash/grind_results()
return list(/datum/reagent/cellulose = 10)
/obj/item/stack/spacecash/update_desc()
. = ..()
var/total_worth = get_item_credit_value()
desc = "It's worth [total_worth] [MONEY_NAME_AUTOPURAL(total_worth)] in total."
/obj/item/stack/spacecash/get_item_credit_value()
return (amount*value)
/obj/item/stack/spacecash/merge(obj/item/stack/target_stack, limit)
. = ..()
update_desc()
/obj/item/stack/spacecash/use(used, transfer = FALSE, check = TRUE)
. = ..()
update_desc()
/obj/item/stack/spacecash/update_icon_state()
. = ..()
switch(amount)
if(1)
icon_state = initial(icon_state)
if(2 to 9)
icon_state = "[initial(icon_state)]_2"
if(10 to 24)
icon_state = "[initial(icon_state)]_3"
if(25 to INFINITY)
icon_state = "[initial(icon_state)]_4"
/**
* Takes an amount of credit and returns a list of space cash typepaths that are equivalent to that amount.
* For example, if you passed 450 credits, it would return a list with a c200, another c200, and a c50 space cash stack typepath.
* You can then use the list to new() all the types provided if you wanted to give a player that amount in space cash.
*
* * amount - the amount of credits to convert to space cash.
* If you provide a decimal, rounds down to the nearest whole number.
*/
/proc/credits_to_spacecash(amount)
amount = floor(amount)
// ordered by value so we can always provide the highest denominations possible
var/list/spacecash_types_by_value = list(
/obj/item/stack/spacecash/c10000,
/obj/item/stack/spacecash/c1000,
/obj/item/stack/spacecash/c500,
/obj/item/stack/spacecash/c200,
/obj/item/stack/spacecash/c100,
/obj/item/stack/spacecash/c50,
/obj/item/stack/spacecash/c20,
/obj/item/stack/spacecash/c10,
/obj/item/stack/spacecash/c1,
)
var/list/spacecash_list = list()
while(amount > 0)
var/obj/item/stack/spacecash/found_cashtype
for(var/obj/item/stack/spacecash/cashtype as anything in spacecash_types_by_value)
if(cashtype::value <= amount)
found_cashtype = cashtype
break
if(!found_cashtype)
stack_trace("credits_to_spacecash failed to find a cashtype for amount: [amount]")
break
spacecash_list += found_cashtype
amount -= found_cashtype::value
if(amount > 0)
stack_trace("credits_to_spacecash failed to convert [amount] credits into space cash. Remaining amount: [amount]")
return spacecash_list
/obj/item/stack/spacecash/c1
icon_state = "spacecash1"
singular_name = "one credit bill"
value = 1
merge_type = /obj/item/stack/spacecash/c1
/obj/item/stack/spacecash/c10
icon_state = "spacecash10"
singular_name = "ten credit bill"
value = 10
merge_type = /obj/item/stack/spacecash/c10
/obj/item/stack/spacecash/c20
icon_state = "spacecash20"
singular_name = "twenty credit bill"
value = 20
merge_type = /obj/item/stack/spacecash/c20
/obj/item/stack/spacecash/c50
icon_state = "spacecash50"
singular_name = "fifty credit bill"
value = 50
merge_type = /obj/item/stack/spacecash/c50
/obj/item/stack/spacecash/c100
icon_state = "spacecash100"
singular_name = "one hundred credit bill"
value = 100
merge_type = /obj/item/stack/spacecash/c100
/obj/item/stack/spacecash/c200
icon_state = "spacecash200"
singular_name = "two hundred credit bill"
value = 200
merge_type = /obj/item/stack/spacecash/c200
/obj/item/stack/spacecash/c500
icon_state = "spacecash500"
singular_name = "five hundred credit bill"
value = 500
merge_type = /obj/item/stack/spacecash/c500
/obj/item/stack/spacecash/c1000
icon_state = "spacecash1000"
singular_name = "one thousand credit bill"
value = 1000
merge_type = /obj/item/stack/spacecash/c1000
/obj/item/stack/spacecash/c10000
icon_state = "spacecash10000"
singular_name = "ten thousand credit bill"
value = 10000
merge_type = /obj/item/stack/spacecash/c10000