There is more!
This commit is contained in:
@@ -902,79 +902,57 @@
|
|||||||
name = "hand of cards"
|
name = "hand of cards"
|
||||||
desc = "A number of cards not in a deck, customarily held in ones hand."
|
desc = "A number of cards not in a deck, customarily held in ones hand."
|
||||||
icon = 'icons/obj/toy.dmi'
|
icon = 'icons/obj/toy.dmi'
|
||||||
icon_state = "nanotrasen_hand2"
|
icon_state = "none"
|
||||||
w_class = WEIGHT_CLASS_TINY
|
w_class = WEIGHT_CLASS_TINY
|
||||||
var/list/currenthand = list()
|
var/list/currenthand = list()
|
||||||
var/choice = null
|
var/choice = null
|
||||||
|
|
||||||
|
|
||||||
/obj/item/toy/cards/cardhand/attack_self(mob/user)
|
/obj/item/toy/cards/cardhand/attack_self(mob/user)
|
||||||
user.set_machine(src)
|
var/list/handradial = list()
|
||||||
interact(user)
|
interact(user)
|
||||||
|
|
||||||
/obj/item/toy/cards/cardhand/ui_interact(mob/user)
|
|
||||||
. = ..()
|
|
||||||
var/dat = "You have:<BR>"
|
|
||||||
for(var/t in currenthand)
|
for(var/t in currenthand)
|
||||||
dat += "<A href='?src=[REF(src)];pick=[t]'>A [t].</A><BR>"
|
handradial[t] = image(icon = src.icon, icon_state = "sc_[t]_[deckstyle]")
|
||||||
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))
|
if(usr.stat || !ishuman(usr))
|
||||||
return
|
return
|
||||||
var/mob/living/carbon/human/cardUser = usr
|
var/mob/living/carbon/human/cardUser = usr
|
||||||
var/O = src
|
if(!(cardUser.mobility_flags & MOBILITY_USE))
|
||||||
if(href_list["pick"])
|
|
||||||
if (cardUser.is_holding(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_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)
|
|
||||||
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)
|
|
||||||
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>")
|
|
||||||
cardUser << browse(null, "window=cardhand")
|
|
||||||
return
|
return
|
||||||
|
var/O = src
|
||||||
|
var/choice = show_radial_menu(usr,src, handradial, custom_check = CALLBACK(src, .proc/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)
|
/obj/item/toy/cards/cardhand/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params)
|
||||||
if(istype(C))
|
if(istype(C))
|
||||||
if(C.parentdeck == src.parentdeck)
|
if(C.parentdeck == src.parentdeck)
|
||||||
src.currenthand += C.cardname
|
src.currenthand += C.cardname
|
||||||
user.visible_message("[user] adds a card to [user.p_their()] hand.", "<span class='notice'>You add the [C.cardname] to your hand.</span>")
|
user.visible_message("<span class='notice'>[user] adds a card to [user.p_their()] hand.</span>", "<span class='notice'>You add the [C.cardname] to your hand.</span>")
|
||||||
qdel(C)
|
qdel(C)
|
||||||
interact(user)
|
interact(user)
|
||||||
if(currenthand.len > 4)
|
update_sprite(src)
|
||||||
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"
|
|
||||||
else
|
else
|
||||||
to_chat(user, "<span class='warning'>You can't mix cards from other decks!</span>")
|
to_chat(user, "<span class='warning'>You can't mix cards from other decks!</span>")
|
||||||
else
|
else
|
||||||
@@ -983,7 +961,7 @@
|
|||||||
/obj/item/toy/cards/cardhand/apply_card_vars(obj/item/toy/cards/newobj,obj/item/toy/cards/sourceobj)
|
/obj/item/toy/cards/cardhand/apply_card_vars(obj/item/toy/cards/newobj,obj/item/toy/cards/sourceobj)
|
||||||
..()
|
..()
|
||||||
newobj.deckstyle = sourceobj.deckstyle
|
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_hitsound = sourceobj.card_hitsound
|
||||||
newobj.card_force = sourceobj.card_force
|
newobj.card_force = sourceobj.card_force
|
||||||
newobj.card_throwforce = sourceobj.card_throwforce
|
newobj.card_throwforce = sourceobj.card_throwforce
|
||||||
@@ -992,6 +970,31 @@
|
|||||||
newobj.card_attack_verb = sourceobj.card_attack_verb
|
newobj.card_attack_verb = sourceobj.card_attack_verb
|
||||||
newobj.resistance_flags = sourceobj.resistance_flags
|
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
|
||||||
|
|
||||||
|
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
|
/obj/item/toy/cards/singlecard
|
||||||
name = "card"
|
name = "card"
|
||||||
desc = "a card"
|
desc = "a card"
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
/obj/structure/janitorialcart/proc/put_in_cart(obj/item/I, mob/user)
|
/obj/structure/janitorialcart/proc/put_in_cart(obj/item/I, mob/user)
|
||||||
if(!user.transferItemToLoc(I, src))
|
if(!user.transferItemToLoc(I, src))
|
||||||
return
|
return
|
||||||
updateUsrDialog()
|
|
||||||
to_chat(user, "<span class='notice'>You put [I] into [src].</span>")
|
to_chat(user, "<span class='notice'>You put [I] into [src].</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -96,70 +95,82 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
if(.)
|
if(.)
|
||||||
return
|
return
|
||||||
user.set_machine(src)
|
|
||||||
var/dat
|
var/list/items = list()
|
||||||
if(mybag)
|
if(mybag)
|
||||||
dat += "<a href='?src=[REF(src)];garbage=1'>[mybag.name]</a><br>"
|
items += list("Trash bag" = image(icon = mybag.icon, icon_state = mybag.icon_state))
|
||||||
if(mymop)
|
if(mymop)
|
||||||
dat += "<a href='?src=[REF(src)];mop=1'>[mymop.name]</a><br>"
|
items += list("Mop" = image(icon = mymop.icon, icon_state = mymop.icon_state))
|
||||||
if(mybroom)
|
if(mybroom)
|
||||||
dat += "<a href='?src=[REF(src)];broom=1'>[mybroom.name]</a><br>"
|
items += list("Broom" = image(icon = mybroom.icon, icon_state = mybroom.icon_state))
|
||||||
if(myspray)
|
if(myspray)
|
||||||
dat += "<a href='?src=[REF(src)];spray=1'>[myspray.name]</a><br>"
|
items += list("Spray bottle" = image(icon = myspray.icon, icon_state = myspray.icon_state))
|
||||||
if(myreplacer)
|
if(myreplacer)
|
||||||
dat += "<a href='?src=[REF(src)];replacer=1'>[myreplacer.name]</a><br>"
|
items += list("Light replacer" = image(icon = myreplacer.icon, icon_state = myreplacer.icon_state))
|
||||||
if(signs)
|
var/obj/item/clothing/suit/caution/sign = locate() in src
|
||||||
dat += "<a href='?src=[REF(src)];sign=1'>[signs] sign\s</a><br>"
|
if(sign)
|
||||||
var/datum/browser/popup = new(user, "janicart", name, 240, 160)
|
items += list("Sign" = image(icon = sign.icon, icon_state = sign.icon_state))
|
||||||
popup.set_content(dat)
|
|
||||||
popup.open()
|
|
||||||
|
|
||||||
|
if(!length(items))
|
||||||
/obj/structure/janitorialcart/Topic(href, href_list)
|
|
||||||
if(!in_range(src, usr))
|
|
||||||
return
|
return
|
||||||
if(!isliving(usr))
|
items = sortList(items)
|
||||||
|
var/pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 38, require_near = TRUE)
|
||||||
|
if(!pick)
|
||||||
return
|
return
|
||||||
var/mob/living/user = usr
|
switch(pick)
|
||||||
if(href_list["garbage"])
|
if("Trash bag")
|
||||||
if(mybag)
|
if(!mybag)
|
||||||
|
return
|
||||||
user.put_in_hands(mybag)
|
user.put_in_hands(mybag)
|
||||||
to_chat(user, "<span class='notice'>You take [mybag] from [src].</span>")
|
to_chat(user, "<span class='notice'>You take [mybag] from [src].</span>")
|
||||||
mybag = null
|
mybag = null
|
||||||
if(href_list["mop"])
|
if("Mop")
|
||||||
if(mymop)
|
if(!mymop)
|
||||||
|
return
|
||||||
user.put_in_hands(mymop)
|
user.put_in_hands(mymop)
|
||||||
to_chat(user, "<span class='notice'>You take [mymop] from [src].</span>")
|
to_chat(user, "<span class='notice'>You take [mymop] from [src].</span>")
|
||||||
mymop = null
|
mymop = null
|
||||||
if(href_list["broom"])
|
if("Broom")
|
||||||
if(mybroom)
|
if(!mybroom)
|
||||||
|
return
|
||||||
user.put_in_hands(mybroom)
|
user.put_in_hands(mybroom)
|
||||||
to_chat(user, "<span class='notice'>You take [mybroom] from [src].</span>")
|
to_chat(user, "<span class='notice'>You take [mybroom] from [src].</span>")
|
||||||
mybroom = null
|
mybroom = null
|
||||||
if(href_list["spray"])
|
if("Spray bottle")
|
||||||
if(myspray)
|
if(!myspray)
|
||||||
|
return
|
||||||
user.put_in_hands(myspray)
|
user.put_in_hands(myspray)
|
||||||
to_chat(user, "<span class='notice'>You take [myspray] from [src].</span>")
|
to_chat(user, "<span class='notice'>You take [myspray] from [src].</span>")
|
||||||
myspray = null
|
myspray = null
|
||||||
if(href_list["replacer"])
|
if("Light replacer")
|
||||||
if(myreplacer)
|
if(!myreplacer)
|
||||||
|
return
|
||||||
user.put_in_hands(myreplacer)
|
user.put_in_hands(myreplacer)
|
||||||
to_chat(user, "<span class='notice'>You take [myreplacer] from [src].</span>")
|
to_chat(user, "<span class='notice'>You take [myreplacer] from [src].</span>")
|
||||||
myreplacer = null
|
myreplacer = null
|
||||||
if(href_list["sign"])
|
if("Sign")
|
||||||
if(signs)
|
if(signs <= 0)
|
||||||
var/obj/item/caution/Sign = locate() in src
|
return
|
||||||
if(Sign)
|
user.put_in_hands(sign)
|
||||||
user.put_in_hands(Sign)
|
to_chat(user, "<span class='notice'>You take \a [sign] from [src].</span>")
|
||||||
to_chat(user, "<span class='notice'>You take \a [Sign] from [src].</span>")
|
signs--
|
||||||
signs--
|
else
|
||||||
else
|
return
|
||||||
WARNING("Signs ([signs]) didn't match contents")
|
|
||||||
signs = 0
|
|
||||||
|
|
||||||
update_icon()
|
update_icon()
|
||||||
updateUsrDialog()
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check_menu: Checks if we are allowed to interact with a radial menu
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* * user The mob interacting with a menu
|
||||||
|
*/
|
||||||
|
/obj/structure/janitorialcart/proc/check_menu(mob/living/user)
|
||||||
|
if(!istype(user))
|
||||||
|
return FALSE
|
||||||
|
if(user.incapacitated())
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
/obj/structure/janitorialcart/update_overlays()
|
/obj/structure/janitorialcart/update_overlays()
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|||||||
Reference in New Issue
Block a user