Skip to content

CrowdControl

SilicDev edited this page Feb 21, 2024 · 1 revision

CrowdControl

Class: CrowdControl

Inherits: Object

Handles the communication with the Crowd Control API and manages CCEffects.

Description

The CrowdControl singleton allows the managing of the game session and effects.

Properties

type name default
bool auto_starting_session false
bool paused false
bool staging false

Methods

type signature
void close()
Error connect_to_crowd_control()
CCEffect get_effect(effect_id: StringName)const
StreamUser get_streamer_user() const
bool is_connected_to_crowd_control() const
bool is_session_active() const
void login(platform: Platform)
void pause_effect(effect: CCEffectTimed)
void reset_effect(effect: CCEffectTimed)
void resume_effect(effect: CCEffectTimed)
void start_session()
bool stop_effect(effect: CCEffectTimed)
void stop_session()
void test_effect(effect: CCEffect)
void test_effect_remotely(effect: CCEffect)

Signals

authenticated() : Emitted when the client is authenticated with Crowd Control.

coins_exchanged(amount: int, exchanger: StreamUser) : Emitted when a user receives coins.

connected() : Emitted when the client connected successfully to Crowd Control, but before it is authenticated.

connecting() : Emitted when the client attempts to connect to Crowd Control.

connection_errored(err: Error) : Emitted when any error occurs with the connection between Godot and Crowd Control. Use err to determine what went wrong.

disconnected() : Emitted when the client is disconnected from Crowd Control for any reason.

effect_dequeued(id: String, result: EffectResult) : Emitted when an effect is removed from the internal queue.

effect_paused(effect: CCEffectInstanceTimed) : Emitted when an effect was paused.

effect_queued(effect: CCEffectInstance) : Emitted when an effect is added to the internal queue.

effect_requested(effect: CCEffect) : Emitted when the client receives a request to add an effect to the internal queue.

effect_reset(effect: CCEffectInstanceTimed) : Emitted when an effect is restarted.

effect_resumed(effect: CCEffectInstanceTimed) : Emitted when an effect is resumed.

effect_started(effect: CCEffectInstanceTimed) : Emitted when an effect is started.

effect_stopped(effect: CCEffectInstanceTimed) : Emitted when an effect is stopped.

effect_triggered(effect: CCEffectInstance) : Emitted when an effect is triggered.

message_display_requested(message: String, duration: float, icon: Texture2D) : Emitted when a message should be displayed. duration is the duration in seconds the message should be displayed for. icon is an optional texture to display with the message.

session_started() : Emitted when the client successfully started a game session.

session_stopped() : Emitted when game session was stopped.

Enumerations

Platform

  • TWITCH = 0
  • YOUTUBE = 1
  • DISCORD = 2

Property Descriptions

bool paused [default: false] : set_paused(value) setter : is_paused() getter

If true the Crowd Control client will be paused. It will also pause any running effects.

If "crowd_control/common/use_scene_tree_pause" is true this will match SceneTree.paused.

If "crowd_control/common/process_mode" is not "Internal" this is superceded by Godot's pause handling.

bool staging [default: false] : set_staging(value) setter : get_staging() getter

If true the client will connect to the staging server on session start.

Method Descriptions

void close() : Stops a running session and disconnects from Crowd Control.

Error connect_to_crowd_control() : Connects to Crowd Control. If auto_starting_session is true a Crowd Control session is started as soon as the connection is established.

CCEffect get_effect(effect_id: StringName) const : Returns the registered effect with the id effect_id. If no effect with that id is registered it returns null instead.

StreamUser get_streamer_user() const : Returns the data of the user used to authenticate the client.

bool is_connected_to_crowd_control() : Returns true if the program is currently connected to Crowd Control.

bool is_session_active() : Returns true if a Crowd Control session is currently running.

void login(platform: Platform) : Attempts to login using platform for authentication. The player will be redirected to a login page. Once the response is received a session can be started.

void pause_effect(effect: CCEffectTimed) : Pauses any running instance of effect, stopping it from being updated and effecting the game.

void reset_effect(effect: CCEffectTimed) : Resumes any paused instance of effect.

void restart_effect(effect: CCEffectTimed) : Restarts any instance of effect, setting its duration back to full.

void start_session() : Starts a game session, registering all effects stored in the CCEffectEntries at crowd_control/common/effects.

bool stop_effect(effect: CCEffectTimed) : Stops any instance of effect, ending it immediatedly.

void stop_session() : Stops a running game session.

void test_effect(effect: CCEffect) : Tests an effect by calling its trigger function.

void test_effect_remotely(effect: CCEffect) : Tests an effect by requesting it from the API. Use this to debug issues with receiving effects from the extension.

Clone this wiki locally