/TG/ Cards Ported, new card deck added

This commit is contained in:
SamCroswell
2014-02-11 23:22:30 -05:00
parent 035b14be35
commit 3634ff942b
6 changed files with 10863 additions and 10462 deletions
+29 -1
View File
@@ -1339,6 +1339,34 @@ ________________________________________________________________________________
usr << "<B>[mode]</B> is active."//Leaving usr here since it may be on the floor or on a person.
usr << "Voice mimicking algorithm is set <B>[!vchange?"inactive":"active"]</B>."
/*
=======================================================================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SPACE NINJA HACKBUG>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
=======================================================================================
*/
/*
Currently WIP, once finished they will, in theory, allow the Ninja to plant bugs on Computers/APCs/SMES units.
Possibly more later, but for now I want to get basic function working.
*/
/obj/item/weapon/hackbug
name = "hack-bug"
desc = "A strange device. Where did this even come from?"
gender = PLURAL
icon = 'icons/obj/ninjaobjects.dmi'
icon_state = "hackbug"
flags = FPRINT | TABLEPASS | USEDELAY
w_class = 1.0
/obj/item/weapon/hackbug/afterattack(atom/target as obj|turf, mob/user as mob, flag)
if (!flag)
return
if (istype(target, /turf/unsimulated) || istype(target, /turf/simulated/shuttle) || istype(target, /obj/item/weapon/storage/) || istype(target, /obj/machinery/door/airlock/hatch/gamma))
return
user << "Planting bug..."
target.overlays += image('icons/obj/ninjaobjects.dmi', "compoverlay")
/*
===================================================================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SPACE NINJA NET>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -1387,7 +1415,7 @@ It is possible to destroy the net by the occupant or someone else.
var/check = 30//30 seconds before teleportation. Could be extended I guess.
var/mob_name = affecting.name//Since they will report as null if terminated before teleport.
//The person can still try and attack the net when inside.
while(!isnull(M)&&!isnull(src)&&check>0)//While M and net exist, and 60 seconds have not passed.
while(!isnull(M)&&!isnull(src)&&check>0)//While M and net exist, and 30 seconds have not passed.
check--
sleep(10)
+368
View File
@@ -10,6 +10,8 @@
* Crayons
* Snap pops
* Water flower
* Toy Nuke
* Card Deck -- Ported from /TG/
*/
@@ -534,6 +536,372 @@
attack_verb = list("attacked", "slashed", "stabbed", "sliced")
/*
|| A Deck of Cards for playing various games of chance ||
*/
obj/item/toy/cards
var/parentdeck = null
var/deckstyle = "nanotrasen"
var/card_hitsound = null
var/card_force = 0
var/card_throwforce = 0
var/card_throw_speed = 4
var/card_throw_range = 20
var/list/card_attack_verb = list("attacked")
obj/item/toy/cards/New()
..()
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
if(!istype(sourceobj))
return
obj/item/toy/cards/deck
name = "deck of cards"
desc = "A deck of space-grade playing cards."
icon = 'icons/obj/toy.dmi'
deckstyle = "nanotrasen"
icon_state = "deck_nanotrasen_full"
w_class = 2.0
var/cooldown = 0
var/list/cards = list()
obj/item/toy/cards/deck/New()
..()
icon_state = "deck_[deckstyle]_full"
for(var/i = 2; i <= 10; i++)
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"
obj/item/toy/cards/deck/attack_hand(mob/user as mob)
var/choice = null
if(cards.len == 0)
src.icon_state = "deck_[deckstyle]_empty"
user << "<span class='notice'>There are no more cards to draw.</span>"
return
var/obj/item/toy/cards/singlecard/H = new/obj/item/toy/cards/singlecard(user.loc)
choice = cards[1]
H.cardname = choice
H.parentdeck = src
var/O = src
H.apply_card_vars(H,O)
src.cards -= choice
H.pickup(user)
user.put_in_active_hand(H)
src.visible_message("<span class='notice'>[user] draws a card from the deck.</span>", "<span class='notice'>You draw a card from the deck.</span>")
if(cards.len > 26)
src.icon_state = "deck_[deckstyle]_full"
else if(cards.len > 10)
src.icon_state = "deck_[deckstyle]_half"
else if(cards.len > 1)
src.icon_state = "deck_[deckstyle]_low"
obj/item/toy/cards/deck/attack_self(mob/user as mob)
if(cooldown < world.time - 50)
cards = shuffle(cards)
playsound(user, 'sound/items/cardshuffle.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] shuffles the deck.</span>", "<span class='notice'>You shuffle the deck.</span>")
cooldown = world.time
obj/item/toy/cards/deck/attackby(obj/item/toy/cards/singlecard/C, mob/living/user)
..()
if(istype(C))
if(C.parentdeck == src)
src.cards += C.cardname
user.u_equip(C)
user.visible_message("<span class='notice'>[user] adds a card to the bottom of the deck.</span>","<span class='notice'>You add the card to the bottom of the deck.</span>")
del(C)
else
user << "<span class='notice'>You can't mix cards from other decks.</span>"
if(cards.len > 26)
src.icon_state = "deck_[deckstyle]_full"
else if(cards.len > 10)
src.icon_state = "deck_[deckstyle]_half"
else if(cards.len > 1)
src.icon_state = "deck_[deckstyle]_low"
obj/item/toy/cards/deck/attackby(obj/item/toy/cards/cardhand/C, mob/living/user)
..()
if(istype(C))
if(C.parentdeck == src)
src.cards += C.currenthand
user.u_equip(C)
user.visible_message("<span class='notice'>[user] puts their hand of cards in the deck.</span>", "<span class='notice'>You put the hand of cards in the deck.</span>")
del(C)
else
user << "<span class='notice'>You can't mix cards from other decks.</span>"
if(cards.len > 26)
src.icon_state = "deck_[deckstyle]_full"
else if(cards.len > 10)
src.icon_state = "deck_[deckstyle]_half"
else if(cards.len > 1)
src.icon_state = "deck_[deckstyle]_low"
obj/item/toy/cards/deck/MouseDrop(atom/over_object)
var/mob/M = usr
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
return
if(Adjacent(usr))
if(over_object == M)
M.put_in_hands(src)
usr << "<span class='notice'>You pick up the deck.</span>"
else if(istype(over_object, /obj/screen))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.put_in_r_hand(src)
usr << "<span class='notice'>You pick up the deck.</span>"
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
usr << "<span class='notice'>You pick up the deck.</span>"
else
usr<< "<span class='notice'>You can't reach it from here.</span>"
obj/item/toy/cards/cardhand
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"
w_class = 1.0
var/list/currenthand = list()
var/choice = null
obj/item/toy/cards/cardhand/attack_self(mob/user as mob)
user.set_machine(src)
interact(user)
obj/item/toy/cards/cardhand/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_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.set_content(dat)
popup.open()
obj/item/toy/cards/cardhand/Topic(href, href_list)
if(..())
return
if(usr.stat || !ishuman(usr) || !usr.canmove)
return
var/mob/living/carbon/human/cardUser = usr
var/O = src
if(href_list["pick"])
if (cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src)
var/choice = href_list["pick"]
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)
C.pickup(cardUser)
cardUser.put_in_any_hand_if_possible(C)
cardUser.visible_message("<span class='notice'>[cardUser] draws a card from \his hand.</span>", "<span class='notice'>You take the [C.cardname] from your hand.</span>")
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"
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)
cardUser.u_equip(src)
N.pickup(cardUser)
cardUser.put_in_any_hand_if_possible(N)
cardUser << "<span class='notice'>You also take [currenthand[1]] and hold it.</span>"
cardUser << browse(null, "window=cardhand")
del(src)
return
obj/item/toy/cards/cardhand/attackby(obj/item/toy/cards/singlecard/C, mob/living/user)
if(istype(C))
if(C.parentdeck == src.parentdeck)
src.currenthand += C.cardname
user.u_equip(C)
user.visible_message("<span class='notice'>[user] adds a card to their hand.</span>", "<span class='notice'>You add the [C.cardname] to your hand.</span>")
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"
del(C)
else
user << "<span class='notice'>You can't mix cards from other decks.</span>"
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.
newobj.card_hitsound = sourceobj.card_hitsound
newobj.card_force = sourceobj.card_force
newobj.card_throwforce = sourceobj.card_throwforce
newobj.card_throw_speed = sourceobj.card_throw_speed
newobj.card_throw_range = sourceobj.card_throw_range
newobj.card_attack_verb = sourceobj.card_attack_verb
obj/item/toy/cards/singlecard
name = "card"
desc = "a card"
icon = 'icons/obj/toy.dmi'
icon_state = "singlecard_nanotrasen_down"
w_class = 1.0
var/cardname = null
var/flipped = 0
pixel_x = -5
obj/item/toy/cards/singlecard/examine()
set src in usr.contents
if(ishuman(usr))
var/mob/living/carbon/human/cardUser = usr
if(cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src)
cardUser.visible_message("<span class='notice'>[cardUser] checks \his card.</span>", "<span class='notice'>The card reads: [src.cardname]</span>")
else
cardUser << "<span class='notice'>You need to have the card in your hand to check it.</span>"
obj/item/toy/cards/singlecard/verb/Flip()
set name = "Flip Card"
set category = "Object"
set src in range(1)
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
return
if(!flipped)
src.flipped = 1
if (cardname)
src.icon_state = "sc_[cardname]_[deckstyle]"
src.name = src.cardname
else
src.icon_state = "sc_Ace of Spades_[deckstyle]"
src.name = "What Card"
src.pixel_x = 5
else if(flipped)
src.flipped = 0
src.icon_state = "singlecard_down_[deckstyle]"
src.name = "card"
src.pixel_x = -5
obj/item/toy/cards/singlecard/attackby(obj/item/I, mob/living/user)
if(istype(I, /obj/item/toy/cards/singlecard/))
var/obj/item/toy/cards/singlecard/C = I
if(C.parentdeck == src.parentdeck)
var/obj/item/toy/cards/cardhand/H = new/obj/item/toy/cards/cardhand(user.loc)
H.currenthand += C.cardname
H.currenthand += src.cardname
H.parentdeck = C.parentdeck
H.apply_card_vars(H,C)
user.u_equip(C)
H.pickup(user)
user.put_in_active_hand(H)
user << "<span class='notice'>You combine the [C.cardname] and the [src.cardname] into a hand.</span>"
del(C)
del(src)
else
user << "<span class='notice'>You can't mix cards from other decks.</span>"
if(istype(I, /obj/item/toy/cards/cardhand/))
var/obj/item/toy/cards/cardhand/H = I
if(H.parentdeck == parentdeck)
H.currenthand += cardname
user.u_equip(src)
user.visible_message("<span class='notice'>[user] adds a card to \his hand.</span>", "<span class='notice'>You add the [cardname] to your hand.</span>")
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"
del(src)
else
user << "<span class='notice'>You can't mix cards from other decks.</span>"
obj/item/toy/cards/singlecard/attack_self(mob/user)
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
return
Flip()
obj/item/toy/cards/singlecard/apply_card_vars(obj/item/toy/cards/singlecard/newobj,obj/item/toy/cards/sourceobj)
..()
newobj.deckstyle = sourceobj.deckstyle
newobj.icon_state = "singlecard_down_[deckstyle]" // Without this the card is invisible until flipped. It's an ugly hack, but it works.
newobj.card_hitsound = sourceobj.card_hitsound
newobj.hitsound = newobj.card_hitsound
newobj.card_force = sourceobj.card_force
newobj.force = newobj.card_force
newobj.card_throwforce = sourceobj.card_throwforce
newobj.throwforce = newobj.card_throwforce
newobj.card_throw_speed = sourceobj.card_throw_speed
newobj.throw_speed = newobj.card_throw_speed
newobj.card_throw_range = sourceobj.card_throw_range
newobj.throw_range = newobj.card_throw_range
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."
deckstyle = "syndicate"
card_hitsound = 'sound/weapons/bladeslice.ogg'
card_force = 15
card_throwforce = 15
card_throw_speed = 6
card_throw_range = 20
card_attack_verb = list("attacked", "sliced", "diced", "slashed", "cut")
/*
|| Custom card decks ||
*/
obj/item/toy/cards/deck/black
deckstyle = "black"
obj/item/toy/cards/deck/syndicate/black
deckstyle = "black"
/obj/item/toy/nuke
name = "\improper Nuclear Fission Explosive toy"
desc = "A plastic model of a Nuclear Fission Explosive."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 25 KiB

+10466 -10461
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.