Skip to content

CFControl

Divided by Zer0 edited this page Mar 9, 2022 · 17 revisions

CFControl

Extends: Node

Description

Card Gaming Framework Control Singleton

Add it to your autoloads with the name 'cfc'

Property Descriptions

ut

var ut: bool

BEGIN Unit Testing Variables

Unit Testing flag

game_settings

var game_settings: Dictionary

END Unit Testing Variables

This variable stores all custom settings for each game. It is initiated by looking for [CFConst#SETTINGS_FILENAME], but if it doesn't exist, defaults to the values specified in CFConst, if applicable.

font_size_cache

var font_size_cache: Dictionary

END Unit Testing Variables

This variable stores all custom settings for each game. It is initiated by looking for [CFConst#SETTINGS_FILENAME], but if it doesn't exist, defaults to the values specified in CFConst, if applicable. This variable stores the font and icon size for each string of text. based on the current card size. This allows us to avoid calculating fonts on the fly all the time and adding delay to card instancing.

cache_commit_timer

var cache_commit_timer: SceneTreeTimer

END Unit Testing Variables

This variable stores all custom settings for each game. It is initiated by looking for [CFConst#SETTINGS_FILENAME], but if it doesn't exist, defaults to the values specified in CFConst, if applicable. This variable stores the font and icon size for each string of text. based on the current card size. This allows us to avoid calculating fonts on the fly all the time and adding delay to card instancing.

game_paused

var game_paused: bool
  • Setter: set_game_paused

If set to true, the player will be prevented from interacting with the game

are_all_nodes_mapped

var are_all_nodes_mapped: bool

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped.

game_rng_seed

var game_rng_seed
  • Setter: set_seed

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable.

card_definitions

var card_definitions: Dictionary

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels

set_scripts

var set_scripts: Dictionary

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts

unmodified_set_scripts

var unmodified_set_scripts: Dictionary

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders

signal_propagator

var signal_propagator

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders A class to propagate script triggers to all cards.

NMAP

var NMAP: Dictionary

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders A class to propagate script triggers to all cards. A dictionary of all our container nodes for easy access

card_drag_ongoing

var card_drag_ongoing: Card

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders A class to propagate script triggers to all cards. A dictionary of all our container nodes for easy access The card actively being dragged

game_rng

var game_rng: RandomNumberGenerator

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders A class to propagate script triggers to all cards. A dictionary of all our container nodes for easy access The card actively being dragged Switch used for seeing debug info Game random number generator

rng_saved_state

var rng_saved_state

If set to true, the player will be prevented from interacting with the game If this is false, all CardContainers will pause in their ready() scene until all other CardContainers have been mapped. The games initial Random Number Generator seed. When this stays the same, the game randomness will always play the predictable. This will store all card properties which are placed in the card labels This will store all card scripts This will store all card scripts, including their format placeholders A class to propagate script triggers to all cards. A dictionary of all our container nodes for easy access The card actively being dragged Switch used for seeing debug info Game random number generator

scripting_engine

var scripting_engine

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class.

script_per

var script_per

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the per script as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class.

alterant_engine

var alterant_engine

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the per script as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the alterant engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class.

alterant_cache

var alterant_cache: Dictionary

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the per script as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the alterant engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. Stores the alterations returned for a specific card-script-value combination.

As the Alterant Engine is scanning all cards in game for alterant scripts then those scripts can further scan cards in play and trigger other alterants this can be a quite heavy operations, when there's a few alterants in play.

To avoid this, after each alterant operation, we store the results in this dictionary, and use them for the next time. This scripts which read properties or counters to be placed even in _process() while there's alterants in play.

card_temp_property_modifiers

var card_temp_property_modifiers

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the per script as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the alterant engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. Stores the alterations returned for a specific card-script-value combination.

As the Alterant Engine is scanning all cards in game for alterant scripts then those scripts can further scan cards in play and trigger other alterants this can be a quite heavy operations, when there's a few alterants in play.

To avoid this, after each alterant operation, we store the results in this dictionary, and use them for the next time. This scripts which read properties or counters to be placed even in _process() while there's alterants in play. This is a copy of card.temp_property_modifiers We store it globally for games which want to have access to it, before subject cards are selected

This dictionary is not used by default anywhere in the framework. A game need to explicitly make use of it.

ov_utils

var ov_utils

We cannot preload the scripting engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the per script as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. We cannot preload the alterant engine as a const for the same reason We cannot refer to it via class name.

If we do, it is parsed by the compiler who then considers it a cyclic reference as the scripting engine refers back to the Card class. Stores the alterations returned for a specific card-script-value combination.

As the Alterant Engine is scanning all cards in game for alterant scripts then those scripts can further scan cards in play and trigger other alterants this can be a quite heavy operations, when there's a few alterants in play.

To avoid this, after each alterant operation, we store the results in this dictionary, and use them for the next time. This scripts which read properties or counters to be placed even in _process() while there's alterants in play. This is a copy of card.temp_property_modifiers We store it globally for games which want to have access to it, before subject cards are selected

This dictionary is not used by default anywhere in the framework. A game need to explicitly make use of it.

curr_scale

var curr_scale: float

script_load_thread

var script_load_thread: Thread

scripts_loading

var scripts_loading: bool

load_start_time

var load_start_time: int

Method Descriptions

map_node

func map_node(node) -> void

The below code allows us to quickly refer to nodes meant to host cards (i.e. parents) using an human-readable name.

Since the fully mapped NMAP variable is critical for the good functioning of the framework, all CardContainers will wait in their ready() process for NMAP to be completed.

set_seed

func set_seed(_seed) -> void

Setter for the ranom seed.

restore_rng_state

func restore_rng_state() -> void

instance_card

func instance_card(card_name: String) -> Card

Instances and returns a Card object, based on its name.

load_card_definitions

func load_card_definitions() -> Dictionary

Returns a Dictionary with the combined Card definitions of all set files

load_script_definitions

func load_script_definitions() -> void

Returns a Dictionary with the combined Script definitions of all set files

set_game_paused

func set_game_paused(value: bool) -> void

Setter for game_paused

set_setting

func set_setting(setting_name: String, value) -> void

Whenever a setting is changed via this function, it also stores it permanently on-disk.

init_settings_from_file

func init_settings_from_file() -> void

Initiates game_settings from the contents of CFConst.SETTINGS_FILENAME

set_font_cache

func set_font_cache() -> void

init_font_cache

func init_font_cache() -> void

Initiates game_settings from the contents of CFConst.SETTINGS_FILENAME

reset_game

func reset_game() -> var

This function resets the game to the same state as when the board loads for the first time. Only works when you're running off of the Main scene.

clear

func clear() -> var

This function clears out the usual game nodes and prepares to either quit the game or reset.

quit_game

func quit_game() -> void

This function exits the card-game part of the framework for example as preparation for returning to the main menu.

flush_cache

func flush_cache() -> void

Empties the alterants cache (only thing cached for now) which will cause all the alterants engine fire anew for all requests.

This is called after most game-state changes, but there's one notable exception: if you add an alterant to a card's scripts variable manually, then you need to flush the cache afterwards using this function.

hide_all_previews

func hide_all_previews() -> void

Signals

  • signal all_nodes_mapped(): Sent when all CGF nodes have been added to the NMAP dictionary
  • signal cache_cleared(): Sent when all CGF nodes have been added to the NMAP dictionary Sent any time the scripting engine cache is cleared
  • signal scripts_loaded(): Sent when all CGF nodes have been added to the NMAP dictionary Sent any time the scripting engine cache is cleared Sent when all Card scripts have finished loading the memory from file
  • signal new_card_instanced(card): Sent when all CGF nodes have been added to the NMAP dictionary Sent any time the scripting engine cache is cleared Sent when all Card scripts have finished loading the memory from file Sent when a new Card node is instanced

Sub-classes

SignalPropagator

Property Descriptions

known_card_signals

var known_card_signals: Array

The working signals cards might send depending on their status changes this array can be extended by signals added by other games

Method Descriptions

connect_new_card

func connect_new_card(card)

When a new card is instanced, it connects all its known signals to the SignalPropagator

Clone this wiki locally