Files
VOREStation/code/modules/economy/cash.dm
T
Cameron Lennox d5849910e5 Begin clickcode attack_self fix (#18797)
* Begin clickcode attack_self fix

Begins the work to make everything call back to parent for attack_self so that signals are sacred.

* Makes MORE things call the attack_self() parent

Yes, I could make special_handling a var on obj/item HOWEVER i want it to be specific so it can be tracked down later and ONLY the objects that use it can be refactored instead of sitting there literally forever and it just becoming 'a thing'.

* Finishes making the rest of attack_self call parent.

As mentioned, things such as 'specialty_goggles' 'special_handling' and the such are only there to help with attack_self until the attack_self is recoded for those items.

* begone foul demon

* some more cleanup

* These

* GOD this was annoying

* yeh

* Fix this

* fLARES

* Thesee too

* toys!

* Even more!

* More fixes

* Even more

* rest of em

* these too

* Update syndie.dm

* hardref clear

* Update code/game/gamemodes/nuclear/pinpointer.dm

* Update code/game/objects/effects/mines.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/contraband_vr.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox_vr.dm

* Update code/game/objects/items/gunbox_vr.dm

* Update code/game/objects/items/weapons/gift_wrappaper.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* these too

* Update maintpanel_stack.dm

* angry warning

* Fixes packaged snacks.

Fixes improper var default.

* Special handling for these

* proper poly types

* Fixes magclaws

Makes the 'features' it had just part  of base magboots that can be adjusted via varswap.

* Fixes jackets

Fixes https://github.com/VOREStation/VOREStation/issues/18941

* Small bugfix

Makes p_Theyre properly capitialize
Makes examine show proper wording

* Update gift_wrappaper.dm
2025-12-29 13:21:10 -05:00

188 lines
4.8 KiB
Plaintext

/obj/item/spacecash
name = "0 Thaler"
var/initial_name = "Thaler"
desc = "It's worth 0 Thalers."
gender = PLURAL
icon = 'icons/obj/economy.dmi'
icon_state = "spacecash1"
opacity = 0
density = FALSE
anchored = FALSE
force = 1.0
throwforce = 1.0
throw_speed = 1
throw_range = 2
w_class = ITEMSIZE_SMALL
var/access = list()
access = ACCESS_CRATE_CASH
var/worth = 0
drop_sound = 'sound/items/drop/paper.ogg'
pickup_sound = 'sound/items/pickup/paper.ogg'
///Var for attack_self chain
var/special_handling = FALSE
/obj/item/spacecash/Initialize(mapload)
. = ..()
AddElement(/datum/element/sellable/spacecash)
/obj/item/spacecash/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/spacecash))
if(istype(W, /obj/item/spacecash/ewallet)) return 0
var/obj/item/spacecash/SC = W
SC.adjust_worth(src.worth)
if(ishuman(user))
var/mob/living/carbon/human/h_user = user
h_user.drop_from_inventory(src)
h_user.drop_from_inventory(SC)
h_user.put_in_hands(SC)
to_chat(user, span_notice("You combine the [initial_name]s to a bundle of [SC.worth] [initial_name]s."))
qdel(src)
/obj/item/spacecash/update_icon()
cut_overlays()
name = "[worth] [initial_name]\s"
if(worth in list(1000,500,200,100,50,20,10,5,1))
icon_state = "spacecash[worth]"
desc = "It's worth [worth] [initial_name]s."
return
var/sum = src.worth
var/num = 0
for(var/i in list(1000,500,200,100,50,20,10,5,1))
while(sum >= i && num < 50)
sum -= i
num++
var/image/banknote = image('icons/obj/economy.dmi', "spacecash[i]")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
add_overlay(banknote)
if(num == 0) // Less than one thaler, let's just make it look like 1 for ease
var/image/banknote = image('icons/obj/economy.dmi', "spacecash1")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
add_overlay(banknote)
src.desc = "They are worth [worth] [initial_name]s."
/obj/item/spacecash/proc/adjust_worth(var/adjust_worth = 0, var/update = 1)
worth += adjust_worth
if(worth > 0)
if(update)
update_icon()
return worth
else
qdel(src)
return 0
/obj/item/spacecash/proc/set_worth(var/new_worth = 0, var/update = 1)
worth = max(0, new_worth)
if(update)
update_icon()
return worth
/obj/item/spacecash/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
var/amount = tgui_input_number(user, "How many [initial_name]s do you want to take? (0 to [src.worth])", "Take Money", 20, src.worth)
if(!src || QDELETED(src))
return
amount = round(CLAMP(amount, 0, src.worth))
if(!amount)
return
adjust_worth(-amount)
var/obj/item/spacecash/SC = new (user.loc)
SC.set_worth(amount)
user.put_in_hands(SC)
/obj/item/spacecash/c1
name = "1 Thaler"
icon_state = "spacecash1"
desc = "It's worth 1 Thaler."
worth = 1
/obj/item/spacecash/c5
name = "5 Thaler"
icon_state = "spacecash5"
desc = "It's worth 5 Thalers."
worth = 5
/obj/item/spacecash/c10
name = "10 Thaler"
icon_state = "spacecash10"
desc = "It's worth 10 Thalers."
worth = 10
/obj/item/spacecash/c20
name = "20 Thaler"
icon_state = "spacecash20"
desc = "It's worth 20 Thalers."
worth = 20
/obj/item/spacecash/c50
name = "50 Thaler"
icon_state = "spacecash50"
desc = "It's worth 50 Thalers."
worth = 50
/obj/item/spacecash/c100
name = "100 Thaler"
icon_state = "spacecash100"
desc = "It's worth 100 Thalers."
worth = 100
/obj/item/spacecash/c200
name = "200 Thaler"
icon_state = "spacecash200"
desc = "It's worth 200 Thalers."
worth = 200
/obj/item/spacecash/c500
name = "500 Thaler"
icon_state = "spacecash500"
desc = "It's worth 500 Thalers."
worth = 500
/obj/item/spacecash/c1000
name = "1000 Thaler"
icon_state = "spacecash1000"
desc = "It's worth 1000 Thalers."
worth = 1000
/proc/spawn_money(var/sum, spawnloc, mob/living/carbon/human/human_user as mob)
var/obj/item/spacecash/SC = new (spawnloc)
SC.set_worth(sum)
if (ishuman(human_user) && !human_user.get_active_hand())
human_user.put_in_hands(SC)
return
/obj/item/spacecash/ewallet
name = "charge card"
initial_name = "charge card"
icon_state = "efundcard"
desc = "A card that holds an amount of money."
drop_sound = 'sound/items/drop/card.ogg'
pickup_sound = 'sound/items/pickup/card.ogg'
var/owner_name = "" //So the ATM can set it so the EFTPOS can put a valid name on transactions.
special_handling = TRUE
/obj/item/spacecash/ewallet/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
/obj/item/spacecash/ewallet/attackby() return //like actual
/obj/item/spacecash/ewallet/update_icon() return //space cash
/obj/item/spacecash/ewallet/examine(mob/user)
. = ..()
if(Adjacent(user))
. += span_notice("Charge card's owner: [src.owner_name]. Thalers remaining: [src.worth].")