Merge pull request #14186 from SmArtKar/trading_card_game

[READY][PORT] Codename: Blue Eyes White Jumpsuit, the Citadel TCG. Part 1
This commit is contained in:
silicons
2021-02-17 01:30:13 -07:00
committed by GitHub
35 changed files with 3199 additions and 19 deletions

View File

@@ -490,6 +490,28 @@ SUBSYSTEM_DEF(job)
job.after_spawn(H, M, joined_late) // note: this happens before the mob has a key! M will always have a client, H might not.
equip_loadout(N, H, TRUE)//CIT CHANGE - makes players spawn with in-backpack loadout items properly. A little hacky but it works
if(ishuman(H) && H.client && N)
if(H.client && H.client.prefs && length(H.client.prefs.tcg_cards))
var/obj/item/tcgcard_binder/binder = new(get_turf(H))
if(!H.equip_to_slot_if_possible(binder, SLOT_IN_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
qdel(binder)
else
for(var/card_type in H.client.prefs.tcg_cards)
var/obj/item/tcg_card/card = new(get_turf(H), card_type, H.client.prefs.tcg_cards[card_type])
card.forceMove(binder)
binder.cards.Add(card)
binder.check_for_exodia()
else
if(H && N.client.prefs && length(N.client.prefs.tcg_cards))
var/obj/item/tcgcard_binder/binder = new(get_turf(H))
if(!H.equip_to_slot_if_possible(binder, SLOT_IN_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
qdel(binder)
else
for(var/card_type in N.client.prefs.tcg_cards)
var/obj/item/tcg_card/card = new(get_turf(H), card_type, H.client.prefs.tcg_cards[card_type])
card.forceMove(binder)
binder.cards.Add(card)
return H
/*
/datum/controller/subsystem/job/proc/handle_auto_deadmin_roles(client/C, rank)

View File

@@ -88,6 +88,7 @@ SUBSYSTEM_DEF(persistence)
SavePhotoPersistence() //THIS IS PERSISTENCE, NOT THE LOGGING PORTION.
SavePaintings()
SaveScars()
SaveTCGCards()
/**
* Loads persistent data relevant to the current map: Objects, etc.
@@ -349,3 +350,25 @@ SUBSYSTEM_DEF(persistence)
if(!ending_human.client)
return
ending_human.client.prefs.save_character()
/datum/controller/subsystem/persistence/proc/SaveTCGCards()
for(var/i in GLOB.joined_player_list)
var/mob/living/carbon/human/ending_human = get_mob_by_ckey(i)
if(!istype(ending_human) || !ending_human.mind || !ending_human.client || !ending_human.client.prefs || !ending_human.client.prefs.tcg_cards)
continue
var/mob/living/carbon/human/original_human = ending_human.mind.original_character
if(!original_human || original_human.stat == DEAD || !(original_human == ending_human))
continue
var/obj/item/tcgcard_binder/binder = locate() in ending_human
if(!binder || !length(binder.cards))
continue
var/list/card_types = list()
for(var/obj/item/tcg_card/card in binder.cards)
//if(!card.illegal) //Uncomment if you want to block syndie cards from saving
card_types[card.datum_type] = card.illegal
ending_human.client.prefs.tcg_cards = card_types
ending_human.client.prefs.save_character(TRUE)