ead0e859db
This PR fixes a case where certain materials caused issues when working with stacking machines, because they did not have set merge_type from the get go, which meant that initial() of that variable returned null. To clarify further - if /obj/item/stack does not have set merge_type, it is generated merge_type upon Initialize(), which is the same as its typepath. For example, currently /obj/item/stack/sheet/bluespace_crystal does not have any merge_type set, and it is given merge_type = /obj/item/stack/sheet/bluespace_crystal upon Initialize(). Each Initialize(). Again and again. There are quite a bit of these cases in the codebase, especially if its some older code. I have gone through them and set all of them their set merge_type, which they would inevitably receive anyway upon initializing and it fixes a bug mentioned above. To prevent this happening again, I have also included unit test to check if merge types are set for stacks, included exceptions are usually abstract paths like /obj/item/stack/sheet/mineral, which contains zero behavior on its own and does not spawn unless done via admin tools.
34 lines
842 B
Plaintext
34 lines
842 B
Plaintext
/obj/item/stack/arcadeticket
|
|
name = "arcade tickets"
|
|
desc = "Wow! With enough of these, you could buy a bike! ...Pssh, yeah right."
|
|
singular_name = "arcade ticket"
|
|
icon_state = "arcade-ticket"
|
|
inhand_icon_state = "tickets"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
max_amount = 30
|
|
merge_type = /obj/item/stack/arcadeticket
|
|
|
|
/obj/item/stack/arcadeticket/Initialize(mapload, new_amount, merge = TRUE)
|
|
. = ..()
|
|
update_icon()
|
|
|
|
/obj/item/stack/arcadeticket/update_icon_state()
|
|
var/amount = get_amount()
|
|
switch(amount)
|
|
if(12 to INFINITY)
|
|
icon_state = "arcade-ticket_4"
|
|
if(6 to 12)
|
|
icon_state = "arcade-ticket_3"
|
|
if(2 to 6)
|
|
icon_state = "arcade-ticket_2"
|
|
else
|
|
icon_state = "arcade-ticket"
|
|
|
|
/obj/item/stack/arcadeticket/proc/pay_tickets()
|
|
amount -= 2
|
|
if (amount == 0)
|
|
qdel(src)
|
|
|
|
/obj/item/stack/arcadeticket/thirty
|
|
amount = 30
|