Merge remote-tracking branch 'origin/master' into hardsync-1.5
This commit is contained in:
@@ -26,15 +26,16 @@ GLOBAL_LIST_EMPTY(GPS_list)
|
||||
if(. == COMPONENT_INCOMPATIBLE || !isitem(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
var/atom/A = parent
|
||||
A.add_overlay("working")
|
||||
if(starton)
|
||||
A.add_overlay("working")
|
||||
else
|
||||
tracking = FALSE
|
||||
A.name = "[initial(A.name)] ([gpstag])"
|
||||
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/interact)
|
||||
if(!emp_proof)
|
||||
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, .proc/on_emp_act)
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
|
||||
RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/on_AltClick)
|
||||
if(!starton)
|
||||
tracking = FALSE
|
||||
|
||||
///Called on COMSIG_ITEM_ATTACK_SELF
|
||||
/datum/component/gps/item/proc/interact(datum/source, mob/user)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
*A storage component to be used on card piles, for use as hands/decks/discard piles. Don't use on something that's not a card pile!
|
||||
*/
|
||||
/datum/component/storage/concrete/tcg
|
||||
display_numerical_stacking = FALSE
|
||||
max_w_class = WEIGHT_CLASS_TINY
|
||||
max_items = 30
|
||||
max_combined_w_class = WEIGHT_CLASS_TINY * 30
|
||||
///The deck that the card pile is using for FAIR PLAY.
|
||||
|
||||
/datum/component/storage/concrete/tcg/can_be_inserted(obj/item/I, stop_messages, mob/M)
|
||||
. = ..()
|
||||
return istype(I, /obj/item/tcg_card)
|
||||
|
||||
/datum/component/storage/concrete/tcg/PostTransfer()
|
||||
. = ..()
|
||||
handle_empty_deck()
|
||||
|
||||
/datum/component/storage/concrete/tcg/remove_from_storage(atom/movable/AM, atom/new_location)
|
||||
. = ..()
|
||||
handle_empty_deck()
|
||||
|
||||
/datum/component/storage/concrete/tcg/ui_show(mob/M)
|
||||
. = ..()
|
||||
M.visible_message("<span class='notice'>[M] starts to look through the contents of \the [parent]!</span>", \
|
||||
"<span class='notice'>You begin looking into the contents of \the [parent]!</span>")
|
||||
|
||||
/datum/component/storage/concrete/tcg/close(mob/M)
|
||||
. = ..()
|
||||
var/list/card_contents = contents()
|
||||
var/obj/temp_parent = parent
|
||||
temp_parent.visible_message("<span class='notice'>\the [parent] is shuffled after looking through it.</span>")
|
||||
card_contents = shuffle(card_contents)
|
||||
|
||||
/datum/component/storage/concrete/tcg/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress, trigger_on_found)
|
||||
. = ..()
|
||||
if(!things.len)
|
||||
qdel(parent)
|
||||
|
||||
/datum/component/storage/concrete/tcg/proc/handle_empty_deck()
|
||||
var/list/contents = contents()
|
||||
//You can't have a deck of one card!
|
||||
if(contents.len == 1)
|
||||
var/obj/item/tcgcard_deck/deck = parent
|
||||
var/obj/item/tcg_card/card = contents[1]
|
||||
remove_from_storage(card, card.drop_location())
|
||||
card.flipped = deck.flipped
|
||||
card.update_icon_state()
|
||||
qdel(parent)
|
||||
Reference in New Issue
Block a user