From 28a2a2f2a1b36176e6b7816b10b7f40814c53e35 Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 17 Dec 2023 15:45:03 +0000 Subject: [PATCH 1/4] card fixes --- code/game/objects/items/toys/cards.dm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/game/objects/items/toys/cards.dm b/code/game/objects/items/toys/cards.dm index 2debd83f9bab..522631e933a4 100644 --- a/code/game/objects/items/toys/cards.dm +++ b/code/game/objects/items/toys/cards.dm @@ -271,6 +271,10 @@ if(!concealed) . += " ([length(cards)] card\s)" +/obj/item/toy/handcard/Destroy(force) + . = ..() + cards = null + /obj/item/toy/handcard/aceofspades icon_state = "spades_ace" desc = "An Ace of Spades" @@ -390,6 +394,8 @@ /obj/item/toy/handcard/MouseDrop(atom/over) if(usr != over || !Adjacent(usr)) return + if(ismob(loc)) + return usr.put_in_hands(src) /obj/item/toy/handcard/get_examine_text(mob/user) @@ -423,6 +429,12 @@ name = "a playing card" desc = "A playing card." + if(length(cards) >= 200) + // BYOND will flat out choke when using thousands of cards for some unknown reason, + // possibly due to the transformed overlay stacking below. Nobody's gonna see the + // difference past 40 or so anyway. + return + overlays.Cut() if(!cards_length) From 1268fd6d8292f9236f8ca5e44319e7c0c2e075cd Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 17 Dec 2023 16:31:46 +0000 Subject: [PATCH 2/4] more stuff --- code/game/objects/items/toys/cards.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/game/objects/items/toys/cards.dm b/code/game/objects/items/toys/cards.dm index 522631e933a4..aceba7811b2a 100644 --- a/code/game/objects/items/toys/cards.dm +++ b/code/game/objects/items/toys/cards.dm @@ -30,6 +30,10 @@ . = ..() populate_deck() +/obj/item/toy/deck/Destroy(force) + . = ..() + cards = null + /obj/item/toy/deck/get_examine_text(mob/user) . = ..() . += SPAN_NOTICE("There are [length(cards)] cards remaining in the deck.") @@ -319,6 +323,9 @@ //fuck any qsorts and merge sorts. This needs to be brutally easy var/cards_length = length(cards) + if(cards_length >= 200) + to_chat(usr, SPAN_WARNING("Hand is too big to sort. Remove some cards.")) + return for(var/i = 1 to cards_length) for(var/k = 2 to cards_length) if(cards[i].sort_index > cards[k].sort_index) From 7d2eae3387d695b5b66b748a78389939066d52b9 Mon Sep 17 00:00:00 2001 From: Fira Date: Fri, 29 Dec 2023 16:55:50 +0000 Subject: [PATCH 3/4] qdel changes --- code/game/objects/items/toys/cards.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/toys/cards.dm b/code/game/objects/items/toys/cards.dm index aceba7811b2a..ebb2320146e9 100644 --- a/code/game/objects/items/toys/cards.dm +++ b/code/game/objects/items/toys/cards.dm @@ -32,7 +32,7 @@ /obj/item/toy/deck/Destroy(force) . = ..() - cards = null + QDEL_NULL_LIST(cards) /obj/item/toy/deck/get_examine_text(mob/user) . = ..() @@ -79,6 +79,7 @@ var/obj/item/toy/handcard/H = O for(var/datum/playing_card/P as anything in H.cards) cards += P + H.cards -= P update_icon() qdel(O) user.visible_message(SPAN_NOTICE("[user] places their cards on the bottom of \the [src]."), SPAN_NOTICE("You place your cards on the bottom of the deck.")) @@ -324,7 +325,7 @@ //fuck any qsorts and merge sorts. This needs to be brutally easy var/cards_length = length(cards) if(cards_length >= 200) - to_chat(usr, SPAN_WARNING("Hand is too big to sort. Remove some cards.")) + to_chat(usr, SPAN_WARNING("Your hand is too big to sort. Remove some cards.")) return for(var/i = 1 to cards_length) for(var/k = 2 to cards_length) @@ -342,6 +343,7 @@ var/cards_length = length(H.cards) for(var/datum/playing_card/P in H.cards) cards += P + H.cards -= P qdel(O) if(pile_state) if(concealed) From 3b08cf34e4c5a7823fea3f7abea2cb58a5423253 Mon Sep 17 00:00:00 2001 From: Fira Date: Fri, 29 Dec 2023 16:59:02 +0000 Subject: [PATCH 4/4] oopsie --- code/game/objects/items/toys/cards.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/toys/cards.dm b/code/game/objects/items/toys/cards.dm index ebb2320146e9..697feaf857f5 100644 --- a/code/game/objects/items/toys/cards.dm +++ b/code/game/objects/items/toys/cards.dm @@ -278,7 +278,7 @@ /obj/item/toy/handcard/Destroy(force) . = ..() - cards = null + QDEL_NULL_LIST(cards) /obj/item/toy/handcard/aceofspades icon_state = "spades_ace"