PartyManager ​
Inherits: Node3D
PartyManager manages the physical containers and setup for the player party system.
Description ​
Key features:
- Creates physical containers for players
- Handles party inventory setup
- Manages the reserve (recruited companions waiting outside the active party)
- Switching between party members and the AI companions the others become
- Integrates cleanly with new PartyManager
- Supports flexible party sizes
Variables ​
int | max_party_slots | 4 |
Player | current_player | |
Array[Player] | reserve_players | [] |
Array[Player] | players | [] |
int | max_party_size | 4 |
Array[CharacterDefinition] | party_composition | [] |
CustomCharacterDefinition | custom_player_start_definition | null |
int | next_player_unique_id | 1 |
bool | players_in_combat | false |
PlayerController | player_controller | |
CameraController | camera_controller | |
CraftingManager | crafting_manager | |
SkillHolders | skill_holders | |
InventoryComponent | shared_bag | null |
InventoryComponent | shared_wallet | null |
WorldContainer | world_container |
Methods ​
InventoryComponent | make_member_inventory( own: InventoryComponent ) |
void | reset_shared_inventory() |
bool | setup_initial_party( system_hub: GameHost.SystemHub, loading_screen: LoadingScreen = null ) |
bool | create_players_from_party_composition( system_hub: GameHost.SystemHub, p_party_composition: Array[CharacterDefinition], loading_screen: LoadingScreen = null ) |
Player | create_player_from_character( system_hub: GameHost.SystemHub, character_def: CharacterDefinition ) |
bool | add_player( player: Player ) |
bool | remove_player( player: Player ) |
void | clear_all_players() |
void | set_current_player( player: Player ) |
Player | get_current_player() |
Node3D | get_current_player_target() |
String | get_switch_denial( player: Player ) |
bool | can_switch_to( player: Player ) |
bool | try_switch_to( player: Player ) |
bool | switch_to_next( step: int = 1 ) |
bool | is_party_in_combat() |
int | get_max_reserve_size() |
bool | is_reserve_full() |
bool | can_recruit() |
RecruitResult | recruit_player( player: Player ) |
void | add_to_reserve( player: Player ) |
bool | move_to_reserve( player: Player, ignore_limits: bool = false ) |
bool | move_to_party( player: Player ) |
bool | swap_with_reserve( party_member: Player, reserve_member: Player ) |
void | set_max_party_size( new_size: int ) |
bool | has_companion_of_definition( character_definition_id: int ) |
Array[Player] | get_all_companions() |
void | force_game_over() |
Player | get_main_character() |
void | respawn_player( player: Player, respawn_point: Marker3D ) |
void | respawn_party_at_checkpoint() |
int | get_party_size() |
Array[Player] | get_party_members() |
bool | is_party_full() |
Player | get_player( index: int ) |
Player | get_player_by_unique_id( unique_id: int ) |
bool | is_party_empty() |
void | set_custom_player_definition( definition: CustomCharacterDefinition ) |
void | clear_custom_player_definition() |
bool | has_custom_player_definition() |
void | grant_party_experience( amount: int ) |
Dictionary | to_save_data() |
Signals ​
player_added( player: Player, slot_index: int ) ​
---------- Signals ---------- Signal emitted when a new player is added to party
player_removed( player: Player, slot_index: int ) ​
Signal emitted when a player is removed from party
party_setup_complete( players: Array[Player] ) ​
Signal emitted when party setup is complete
party_cleared() ​
Signal emitted when party is cleared
new_current_player( companion: Player ) ​
Signal emitted when the current player changes
switch_denied( player: Player, reason: String ) ​
Signal emitted when the player could not switch to a member (the reason is a short sentence for the UI)
reserve_changed() ​
Signal emitted when a member enters or leaves the reserve
party_levels_changed() ​
Signal emitted when a member of the party levels up (the level the NPCs scale to may have changed)
game_over_triggered( death_behavior: GameplayConfig.DeathBehavior, dead_player: Player ) ​
Death System Signals Signal emitted when game over is triggered (for UI to respond)
respawn_requested( player: Player, respawn_point: Marker3D ) ​
Signal emitted when respawn is requested
party_combat_changed( in_combat: bool ) ​
The party entered or left a fight (a member is in combat or none is): the combat music follows it
Enumerations ​
enum RecruitResult ​
Where a recruit ended up
- REFUSED =
0 - PARTY =
1 - RESERVE =
2
Variable descriptions ​
int max_party_slots = 4 ​
---------- Core Properties ---------- Maximum number of party slots (the size of the active party, from the Gameplay Config)
Player current_player ​
The Player currently being controlled by the user
Array[Player] reserve_players = [] ​
Companions the user has outside of the active party: they are recruited, wait out of the world and gain reserve experience
Array[Player] players = [] ​
Array of all players in the party
int max_party_size = 4 ​
Maximum number of players in the active party (from the Gameplay Config, an event can change it)
Array[CharacterDefinition] party_composition = [] ​
Party composition data for new game setup (array of CharacterDefinitions)
CustomCharacterDefinition custom_player_start_definition = null ​
Custom player definition from character creation (used as first party member)
int next_player_unique_id = 1 ​
Tracks the next available player slot ID (starts at 1, increments)
bool players_in_combat = false ​
Combat status flag
PlayerController player_controller ​
The player controller
CameraController camera_controller ​
The player camera
CraftingManager crafting_manager ​
CraftingManager system ref
SkillHolders skill_holders ​
The skill trees and points that are not a character's: the professions and the factions
InventoryComponent shared_bag = null ​
The bag the whole party uses (GameplayConfig.inventory_sharing = shared currency and bag), or null
InventoryComponent shared_wallet = null ​
The purse the whole party uses (shared currency), or null
WorldContainer world_container ​
WorldContainer system ref
Method descriptions ​
InventoryComponent make_member_inventory( own: InventoryComponent ) ​
The inventory a new party member (or a member that waits in the reserve) uses: its own, with the shared purse, or the one bag of the party
void reset_shared_inventory() ​
Empties the shared bag and purse (a new game)
bool setup_initial_party( system_hub: GameHost.SystemHub, loading_screen: LoadingScreen = null ) ​
Setup initial party based on character creation settings This is the main entry point for party setup that handles both custom character creation and default party composition flows
bool create_players_from_party_composition( system_hub: GameHost.SystemHub, p_party_composition: Array[CharacterDefinition], loading_screen: LoadingScreen = null ) ​
Create players from party composition array of CharacterDefinitions
Player create_player_from_character( system_hub: GameHost.SystemHub, character_def: CharacterDefinition ) ​
Create a Player from a CharacterDefinition
bool add_player( player: Player ) ​
Add a player to the party
bool remove_player( player: Player ) ​
Remove a player from the party or from the reserve (a dismissed companion is gone for good)
void clear_all_players() ​
Clear all players from the party and the reserve
void set_current_player( player: Player ) ​
Set the current player (the one being controlled). This is the raw call (setup, loading, the death of the player in control): the switch the player asks for goes through try_switch_to, which obeys the gameplay options
Player get_current_player() ​
Get the current player
Node3D get_current_player_target() ​
The target of the current player.
String get_switch_denial( player: Player ) ​
Why the player cannot take over this member right now ("" = it can)
bool can_switch_to( player: Player ) ​
Can the player take over this member right now (the gameplay options allow it)?
bool try_switch_to( player: Player ) ​
The player takes over a party member (the former one becomes a companion). False (and switch_denied) if the options or the state forbid it
bool switch_to_next( step: int = 1 ) ​
Take over the next (step 1) or the previous (step -1) member that can be taken over
bool is_party_in_combat() ​
Is any member of the party in a fight?
int get_max_reserve_size() ​
How many companions can wait in the reserve
bool is_reserve_full() ​
Is the reserve full?
bool can_recruit() ​
Is there room for one more recruit (in the party or in the reserve)?
RecruitResult recruit_player( player: Player ) ​
A new companion joins: the party if there is room, else the reserve, else it is turned down (the caller keeps the player then)
void add_to_reserve( player: Player ) ​
Put a player that is not yet in the party straight into the reserve
bool move_to_reserve( player: Player, ignore_limits: bool = false ) ​
A party member waits in the reserve (it leaves the world; the party keeps at least one member)
bool move_to_party( player: Player ) ​
A companion from the reserve joins the party (next to the member the player controls)
bool swap_with_reserve( party_member: Player, reserve_member: Player ) ​
A party member and a companion of the reserve change places
void set_max_party_size( new_size: int ) ​
Change the size of the active party at run time: members beyond the new size wait in the reserve (nobody is lost; the reserve limit only applies to new recruits)
bool has_companion_of_definition( character_definition_id: int ) ​
Is a companion made from this character definition already here (in the party or the reserve)?
Array[Player] get_all_companions() ​
Every companion the player has (the party and the reserve)
void force_game_over() ​
Ends the game now (a quest that ends the game when it fails, an event): the game over, whatever the death behaviour of the settings says
Player get_main_character() ​
The main character: the member in slot 0 of the party (its death ends the game with the game over and permadeath behaviours; it cannot be put in the reserve). null when the project has no main character (Gameplay Config: Has main character off, with character switching allowed): any member can wait in the reserve and only the death of the whole party ends the game
void respawn_player( player: Player, respawn_point: Marker3D ) ​
Respawn a player at a specific location
void respawn_party_at_checkpoint() ​
Respawn entire party (for party wipe scenarios or reload)
int get_party_size() ​
Get number of players in party
Array[Player] get_party_members() ​
Get all party members
bool is_party_full() ​
Check if party is full
Player get_player( index: int ) ​
Get player by index (0-based)
Player get_player_by_unique_id( unique_id: int ) ​
Get player by their unique ID (slot number)
bool is_party_empty() ​
Check if party is empty
void set_custom_player_definition( definition: CustomCharacterDefinition ) ​
Set the custom player definition for the next game start Call this from character creation UI before starting a new game
void clear_custom_player_definition() ​
Clear the custom player definition
bool has_custom_player_definition() ​
Check if a custom player definition is set
void grant_party_experience( amount: int ) ​
Grant experience: the party gets all of it, the companions in the reserve a share of it (when the reserve experience is on)
Dictionary to_save_data() ​
Save PartyManager state including all party members