[MIRROR] Last TGC Holodeck PR before the freeze! Card marking and Blank cards! [MDB IGNORE] (#19136)

* Last TGC Holodeck PR before the freeze! Card marking and Blank cards! (#73013)

## About The Pull Request

This should be the final PR required to finish my goal of the holodeck
TGC arena having all the features of the tabletop version. Marking cards
(e.g. for hivemind cards) and cards that summon other cards are both
intended to use the flipper as a counter. This is not possible on the
holodeck and as such this PR adds that functionality. When a card is in
a holder a new option to mark the card has been added which will add a
small indicator to the top right of the card summon when activated. For
empty card holders you can now right click them to create a blank card,
you will be prompted to input a name for the blank card, (e.g. Resin
Wall) and then the card will act like a regular card.
## Why It's Good For The Game

TGC can now be played in its entirety on the holodeck, at this point all
tabletop features should have representations on the holodeck.
## Changelog
🆑
add: You can now mark TGC cards on the holodeck battle arena, useful for
keeping track of effects such as hivemind.
add: Right clicking a card holder on the TGC holodeck battle arena will
allow you to generate a "blank card", useful for when using cards that
summon other cards, such as the xenomorph hivelord.
spellcheck: Capitalized some descriptions for TGC machines
/🆑

* Last TGC Holodeck PR before the freeze! Card marking and Blank cards!

---------

Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-02-03 15:54:04 +00:00
committed by GitHub
co-authored by NamelessFairy
parent 81f58cc7af
commit ff08d65e21
3 changed files with 83 additions and 22 deletions
+83 -22
View File
@@ -3,10 +3,11 @@
#define RESOLVE_X 12
#define DEFAULT_POWER_COLOR "#af2323"
#define DEFAULT_RESOLVE_COLOR "#3492d0"
#define DEFAULT_MODIFIED_COLOR "#1db327"
/obj/machinery/trading_card_holder
name = "card slot"
desc = "a slot for placing Tactical Game Cards."
desc = "A slot for placing Tactical Game Cards."
icon = 'icons/obj/toys/tcgmisc.dmi'
icon_state = "card_holder_inactive"
use_power = NO_POWER_USE
@@ -17,13 +18,14 @@
var/datum/card/card_template
///Reference to holographic currently active holographic summon
var/obj/structure/trading_card_summon/current_summon
///Color of the holograms produced.
var/team_color = "#77abff"
var/summon_offset_x = 0
var/summon_offset_y = 1
var/summon_type = /obj/structure/trading_card_summon
/obj/machinery/trading_card_holder/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/tcgcard) && current_card == null)
if(istype(I, /obj/item/tcgcard) && current_summon == null)
current_card = I
card_template = current_card.extract_datum()
if(card_template.cardtype == "Creature")
@@ -32,26 +34,28 @@
to_chat(user, span_notice("You put the [current_card] card in [src]."))
icon_state = "card_holder_active"
update_appearance()
current_summon = new summon_type(locate(x + summon_offset_x, y + summon_offset_y, z))
current_summon = new(locate(x + summon_offset_x, y + summon_offset_y, z))
current_summon.template = card_template
current_summon.card_ref = current_card
current_summon.team_color = team_color
current_summon.load_model()
else
to_chat(user, span_notice("The [src] smartly rejects the non-creature card."))
current_card = null
return..()
return ..()
else
return..()
return ..()
GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
/obj/machinery/trading_card_holder/attack_hand(mob/user)
if(current_card)
if(current_summon)
var/list/choices = GLOB.tcgcard_machine_radial_choices
if(!length(choices))
choices = GLOB.tcgcard_machine_radial_choices = list(
"Pickup" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_pickup"),
"Tap" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_tap"),
"Mark" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_mark"),
"Modify" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_modify"),
)
var/choice = show_radial_menu(user, src, choices, custom_check = CALLBACK(src, PROC_REF(check_menu), user), require_near = TRUE, tooltips = TRUE)
@@ -59,24 +63,44 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
return COMPONENT_CANCEL_ATTACK_CHAIN
switch(choice)
if("Tap")
current_summon.update_tapped(current_card)
current_summon.update_tapped()
if("Pickup")
user.put_in_hands(current_card)
to_chat(user, span_notice("You take the [current_card] card out of [src]."))
current_card = null
if(current_card)
user.put_in_hands(current_card)
to_chat(user, span_notice("You take the [current_card] card out of [src]."))
current_card = null
else
to_chat(user, span_notice("The blank card dematerializes."))
card_template = null
icon_state = "card_holder_inactive"
update_appearance()
if(current_summon)
qdel(current_summon)
current_summon = null
if("Modify")
current_summon.modify_stats(user)
if("Mark")
current_summon.update_marked()
if(null)
return
else
to_chat(user, span_warning("[src] is empty!"))
add_fingerprint(user)
return..()
return ..()
/obj/machinery/trading_card_holder/attack_hand_secondary(mob/user)
if(isnull(current_summon))
var/card_name = tgui_input_text(user, "Insert card name", "Blank Card Naming", "blank card", MAX_NAME_LEN)
if(isnull(card_name))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
current_summon = new /obj/structure/trading_card_summon/blank(locate(x + summon_offset_x, y + summon_offset_y, z))
icon_state = "card_holder_active"
current_summon.name = card_name
current_summon.team_color = team_color
current_summon.load_model()
else
to_chat(user, span_notice("The [src] already contains a card."))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/obj/machinery/trading_card_holder/proc/check_menu(mob/living/user)
if(!istype(user))
@@ -95,11 +119,14 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
if(card_template)
. += span_notice("There is currently a [card_template.name] card inserted.")
else
. += span_notice("There is no card currently inserted.")
if(current_summon)
. += span_notice("There is currently a blank card inserted.")
else
. += span_notice("There is no card currently inserted.")
/obj/machinery/trading_card_holder/red
summon_offset_y = -1
summon_type = /obj/structure/trading_card_summon/red
team_color = "#ff7777"
/obj/structure/trading_card_summon
name = "coder"
@@ -118,6 +145,8 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
var/summon_resolve
///Is the card tapped (rotated) or not.
var/tapped = FALSE
///Is the card marked or not.
var/marked = FALSE
///Reference to the hologram object itself.
var/obj/effect/overlay/card_summon/hologram
@@ -130,7 +159,7 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
///Color of the resolve stat.
var/resolve_color = DEFAULT_RESOLVE_COLOR
///Color that stats become if they've been changed from their default.
var/modified_color = "#1db327"
var/modified_color = DEFAULT_MODIFIED_COLOR
///Color of the holograms produced.
var/team_color = "#77abff"
@@ -149,7 +178,6 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
summon_resolve = template.resolve
update_overlays()
/obj/structure/trading_card_summon/get_name_chaser(mob/user, list/name_chaser = list())
name_chaser += "Faction: [template.faction]"
name_chaser += "Cost: [template.summoncost]"
@@ -162,7 +190,6 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
/obj/structure/trading_card_summon/update_overlays()
. = ..()
var/overlay = update_stats(power_overlay, STAT_Y, summon_power, power_color, x_offset = POWER_X)
if(overlay)
@@ -170,6 +197,12 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
overlay = update_stats(resolve_overlay, STAT_Y, summon_resolve, resolve_color, x_offset = RESOLVE_X)
if(overlay)
resolve_overlay = overlay
if(marked)
var/mutable_appearance/mark_overlay = mutable_appearance('icons/obj/toys/tcgmisc.dmi', "gem_green", 9)
mark_overlay.pixel_w = 12
mark_overlay.pixel_z = 12
. += mark_overlay
/obj/structure/trading_card_summon/proc/update_stats(obj/effect/overlay/status_display_text/overlay, pos_y, stats, text_color, x_offset)
if(overlay && stats == overlay.message)
@@ -185,13 +218,17 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
vis_contents += stats_display
return stats_display
/obj/structure/trading_card_summon/proc/update_tapped(obj/item/tcgcard/current_card)
/obj/structure/trading_card_summon/proc/update_tapped()
if(tapped)
hologram.transform = turn(hologram.transform, 90)
else
hologram.transform = turn(hologram.transform, -90)
tapped = !tapped
/obj/structure/trading_card_summon/proc/update_marked()
marked = !marked
update_icon(UPDATE_OVERLAYS)
/obj/structure/trading_card_summon/proc/modify_stats(mob/living/user)
summon_power = num2text(tgui_input_number(user, "Please input power value", "Stat Modification", text2num(template.power), 25))
if(summon_power == template.power)
@@ -210,8 +247,32 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
qdel(hologram)
return ..()
/obj/structure/trading_card_summon/red
team_color = "#ff7777"
/obj/structure/trading_card_summon/blank
name = "blank card"
desc = "A blank card used to represent cards summoned by other cards."
summon_power = 1
summon_resolve = 1
power_color = DEFAULT_MODIFIED_COLOR
resolve_color = DEFAULT_MODIFIED_COLOR
/obj/structure/trading_card_summon/blank/load_model()
hologram = new(loc)
hologram.icon = 'icons/obj/toys/tcgmisc.dmi'
hologram.icon_state = "cardback"
hologram.name = name
hologram.alpha = 170
hologram.add_atom_colour(team_color, FIXED_COLOUR_PRIORITY)
update_overlays()
/obj/structure/trading_card_summon/blank/get_name_chaser(mob/user, list/name_chaser)
name_chaser += "Power/Resolve: [summon_power]/[summon_resolve]"
return name_chaser
/obj/structure/trading_card_summon/blank/modify_stats(mob/living/user)
summon_power = num2text(tgui_input_number(user, "Please input power value", "Stat Modification", text2num(summon_power), 25))
summon_resolve = num2text(tgui_input_number(user, "Please input resolve value", "Stat Modification", text2num(summon_resolve), 25))
update_overlays()
#undef STAT_Y
#undef POWER_X
@@ -225,7 +286,7 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices)
///A button that generates a player manipulable bar of icons, in this case a mana bar.
/obj/machinery/trading_card_button
name = "mana control panel"
desc = "a set of buttons that lets you keep track of your mana when playing Tactical Game Cards."
desc = "A set of buttons that lets you keep track of your mana when playing Tactical Game Cards."
icon = 'icons/obj/toys/tcgmisc.dmi'
icon_state = "mana_buttons"
use_power = NO_POWER_USE
@@ -300,7 +361,7 @@ GLOBAL_LIST_EMPTY(tcgcard_mana_bar_radial_choices)
/obj/machinery/trading_card_button/health
name = "life control panel"
desc = "a set of buttons that lets you keep track of your life shards when playing Tactical Game Cards."
desc = "A set of buttons that lets you keep track of your life shards when playing Tactical Game Cards."
icon_state = "health_buttons"
display_panel_type = /obj/effect/decal/trading_card_panel/health
panel_offset_x = -1