Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes playing cards playable -- significantly reworks card interactions #26585

Merged
merged 45 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a40ca02
Basic card interactions
lewcc Aug 13, 2024
32aaee3
initial interactions sorted
lewcc Aug 13, 2024
157757b
nails down some interactions, radial menu
lewcc Aug 13, 2024
4f1e88e
Some more qol and keybind changes
lewcc Aug 14, 2024
7e7f9f0
improves card interactions
lewcc Aug 15, 2024
4affc89
Unum decks can be flipped, showing the top card
lewcc Aug 15, 2024
21e42bb
Decks can now be split and recombined
lewcc Aug 15, 2024
b6416bb
minor tweaks to multi-deck stuff
lewcc Aug 19, 2024
65b7323
Clean up a bunch of interactions
lewcc Aug 20, 2024
fd33488
more cleanups
lewcc Aug 20, 2024
f915f8b
more cleanups and documentation
lewcc Aug 21, 2024
33186c9
remote attacking looks pretty good
lewcc Aug 24, 2024
eb4186d
minor cleanups
lewcc Aug 24, 2024
206568d
Merge branch 'master' into bally-tro
lewcc Aug 24, 2024
3f4c00c
ci
lewcc Aug 24, 2024
c0191dc
parser errs
lewcc Aug 24, 2024
304beb5
Merge branch 'master' into bally-tro
lewcc Aug 24, 2024
96e8704
Remove some debug things, re-add signal after merge
lewcc Aug 24, 2024
5fbfe16
Adds a whole bunch more qol.
lewcc Aug 24, 2024
4db2046
Improves examine messages
lewcc Aug 24, 2024
5076263
ci
lewcc Aug 25, 2024
ffd2720
concealed cards will now show properly in radial
lewcc Aug 25, 2024
ae8f778
Fixes some weird proximity monitor and control issues
lewcc Aug 25, 2024
ea6a874
Merge branch 'master' into bally-tro
lewcc Sep 4, 2024
a1c701f
Address reviews, clean up examine a bit more
lewcc Sep 5, 2024
05a6fe1
radial fixes
lewcc Sep 10, 2024
99ca437
remove todos
lewcc Sep 10, 2024
290099b
Apply suggestions from code review
lewcc Sep 12, 2024
b002524
better documentation, adds label of who did what
lewcc Oct 6, 2024
7249a1f
b etter grammar
lewcc Oct 24, 2024
ac0cea1
Merge branch 'master' into bally-tro
lewcc Oct 24, 2024
8aca9a8
Merge branch 'master' into bally-tro
lewcc Nov 15, 2024
07aaa8f
augh
lewcc Nov 20, 2024
7c5db55
missing icon state
lewcc Nov 20, 2024
1ef26f3
Update code/game/gamemodes/wizard/magic_tarot.dm
lewcc Nov 20, 2024
df27a9d
Apply suggestions from code review
lewcc Nov 21, 2024
7f6fe9c
Merge branch 'master' into bally-tro
Burzah Nov 21, 2024
48a8b01
Add sleep on proximity monitor setup to hopefully avoid mapload issues
lewcc Nov 28, 2024
2f2a0cb
been writing too much c lately
lewcc Nov 28, 2024
feef596
Try late initialize
lewcc Nov 29, 2024
11145f1
Merge branch 'master' into bally-tro
lewcc Nov 29, 2024
9087190
late init
lewcc Nov 29, 2024
895c0cd
Merge branch 'bally-tro' of https://github.com/lewcc/Paradise into ba…
lewcc Nov 29, 2024
a7f88ca
:troll:
lewcc Nov 29, 2024
1353348
map load
lewcc Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
#define COMSIG_ATOM_HULK_ATTACK "hulk_attack"
///from base of atom/animal_attack(): (/mob/user)
#define COMSIG_ATOM_ATTACK_ANIMAL "attack_animal"
/// On a ranged attack: base of mob/living/carbon/human/RangedAttack (/mob/living/carbon/human)
#define COMSIG_ATOM_RANGED_ATTACKED "atom_range_attacked"
///from base of atom/examine(): (examining_user, examine_list)
#define COMSIG_PARENT_EXAMINE "atom_examine"
///from base of atom/examine_more(): (examining_user, examine_list)
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@

#define isstack(I) (istype(I, /obj/item/stack))

#define istable(S) (istype(S, /obj/structure/table))

GLOBAL_LIST_INIT(pointed_types, typecacheof(list(
/obj/item/pen,
/obj/item/screwdriver,
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_ABSTRACT_HANDS "abstract_hands" // Mobs with this trait can only pick up abstract items.
#define TRAIT_LANGUAGE_LOCKED "language_locked" // cant add/remove languages until removed (excludes babel because fuck everything i guess)
#define TRAIT_HAS_IV_BAG "iv_bag" // Used to check if there is an active IV bag. Currently blocks another IV bags from being inserted.
#define TRAIT_PLAYING_CARDS "playing_cards"

//***** MIND TRAITS *****/
#define TRAIT_HOLY "is_holy" // The mob is holy in regards to religion
Expand Down
3 changes: 3 additions & 0 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
if(istype(G) && G.Touch(A, 0)) // for magic gloves
return


lewcc marked this conversation as resolved.
Show resolved Hide resolved
if(HAS_TRAIT(src, TRAIT_LASEREYES) && a_intent == INTENT_HARM)
LaserEyes(A)

Expand All @@ -55,6 +56,8 @@
if(isturf(A) && get_dist(src, A) <= 1)
Move_Pulled(A)

SEND_SIGNAL(A, COMSIG_ATOM_RANGED_ATTACKED, src)
lewcc marked this conversation as resolved.
Show resolved Hide resolved

/*
Animals & All Unspecified
*/
Expand Down
151 changes: 151 additions & 0 deletions code/datums/components/proximity_monitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,154 @@
. = ..()
if(active && AM != monitor.hasprox_receiver && !(AM in monitor.nested_receiver_locs))
monitor.hasprox_receiver.HasProximity(AM)

/// A custom proximity monitor used for tracking players around a table of cards.

/datum/component/proximity_monitor/table
/// How far away you can be (in terms of table squares).
var/max_table_distance
/// How far away you can be (euclidean distance).
var/max_total_distance
/// The UID of the deck
var/deck_uid

/datum/component/proximity_monitor/table/Initialize(_radius = 1, _always_active = FALSE, _max_table_distance = 5)
max_table_distance = _max_table_distance
max_total_distance = _max_table_distance
. = ..(_radius, _always_active)
if(istype(parent, /obj/item/deck))
// this is important for tracking traits and attacking multiple cards. so it's not a true UID, sue me
var/obj/item/deck/D = parent
deck_uid = D.main_deck_id
else
deck_uid = parent.UID()
refresh()

// /datum/component/proximity_monitor/table/RegisterWithParent()
// . = ..()

// // we want our new prox monitors to have the parent UID
// refresh()

/datum/component/proximity_monitor/table/proc/refresh()
var/list/tables = list()
var/list/prox_mon_spots = list()
crawl_along(get_turf(parent), tables, prox_mon_spots, 0)
QDEL_LIST_CONTENTS(proximity_checkers)
create_prox_checkers()

/// Crawl along an extended table, and return a list of all turfs that we should start tracking.
/datum/component/proximity_monitor/table/proc/crawl_along(turf/current_turf, list/visited_tables = list(), list/prox_mon_spots = list(), distance_from_start)
var/obj/structure/current_table = locate(/obj/structure/table) in current_turf

if(!current_table)
lewcc marked this conversation as resolved.
Show resolved Hide resolved
// if there's no table here, we're still adjacent to a table, so this is a spot you could play from
prox_mon_spots |= current_turf
return


lewcc marked this conversation as resolved.
Show resolved Hide resolved
if(current_table in visited_tables)
return

visited_tables |= current_table
prox_mon_spots |= current_turf

lewcc marked this conversation as resolved.
Show resolved Hide resolved

if(distance_from_start + 1 > max_table_distance)
return

for(var/direction in GLOB.alldirs)
var/turf/next_turf = get_step(current_table, direction)
if(get_dist_euclidian(get_turf(parent), next_turf) > max_total_distance)
continue
crawl_along(next_turf, visited_tables, prox_mon_spots, distance_from_start + 1)
lewcc marked this conversation as resolved.
Show resolved Hide resolved

/datum/component/proximity_monitor/table/create_prox_checkers()
var/list/tables = list()
var/list/prox_mon_spots = list()
if(length(proximity_checkers))
QDEL_LIST_CONTENTS(proximity_checkers)

var/atom/movable/atom_parent = parent

// if we don't have a parent, just treat it normally
if(!isturf(atom_parent.loc) || !locate(/obj/structure/table) in get_turf(parent))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait im dumb

lewcc marked this conversation as resolved.
Show resolved Hide resolved
return


LAZYINITLIST(proximity_checkers)
crawl_along(get_turf(parent), tables, prox_mon_spots, 0)
// var/turf/parent_turf = get_turf(parent)
// For whatever reason their turf is null. Create the checkers in nullspace for now. When the parent moves to a valid turf, they can be recenetered.
for(var/T in prox_mon_spots)
create_single_prox_checker(T, /obj/effect/abstract/proximity_checker/table)

for(var/atom/table in tables)
RegisterSignal(table, COMSIG_PARENT_QDELETING, PROC_REF(on_table_qdel), TRUE)

/datum/component/proximity_monitor/table/on_receiver_move(datum/source, atom/old_loc, dir)
create_prox_checkers()

/datum/component/proximity_monitor/table/RegisterWithParent()
if(ismovable(hasprox_receiver))
RegisterSignal(hasprox_receiver, COMSIG_MOVABLE_MOVED, PROC_REF(on_receiver_move))

/datum/component/proximity_monitor/table/proc/on_table_qdel()
SIGNAL_HANDLER // COMSIG_PARENT_QDELETED
create_prox_checkers()
lewcc marked this conversation as resolved.
Show resolved Hide resolved

/obj/effect/abstract/proximity_checker/table
icon = 'icons/obj/playing_cards.dmi'

icon_state = "tarot_the_unknown"

invisibility = INVISIBILITY_MINIMUM
layer = MOB_LAYER


/// The UID for the deck, used in the setting and removal of traits
var/deck_uid

/obj/effect/abstract/proximity_checker/table/Initialize(mapload, datum/component/proximity_monitor/table/P)
. = ..()
deck_uid = P.deck_uid
// catch any mobs on our tile
for(var/mob/living/L in get_turf(src))
register_on_mob(L)

/obj/effect/abstract/proximity_checker/table/Destroy()
for(var/mob/living/L in get_turf(src))
remove_from_mob(L)
return ..()

lewcc marked this conversation as resolved.
Show resolved Hide resolved

/obj/effect/abstract/proximity_checker/table/proc/register_on_mob(mob/living/L)
ADD_TRAIT(L, TRAIT_PLAYING_CARDS, "deck_[deck_uid]")
RegisterSignal(L, COMSIG_MOVABLE_MOVED, PROC_REF(on_move_from_monitor), TRUE)
RegisterSignal(L, COMSIG_PARENT_QDELETING, PROC_REF(remove_from_mob), TRUE)


/obj/effect/abstract/proximity_checker/table/proc/remove_from_mob(mob/living/L)
if(QDELETED(L))
return
// otherwise, clean up
REMOVE_TRAIT(L, TRAIT_PLAYING_CARDS, "deck_[deck_uid]")
UnregisterSignal(L, COMSIG_MOVABLE_MOVED)

/obj/effect/abstract/proximity_checker/table/Crossed(atom/movable/AM, oldloc)
if(!isliving(AM))
return

var/mob/mover = AM

// This should hopefully ensure that multiple decks around each other don't overlap
register_on_mob(mover)

/obj/effect/abstract/proximity_checker/table/proc/on_move_from_monitor(atom/movable/tracked, atom/old_loc)
SIGNAL_HANDLER // COMSIG_MOVABLE_MOVED
var/obj/effect/abstract/proximity_checker/table/mon = locate(type) in get_turf(tracked)
if(istype(mon) && mon.monitor == monitor)
return // keep the signal there if it's from us

// otherwise, clean up
remove_from_mob(tracked)
30 changes: 24 additions & 6 deletions code/game/gamemodes/wizard/magic_tarot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,41 @@
/obj/item/magic_tarot_card/proc/pre_activate(mob/user)
has_been_activated = TRUE
forceMove(user)
var/obj/effect/temp_visual/tarot_preview/draft = new /obj/effect/temp_visual/tarot_preview(user, our_tarot.card_icon)
var/obj/effect/temp_visual/card_preview/tarot/draft = new /obj/effect/temp_visual/card_preview/tarot(user, "tarot_[our_tarot.card_icon]")
lewcc marked this conversation as resolved.
Show resolved Hide resolved
user.vis_contents += draft
user.visible_message("<span class='hierophant'>[user] holds up [src]!</span>")
addtimer(CALLBACK(our_tarot, TYPE_PROC_REF(/datum/tarot, activate), user), 0.5 SECONDS)
QDEL_IN(src, 0.6 SECONDS)

/obj/effect/temp_visual/tarot_preview
name = "a tarot card"
/obj/effect/temp_visual/card_preview
name = "a card"
icon = 'icons/obj/playing_cards.dmi'
icon_state = "tarot_the_unknown"
pixel_y = 20
duration = 1.5 SECONDS

/obj/effect/temp_visual/tarot_preview/Initialize(atom/mapload, new_icon_state)
/obj/effect/temp_visual/card_preview/Initialize(atom/mapload, new_icon_state)
. = ..()
if(new_icon_state)
icon_state = "tarot_[new_icon_state]"
icon_state = new_icon_state

flourish()

/obj/effect/temp_visual/card_preview/proc/flourish()
var/new_filter = isnull(get_filter("ray"))
ray_filter_helper(1, 40,"#fcf3dc", 6, 20)
lewcc marked this conversation as resolved.
Show resolved Hide resolved
if(new_filter)
animate(get_filter("ray"), alpha = 0, offset = 10, time = duration, loop = -1)
animate(offset = 0, time = duration)
// todo this is literally just the tarot stuff copy pasted
Burzah marked this conversation as resolved.
Show resolved Hide resolved
lewcc marked this conversation as resolved.
Show resolved Hide resolved

/obj/effect/temp_visual/card_preview/tarot
name = "a tarot card"
icon = 'icons/obj/playing_cards.dmi'
icon_state = "tarot_the_unknown"
pixel_y = 20
duration = 1.5 SECONDS

/obj/effect/temp_visual/card_preview/tarot/flourish()
var/new_filter = isnull(get_filter("ray"))
ray_filter_helper(1, 40,"#fcf3dc", 6, 20)
if(new_filter)
Expand Down
Loading
Loading