mirror of
https://github.com/quotefox/Hyper-Station-13.git
synced 2026-07-18 19:22:43 +01:00
cards part 1
This commit is contained in:
+92
-92
@@ -55,104 +55,104 @@
|
||||
P.name = "Blank Card"
|
||||
P.card_icon = "cas_white"
|
||||
cards += P
|
||||
shuffle_inplace(cards) // distribute blank cards throughout deck
|
||||
// shuffle_inplace(cards) // distribute blank cards throughout deck
|
||||
|
||||
/obj/item/toy/cards/deck/cas/draw_card(mob/user)
|
||||
if(user.lying)
|
||||
return
|
||||
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/cas/H = new/obj/item/toy/cards/singlecard/cas(user.loc)
|
||||
var/datum/playingcard/choice = cards[1]
|
||||
if (choice.name == "Blank Card")
|
||||
H.blank = 1
|
||||
H.name = choice.name
|
||||
H.buffertext = choice.name
|
||||
H.icon_state = choice.card_icon
|
||||
H.card_face = choice.card_icon
|
||||
H.parentdeck = src
|
||||
src.cards -= choice
|
||||
H.pickup(user)
|
||||
user.put_in_hands(H)
|
||||
user.visible_message("[user] draws a card from the deck.", "<span class='notice'>You draw a card from the deck.</span>")
|
||||
update_icon()
|
||||
// /obj/item/toy/cards/deck/cas/draw_card(mob/user)
|
||||
// if(user.lying)
|
||||
// return
|
||||
// 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/cas/H = new/obj/item/toy/cards/singlecard/cas(user.loc)
|
||||
// var/datum/playingcard/choice = cards[1]
|
||||
// if (choice.name == "Blank Card")
|
||||
// H.blank = 1
|
||||
// H.name = choice.name
|
||||
// H.buffertext = choice.name
|
||||
// H.icon_state = choice.card_icon
|
||||
// H.card_face = choice.card_icon
|
||||
// H.parentdeck = src
|
||||
// src.cards -= choice
|
||||
// H.pickup(user)
|
||||
// user.put_in_hands(H)
|
||||
// user.visible_message("[user] draws a card from the deck.", "<span class='notice'>You draw a card from the deck.</span>")
|
||||
// update_icon()
|
||||
|
||||
/obj/item/toy/cards/deck/cas/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/toy/cards/singlecard/cas))
|
||||
var/obj/item/toy/cards/singlecard/cas/SC = I
|
||||
if(!user.temporarilyRemoveItemFromInventory(SC))
|
||||
to_chat(user, "<span class='warning'>The card is stuck to your hand, you can't add it to the deck!</span>")
|
||||
return
|
||||
var/datum/playingcard/RC // replace null datum for the re-added card
|
||||
RC = new()
|
||||
RC.name = "[SC.name]"
|
||||
RC.card_icon = SC.card_face
|
||||
cards += RC
|
||||
user.visible_message("[user] adds a card to the bottom of the deck.","<span class='notice'>You add the card to the bottom of the deck.</span>")
|
||||
qdel(SC)
|
||||
update_icon()
|
||||
// /obj/item/toy/cards/deck/cas/attackby(obj/item/I, mob/living/user, params)
|
||||
// if(istype(I, /obj/item/toy/cards/singlecard/cas))
|
||||
// var/obj/item/toy/cards/singlecard/cas/SC = I
|
||||
// if(!user.temporarilyRemoveItemFromInventory(SC))
|
||||
// to_chat(user, "<span class='warning'>The card is stuck to your hand, you can't add it to the deck!</span>")
|
||||
// return
|
||||
// var/datum/playingcard/RC // replace null datum for the re-added card
|
||||
// RC = new()
|
||||
// RC.name = "[SC.name]"
|
||||
// RC.card_icon = SC.card_face
|
||||
// cards += RC
|
||||
// user.visible_message("[user] adds a card to the bottom of the deck.","<span class='notice'>You add the card to the bottom of the deck.</span>")
|
||||
// qdel(SC)
|
||||
// update_icon()
|
||||
|
||||
/obj/item/toy/cards/deck/cas/update_icon()
|
||||
if(cards.len < 26)
|
||||
icon_state = "deck_[deckstyle]_low"
|
||||
// /obj/item/toy/cards/deck/cas/update_icon()
|
||||
// if(cards.len < 26)
|
||||
// icon_state = "deck_[deckstyle]_low"
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas
|
||||
name = "CAS card"
|
||||
desc = "A CAS card."
|
||||
icon_state = "cas_white"
|
||||
flipped = 0
|
||||
var/card_face = "cas_white"
|
||||
var/blank = 0
|
||||
var/buffertext = "A funny bit of text."
|
||||
// /obj/item/toy/cards/singlecard/cas
|
||||
// name = "CAS card"
|
||||
// desc = "A CAS card."
|
||||
// icon_state = "cas_white"
|
||||
// flipped = 0
|
||||
// var/card_face = "cas_white"
|
||||
// var/blank = 0
|
||||
// var/buffertext = "A funny bit of text."
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas/examine(mob/user)
|
||||
. = ..()
|
||||
if (flipped)
|
||||
. += "<span class='notice'>The card is face down.</span>"
|
||||
else if (blank)
|
||||
. += "<span class='notice'>The card is blank. Write on it with a pen.</span>"
|
||||
else
|
||||
. += "<span class='notice'>The card reads: [name]</span>"
|
||||
. += "<span class='notice'>Alt-click to flip it.</span>"
|
||||
// /obj/item/toy/cards/singlecard/cas/examine(mob/user)
|
||||
// . = ..()
|
||||
// if (flipped)
|
||||
// . += "<span class='notice'>The card is face down.</span>"
|
||||
// else if (blank)
|
||||
// . += "<span class='notice'>The card is blank. Write on it with a pen.</span>"
|
||||
// else
|
||||
// . += "<span class='notice'>The card reads: [name]</span>"
|
||||
// . += "<span class='notice'>Alt-click to flip it.</span>"
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas/Flip()
|
||||
set name = "Flip Card"
|
||||
set category = "Object"
|
||||
set src in range(1)
|
||||
if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
if(!flipped)
|
||||
name = "CAS card"
|
||||
else if(flipped)
|
||||
name = buffertext
|
||||
flipped = !flipped
|
||||
update_icon()
|
||||
// /obj/item/toy/cards/singlecard/cas/Flip()
|
||||
// set name = "Flip Card"
|
||||
// set category = "Object"
|
||||
// set src in range(1)
|
||||
// if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE))
|
||||
// return
|
||||
// if(!flipped)
|
||||
// name = "CAS card"
|
||||
// else if(flipped)
|
||||
// name = buffertext
|
||||
// flipped = !flipped
|
||||
// update_icon()
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas/AltClick(mob/living/user)
|
||||
. = ..()
|
||||
if(!ishuman(user) || !user.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
Flip()
|
||||
return TRUE
|
||||
// /obj/item/toy/cards/singlecard/cas/AltClick(mob/living/user)
|
||||
// . = ..()
|
||||
// if(!ishuman(user) || !user.canUseTopic(src, BE_CLOSE))
|
||||
// return
|
||||
// Flip()
|
||||
// return TRUE
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas/update_icon()
|
||||
if(flipped)
|
||||
icon_state = "[card_face]_flipped"
|
||||
else
|
||||
icon_state = "[card_face]"
|
||||
// /obj/item/toy/cards/singlecard/cas/update_icon()
|
||||
// if(flipped)
|
||||
// icon_state = "[card_face]_flipped"
|
||||
// else
|
||||
// icon_state = "[card_face]"
|
||||
|
||||
/obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/pen))
|
||||
if(!user.is_literate())
|
||||
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
|
||||
return
|
||||
if(!blank)
|
||||
to_chat(user, "You cannot write on that card.")
|
||||
return
|
||||
var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50)
|
||||
if(!cardtext || !user.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
name = cardtext
|
||||
buffertext = cardtext
|
||||
blank = 0
|
||||
// /obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params)
|
||||
// if(istype(I, /obj/item/pen))
|
||||
// if(!user.is_literate())
|
||||
// to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
|
||||
// return
|
||||
// if(!blank)
|
||||
// to_chat(user, "You cannot write on that card.")
|
||||
// return
|
||||
// var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50)
|
||||
// if(!cardtext || !user.canUseTopic(src, BE_CLOSE))
|
||||
// return
|
||||
// name = cardtext
|
||||
// buffertext = cardtext
|
||||
// blank = 0
|
||||
|
||||
Reference in New Issue
Block a user