-
-
Notifications
You must be signed in to change notification settings - Fork 107
CFControl
Extends: Node
Card Gaming Framework Control Singleton
Add it to your autoloads with the name 'cfc'
var ut: bool
Unit Testing flag
var game_settings: Dictionary
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.
var font_size_cache: Dictionary
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.
var cache_commit_timer: SceneTreeTimer
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.
var game_paused: bool
-
Setter:
set_game_paused
If set to true, the player will be prevented from interacting with the game
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.
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.
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
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
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
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.
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
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
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
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
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.
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.
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.
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.
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.
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.
var curr_scale: float
var script_load_thread: Thread
var scripts_loading: bool
var load_start_time: int
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.
func set_seed(_seed) -> void
Setter for the ranom seed.
func restore_rng_state() -> void
func instance_card(card_name: String) -> Card
Instances and returns a Card object, based on its name.
func load_card_definitions() -> Dictionary
Returns a Dictionary with the combined Card definitions of all set files
func load_script_definitions() -> void
Returns a Dictionary with the combined Script definitions of all set files
func set_game_paused(value: bool) -> void
Setter for game_paused
func set_setting(setting_name: String, value) -> void
Whenever a setting is changed via this function, it also stores it permanently on-disk.
func init_settings_from_file() -> void
Initiates game_settings from the contents of CFConst.SETTINGS_FILENAME
func set_font_cache() -> void
func init_font_cache() -> void
Initiates game_settings from the contents of CFConst.SETTINGS_FILENAME
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.
func clear() -> var
This function clears out the usual game nodes and prepares to either quit the game or reset.
func quit_game() -> void
This function exits the card-game part of the framework for example as preparation for returning to the main menu.
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.
func hide_all_previews() -> void
- 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
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
func connect_new_card(card)
When a new card is instanced, it connects all its known signals to the SignalPropagator