Skip to content

Commit

Permalink
Ports Tarot Cards, for Thematics:tm: (#9978)
Browse files Browse the repository at this point in the history
* Uhh, adds tarot cards that don't build?

* Fixes the issues

Works now! Just need to change sprites and names and descriptions and vendor stuff and loadout stuff and probably other stuff.

* Fixed runtime, added to vendors/loadout.

* Oops

* New Card Sprites, names, etc

* Forgor to change this

* I did a fucky wucky

Fixes Syndicate Playing Cards, and something to do with embeds?

* Fixed!!!

Unum exists again and the checks should work now

* Why am I like this

* WHY DOES IT STILL WORK WITH TWO #END DMI's???

* Why do I never check anything

Fixed issues, and now uploading a Big Testing Evidence Video shortly.
  • Loading branch information
WhereAmO authored Oct 9, 2023
1 parent b5549b4 commit 6857f48
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 95 deletions.
5 changes: 3 additions & 2 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@
#include "code\controllers\subsystem\zclear.dm"
#include "code\controllers\subsystem\zcopy.dm"
#include "code\controllers\subsystem\movement\ai_movement.dm"
#include "code\controllers\subsystem\movement\hyperspace_drift.dm"
#include "code\controllers\subsystem\movement\conveyors.dm"
#include "code\controllers\subsystem\movement\hyperspace_drift.dm"
#include "code\controllers\subsystem\movement\move_handler.dm"
#include "code\controllers\subsystem\movement\movement.dm"
#include "code\controllers\subsystem\movement\movement_types.dm"
Expand Down Expand Up @@ -2577,6 +2577,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\tarot.dm"
#include "code\modules\games\unum.dm"
#include "code\modules\holiday\easter.dm"
#include "code\modules\holiday\holidays.dm"
Expand Down Expand Up @@ -4070,8 +4071,8 @@
#include "code\modules\wiremod\components\string\tostring.dm"
#include "code\modules\wiremod\components\utility\clock.dm"
#include "code\modules\wiremod\components\utility\delay.dm"
#include "code\modules\wiremod\components\utility\iterator.dm"
#include "code\modules\wiremod\components\utility\getter.dm"
#include "code\modules\wiremod\components\utility\iterator.dm"
#include "code\modules\wiremod\components\utility\router.dm"
#include "code\modules\wiremod\components\utility\setter.dm"
#include "code\modules\wiremod\components\utility\typecast.dm"
Expand Down
180 changes: 87 additions & 93 deletions code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@
|| A Deck of Cards for playing various games of chance ||
*/



/obj/item/toy/cards
resistance_flags = FLAMMABLE
max_integrity = 50
Expand All @@ -690,7 +692,7 @@

/obj/item/toy/cards/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is slitting [user.p_their()] wrists with \the [src]! It looks like [user.p_they()] [user.p_have()] a crummy hand!</span>")
playsound(src, 'sound/items/cardshuffle.ogg', 50, 1)
playsound(src, 'sound/items/cardshuffle.ogg', 50, TRUE)
return BRUTELOSS

/obj/item/toy/cards/proc/apply_card_vars(obj/item/toy/cards/newobj, obj/item/toy/cards/sourceobj) // Applies variables for supporting multiple types of card deck
Expand All @@ -713,29 +715,15 @@
. = ..()
populate_deck()

///Generates all the cards within the deck.
/obj/item/toy/cards/deck/proc/populate_deck()
icon_state = "deck_[deckstyle]_full"
for(var/i in 2 to 10)
cards += "[i] of Hearts"
cards += "[i] of Spades"
cards += "[i] of Clubs"
cards += "[i] of Diamonds"
cards += "King of Hearts"
cards += "King of Spades"
cards += "King of Clubs"
cards += "King of Diamonds"
cards += "Queen of Hearts"
cards += "Queen of Spades"
cards += "Queen of Clubs"
cards += "Queen of Diamonds"
cards += "Jack of Hearts"
cards += "Jack of Spades"
cards += "Jack of Clubs"
cards += "Jack of Diamonds"
cards += "Ace of Hearts"
cards += "Ace of Spades"
cards += "Ace of Clubs"
cards += "Ace of Diamonds"
for(var/suit in list("Hearts", "Spades", "Clubs", "Diamonds"))
cards += "Ace of [suit]"
for(var/i in 2 to 10)
cards += "[i] of [suit]"
for(var/person in list("Jack", "Queen", "King"))
cards += "[person] of [suit]"

//ATTACK HAND IGNORING PARENT RETURN VALUE
//ATTACK HAND NOT CALLING PARENT
Expand All @@ -748,7 +736,7 @@
if(!(L.mobility_flags & MOBILITY_PICKUP))
return
var/choice = null
if(!LAZYLEN(cards))
if(cards.len == 0)
to_chat(user, "<span class='warning'>There are no more cards to draw!</span>")
return
var/obj/item/toy/cards/singlecard/H = new/obj/item/toy/cards/singlecard(user.loc)
Expand All @@ -759,25 +747,29 @@
H.parentdeck = src
var/O = src
H.apply_card_vars(H,O)
cards.Cut(1,2) //Removes the top card from the list
popleft(cards)
H.pickup(user)
user.put_in_hands(H)
user.visible_message("<span class='notice'>[user] draws a card from the deck.</span>", "<span class='notice'>You draw a card from the deck.</span>")
update_icon()

/obj/item/toy/cards/deck/update_icon()
if(LAZYLEN(cards) > original_size/2)
icon_state = "deck_[deckstyle]_full"
else if(LAZYLEN(cards) > original_size/4)
icon_state = "deck_[deckstyle]_half"
else if(LAZYLEN(cards))
icon_state = "deck_[deckstyle]_low"
else if(!LAZYLEN(cards))
icon_state = "deck_[deckstyle]_empty"
return H

/obj/item/toy/cards/deck/update_icon_state()
switch(cards.len)
if(27 to INFINITY)
icon_state = "deck_[deckstyle]_full"
if(11 to 27)
icon_state = "deck_[deckstyle]_half"
if(1 to 11)
icon_state = "deck_[deckstyle]_low"
else
icon_state = "deck_[deckstyle]_empty"
return ..()

/obj/item/toy/cards/deck/attack_self(mob/user)
if(cooldown < world.time - 50)
cards = shuffle(cards)
playsound(src, 'sound/items/cardshuffle.ogg', 50, 1)
playsound(src, 'sound/items/cardshuffle.ogg', 50, TRUE)
user.visible_message("<span class='notice'>[user] shuffles the deck.</span>", "<span class='notice'>You shuffle the deck.</span>")
cooldown = world.time

Expand Down Expand Up @@ -810,22 +802,22 @@
return ..()

/obj/item/toy/cards/deck/MouseDrop(atom/over_object)
. = ..()
var/mob/living/M = usr
if(!istype(M) || !(M.mobility_flags & MOBILITY_PICKUP))
return
if(Adjacent(usr))
if(over_object == M && loc != M)
M.put_in_hands(src)
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
. = ..()
var/mob/living/M = usr
if(!istype(M) || !(M.mobility_flags & MOBILITY_PICKUP))
return
if(Adjacent(usr))
if(over_object == M && loc != M)
M.put_in_hands(src)
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")

else if(istype(over_object, /atom/movable/screen/inventory/hand))
var/atom/movable/screen/inventory/hand/H = over_object
if(M.putItemFromInventoryInHandIfPossible(src, H.held_index))
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
else if(istype(over_object, /atom/movable/screen/inventory/hand))
var/atom/movable/screen/inventory/hand/H = over_object
if(M.putItemFromInventoryInHandIfPossible(src, H.held_index))
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")

else
to_chat(usr, "<span class='warning'>You can't reach it from here!</span>")
else
to_chat(usr, "<span class='warning'>You can't reach it from here!</span>")



Expand All @@ -838,56 +830,43 @@
var/list/currenthand = list()
var/choice = null


/obj/item/toy/cards/cardhand/attack_self(mob/user)
user.set_machine(src)
var/list/handradial = list()
interact(user)

/obj/item/toy/cards/cardhand/ui_interact(mob/user)
. = ..()
var/dat = "You have:<BR>"
for(var/t in currenthand)
dat += "<A href='?src=[REF(src)];pick=[t]'>A [t].</A><BR>"
dat += "Which card will you remove next?"
var/datum/browser/popup = new(user, "cardhand", "Hand of Cards", 400, 240)
popup.set_content(dat)
popup.open()

/obj/item/toy/cards/cardhand/Topic(href, href_list)
if(..())
return
handradial[t] = image(icon = src.icon, icon_state = "sc_[t]_[deckstyle]")

if(usr.stat || !ishuman(usr))
return
var/mob/living/carbon/human/cardUser = usr
if(!(cardUser.mobility_flags & MOBILITY_USE))
return
var/O = src
if(href_list["pick"])
if (cardUser.is_holding(src))
var/choice = href_list["pick"]
if(!(choice in src.currenthand))
log_href_exploit(usr)
return
var/obj/item/toy/cards/singlecard/C = new/obj/item/toy/cards/singlecard(cardUser.loc)
src.currenthand -= choice
C.parentdeck = src.parentdeck
C.cardname = choice
C.apply_card_vars(C,O)
cardUser.put_in_hands(C)
cardUser.visible_message("<span class='notice'>[cardUser] draws a card from [cardUser.p_their()] hand.</span>", "<span class='notice'>You take the [C.cardname] from your hand.</span>")

interact(cardUser)
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
N.cardname = src.currenthand[1]
N.apply_card_vars(N,O)
qdel(src)
cardUser.put_in_hands(N)
to_chat(cardUser, "<span class='notice'>You also take [currenthand[1]] and hold it.</span>")
cardUser << browse(null, "window=cardhand")
return
var/choice = show_radial_menu(usr,src, handradial, custom_check = CALLBACK(src, PROC_REF(check_menu), user), radius = 36, require_near = TRUE)
if(!choice)
return FALSE
var/obj/item/toy/cards/singlecard/C = new/obj/item/toy/cards/singlecard(cardUser.loc)
currenthand -= choice
handradial -= choice
C.parentdeck = parentdeck
C.cardname = choice
C.apply_card_vars(C,O)
C.pickup(cardUser)
cardUser.put_in_hands(C)
cardUser.visible_message("<span class='notice'>[cardUser] draws a card from [cardUser.p_their()] hand.</span>", "<span class='notice'>You take the [C.cardname] from your hand.</span>")

interact(cardUser)
update_sprite()
if(length(currenthand) == 1)
var/obj/item/toy/cards/singlecard/N = new/obj/item/toy/cards/singlecard(loc)
N.parentdeck = parentdeck
N.cardname = currenthand[1]
N.apply_card_vars(N,O)
qdel(src)
N.pickup(cardUser)
cardUser.put_in_hands(N)
to_chat(cardUser, "<span class='notice'>You also take [currenthand[1]] and hold it.</span>")

/obj/item/toy/cards/cardhand/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params)
if(istype(C))
Expand All @@ -914,6 +893,22 @@
newobj.card_attack_verb = sourceobj.card_attack_verb
newobj.resistance_flags = sourceobj.resistance_flags

/**
* check_menu: Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The mob interacting with a menu
*/
/obj/item/toy/cards/cardhand/proc/check_menu(mob/living/user)
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
return TRUE

/**
* 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
Expand All @@ -925,10 +920,10 @@

/obj/item/toy/cards/singlecard
name = "card"
desc = "a card"
desc = "A playing card used to play card games like poker."
icon = 'icons/obj/toy.dmi'
icon_state = "singlecard_down_nanotrasen"
w_class = WEIGHT_CLASS_SMALL
w_class = WEIGHT_CLASS_TINY
var/cardname = null
var/flipped = 0
pixel_x = -5
Expand Down Expand Up @@ -983,6 +978,7 @@
to_chat(user, "<span class='notice'>You combine the [C.cardname] and the [src.cardname] into a hand.</span>")
qdel(C)
qdel(src)
H.pickup(user)
user.put_in_active_hand(H)
else
to_chat(user, "<span class='warning'>You can't mix cards from other decks!</span>")
Expand Down Expand Up @@ -1022,11 +1018,9 @@
newobj.card_attack_verb = sourceobj.card_attack_verb
newobj.attack_verb = newobj.card_attack_verb


/*
|| Syndicate playing cards, for pretending you're Gambit and playing poker for the nuke disk. ||
*/

/obj/item/toy/cards/deck/syndicate
name = "suspicious looking deck of cards"
desc = "A deck of space-grade playing cards. They seem unusually rigid."
Expand Down
6 changes: 6 additions & 0 deletions code/modules/client/loadout/loadout_general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
path = /obj/item/toy/eightball
cost = 500

/datum/gear/misc/tarotdeck
display_name = "Tarot Deck"
description = "A full 78 card deck of Tarot Cards, no refunds on false predicitons."
path = /obj/item/toy/cards/deck/tarot
cost = 600

/datum/gear/misc/antagtoken
display_name = "Discount Antag Token"
description = "Says \"Made in China\" on the back. Seems fishy."
Expand Down
29 changes: 29 additions & 0 deletions code/modules/games/tarot.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//Some silly tarot cards for predicting when the Clown will die. Ported from TG. https://github.com/tgstation/tgstation/pull/51318/
/obj/item/toy/cards/deck/tarot
name = "Tarot Card Deck"
desc = "A full 78 card deck of Tarot Cards, no refunds on false predicitons."
icon = 'icons/obj/toy.dmi'
icon_state = "deck_tarot_full"
deckstyle = "tarot"

/obj/item/toy/cards/deck/tarot/populate_deck()
for(var/suit in list("Cups", "Wands", "Swords", "Coins"))
for(var/i in 1 to 10)
cards += "[i] of [suit]"
for(var/person in list("Page", "Champion", "Queen", "King"))
cards += "[person] of [suit]"
for(var/trump in list("The Magician", "The High Priestess", "The Empress", "The Emperor", "The Hierophant", "The Lover", "The Chariot", "Justice", "The Hermit", "The Wheel of Fortune", "Strength", "The Hanged Man", "Death", "Temperance", "The Devil", "The Tower", "The Star", "The Moon", "The Sun", "Judgement", "The World", "The Fool"))
cards += "[trump]"

/obj/item/toy/cards/deck/tarot/draw_card(mob/user)
. = ..()
if(prob(50))
var/obj/item/toy/cards/singlecard/C = .
if(!C)
return FALSE

var/matrix/M = matrix()
M.Turn(180)
C.transform = M


1 change: 1 addition & 0 deletions code/modules/vending/games.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/obj/item/toy/cards/deck/cas = 3,
/obj/item/toy/cards/deck/cas/black = 3,
/obj/item/toy/cards/deck/unum = 3,
/obj/item/toy/cards/deck/tarot = 3,
/obj/item/hourglass = 2)
contraband = list(/obj/item/dice/fudge = 9,
/obj/item/instrument/musicalmoth = 1)
Expand Down
Binary file modified icons/obj/toy.dmi
Binary file not shown.

0 comments on commit 6857f48

Please sign in to comment.