diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 5c92df10717..f4ec4f36dbb 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -866,7 +866,7 @@ name = "hand of cards" desc = "A number of cards not in a deck, customarily held in ones hand." icon = 'icons/obj/toy.dmi' - icon_state = "nanotrasen_hand2" + icon_state = "none" w_class = WEIGHT_CLASS_TINY var/list/currenthand = list() var/choice = null @@ -876,6 +876,7 @@ user.set_machine(src) interact(user) + /obj/item/toy/cards/cardhand/ui_interact(mob/user) . = ..() var/dat = "You have:
" @@ -887,7 +888,6 @@ popup.set_content(dat) popup.open() - /obj/item/toy/cards/cardhand/Topic(href, href_list) if(..()) return @@ -910,12 +910,7 @@ cardUser.visible_message("[cardUser] draws a card from [cardUser.p_their()] hand.", "You take the [C.cardname] from your hand.") interact(cardUser) - if(src.currenthand.len < 3) - src.icon_state = "[deckstyle]_hand2" - else if(src.currenthand.len < 4) - src.icon_state = "[deckstyle]_hand3" - else if(src.currenthand.len < 5) - src.icon_state = "[deckstyle]_hand4" + update_sprite() if(src.currenthand.len == 1) var/obj/item/toy/cards/singlecard/N = new/obj/item/toy/cards/singlecard(src.loc) N.parentdeck = src.parentdeck @@ -935,12 +930,7 @@ user.visible_message("[user] adds a card to [user.p_their()] hand.", "You add the [C.cardname] to your hand.") qdel(C) interact(user) - if(currenthand.len > 4) - src.icon_state = "[deckstyle]_hand5" - else if(currenthand.len > 3) - src.icon_state = "[deckstyle]_hand4" - else if(currenthand.len > 2) - src.icon_state = "[deckstyle]_hand3" + update_sprite(src) else to_chat(user, "You can't mix cards from other decks!") else @@ -949,7 +939,7 @@ /obj/item/toy/cards/cardhand/apply_card_vars(obj/item/toy/cards/newobj,obj/item/toy/cards/sourceobj) ..() newobj.deckstyle = sourceobj.deckstyle - newobj.icon_state = "[deckstyle]_hand2" // Another dumb hack, without this the hand is invisible (or has the default deckstyle) until another card is added. + update_sprite() newobj.card_hitsound = sourceobj.card_hitsound newobj.card_force = sourceobj.card_force newobj.card_throwforce = sourceobj.card_throwforce @@ -958,6 +948,18 @@ newobj.card_attack_verb = sourceobj.card_attack_verb newobj.resistance_flags = sourceobj.resistance_flags +/** + * This proc updates the sprite for when you create a hand of cards + */ +/obj/item/toy/cards/cardhand/proc/update_sprite() + cut_overlays() + var/overlay_cards = currenthand.len + + var/k = overlay_cards == 2 ? 1 : overlay_cards - 2 + for(var/i = k; i <= overlay_cards; i++) + var/card_overlay = image(icon=src.icon,icon_state="sc_[currenthand[i]]_[deckstyle]",pixel_x=(1-i+k)*3,pixel_y=(1-i+k)*3) + add_overlay(card_overlay) + /obj/item/toy/cards/singlecard name = "card" desc = "A playing card used to play card games like poker." @@ -1024,12 +1026,7 @@ user.visible_message("[user] adds a card to [user.p_their()] hand.", "You add the [cardname] to your hand.") qdel(src) H.interact(user) - if(H.currenthand.len > 4) - H.icon_state = "[deckstyle]_hand5" - else if(H.currenthand.len > 3) - H.icon_state = "[deckstyle]_hand4" - else if(H.currenthand.len > 2) - H.icon_state = "[deckstyle]_hand3" + H.update_sprite() else to_chat(user, "You can't mix cards from other decks!") else diff --git a/code/modules/games/kotahi.dm b/code/modules/games/kotahi.dm new file mode 100644 index 00000000000..d0fec6c6274 --- /dev/null +++ b/code/modules/games/kotahi.dm @@ -0,0 +1,20 @@ +/obj/item/toy/cards/deck/kotahi + name = "\improper KOTAHI deck" + desc = "A deck of kotahi cards. House rules to argue over not included." + icon = 'icons/obj/toy.dmi' + icon_state = "deck_kotahi_full" + deckstyle = "kotahi" + +//Populate the deck. +/obj/item/toy/cards/deck/kotahi/populate_deck() + for(var/colour in list("Red","Yellow","Green","Blue")) + cards += "[colour] 0" //kotahi decks have only one colour of each 0, weird huh? + for(var/k in 0 to 1) //two of each colour of number + cards += "[colour] skip" + cards += "[colour] reverse" + cards += "[colour] draw 2" + for(var/i in 1 to 9) + cards += "[colour] [i]" + for(var/k in 0 to 3) //4 wilds and draw 4s + cards += "Wildcard" + cards += "Draw 4" diff --git a/code/modules/vending/games.dm b/code/modules/vending/games.dm index 0670fa03b44..df1f9a85f90 100644 --- a/code/modules/vending/games.dm +++ b/code/modules/vending/games.dm @@ -7,6 +7,7 @@ /obj/item/storage/pill_bottle/dice = 10, /obj/item/toy/cards/deck/cas = 3, /obj/item/toy/cards/deck/cas/black = 3, + /obj/item/toy/cards/deck/kotahi = 3, /obj/item/hourglass = 2, /obj/item/instrument/piano_synth/headphones = 4, /obj/item/camera = 3) diff --git a/icons/obj/toy.dmi b/icons/obj/toy.dmi index bc7e86a0bfd..000709798a1 100644 Binary files a/icons/obj/toy.dmi and b/icons/obj/toy.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 724bee9a1a1..df96982a22e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1888,6 +1888,7 @@ #include "code\modules\food_and_drinks\recipes\tablecraft\recipes_soup.dm" #include "code\modules\food_and_drinks\recipes\tablecraft\recipes_spaghetti.dm" #include "code\modules\games\cas.dm" +#include "code\modules\games\kotahi.dm" #include "code\modules\goonchat\browserOutput.dm" #include "code\modules\holiday\easter.dm" #include "code\modules\holiday\hebrew_calendar.dm"