Player ​
Inherits: Entity < CharacterBody3D
Player represents a player-controlled character in the game. It extends the base Entity class with specific features for player characters, including class specialization, experience and leveling systems, and player-specific interactions.
Description ​
Key features:
- Implements player class system with associated stats and abilities
- Manages skill trees and point pool progression
- Handles experience points and leveling
- Supports player AI with follow/attack stances
- Manages action bar configuration
- Integrates with the game's UI and interaction systems
Properties ​
PlayerClassDefinition: | player_class |
Variables ​
int | experience | 0: |
int | experience_requirement | |
bool | follow_stance | true: |
bool | attack_stance | true |
Array[ActionBarSlotData] | action_bar_configuration | [] |
Dictionary | action_bar_locked | {} |
Dictionary | action_bar_reserved | {} |
bool | is_awaiting_target | false |
Array[SkillTreeInstance] | skill_tree_instances | [] |
Array[SkillPointPoolInstance] | skill_point_pools | [] |
Array[int] | granted_skill_tree_ids | [] |
Array[EquipmentSlotDefinition] | unlocked_equipment_slots | [] |
Marker3D | drop_location | |
AudioListener3D | audio_listener | |
Area3D | interaction_area | |
CollisionShape3D | interaction_shape | |
Array | nearby_interactables | [] |
Variant | current_interact_target | null |
bool | can_interact | false |
bool | target_locked | false: |
PlayerController | player_controller | |
PartyManager | party_manager | |
Array[Reward] | pending_rewards | [] |
ProficiencyTracker | proficiencies | |
int | chosen_language_id | 0 |
bool | is_reserved | false |
Methods ​
int | get_proficiency_level( proficiency_id: int ) |
int | get_spoken_language_id() |
ProficiencyTracker | get_proficiencies() |
void | set_reserved( value: bool ) |
Dictionary | grant_reward( reward: Reward, for_good: bool = false ) |
AbilityInstance | get_basic_attack() |
bool | is_companion() |
void | initialize_entity( system_hub: GameHost.SystemHub ) |
void | equip_starting_gear() |
Array[SkillTree] | get_skill_tree_definitions() |
bool | grant_skill_tree( tree_id: int ) |
bool | revoke_skill_tree( tree_id: int ) |
Array[SkillTreeInstance] | get_all_skill_tree_instances() |
Array[SkillPointPoolInstance] | get_all_skill_point_pools() |
SkillTreeInstance | get_skill_tree_instance( tree_id: int ) |
SkillPointPoolInstance | get_skill_point_pool_instance( pool_id: int ) |
bool | can_spend_from_pool( pool_def: SkillPointPool, amount: int = 1 ) |
bool | spend_points_from_pool( pool_def: SkillPointPool, amount: int = 1 ) |
bool | refund_points_to_pool( pool_def: SkillPointPool, amount: int = 1 ) |
bool | award_points_to_pool( pool_def: SkillPointPool, amount: int = 1 ) |
bool | add_skill_points_to_pool( pool_id: int, amount: int ) |
bool | remove_skill_points_from_pool( pool_id: int, amount: int ) |
int | get_available_skill_points( pool_id: int ) |
Dictionary | can_unlock_skill_node( tree_id: int, node_id: int ) |
bool | unlock_skill_node( tree_id: int, node_id: int, choice_index: int = -1 ) |
bool | refund_skill_node( tree_id: int, node_id: int, full_refund: bool = false ) |
bool | has_skill_node_unlocked( tree_id: int, node_id: int ) |
int | get_skill_node_rank( tree_id: int, node_id: int ) |
void | reset_skill_tree( tree_id: int ) |
bool | is_equipment_slot_unlocked( slot: EquipmentSlotDefinition ) |
void | unlock_equipment_slot( slot: EquipmentSlotDefinition ) |
void | lock_equipment_slots( slots: Array ) |
void | lock_equipment_slot( slot: EquipmentSlotDefinition ) |
void | level_up() |
void | update_experience( amount: int ) |
bool | can_level_up() |
int | get_experience_needed_for_next_level() |
int | get_max_level() |
int | get_action_bar_slot_count() |
bool | is_action_bar_slot_locked( slot_index: int ) |
void | validate_action_bar_integrity() |
void | update_action_bar_slot( slot_index: int, slot_data: ActionBarSlotData, by_system: bool = false ) |
void | clear_action_bar_slot( slot_index: int ) |
void | set_action_bar_slot_ability( slot_index: int, ability_id: int, lock_change: int = 0 ) |
void | push_action_bar_override( slot_index: int, source: Variant, ability: AbilityInstance ) |
void | remove_action_bar_override( slot_index: int, source: Variant ) |
bool | is_action_bar_slot_covered( slot_index: int ) |
void | apply_action_bar_layout() |
Variant | get_action_bar_content( slot_index: int ) |
void | initialize_action_bar( slot_count: int = 10 ) |
Array | serialize_action_bar() |
void | deserialize_action_bar( serialized_bar: Array ) |
String | get_player_class_name() |
bool | has_valid_player_class() |
void | interact() |
DroppedItem | drop_from_bag( item: ItemInstance, quantity: int = -1 ) |
DroppedItem | drop_item_instance( piece: ItemInstance ) |
void | entity_death( announce: bool = true ) |
Dictionary | to_save_data() |
void | from_save_data( save_data: Dictionary, system_hub: GameHost.SystemHub ) |
Signals ​
action_bar_configuration_updated( slot_index: int, slot_data: ActionBarSlotData ) ​
Signal emitted when action bar configuration changes
player_class_changed( new_class: PlayerClassDefinition ) ​
Signal emitted when player class changes
target_lock_changed( is_locked: bool, locked_target: Variant ) ​
Signal emitted when target lock state changes
reward_blocked( reward: Reward, reason: String ) ​
Signal emitted when a reward could not be given (no room in the bag): it waits in pending_rewards
reward_given( reward: Reward ) ​
Signal emitted when a reward was given (also one that had waited)
experience_gained( amount: int ) ​
Emitted when the player gains experience, with what was gained (after the experience multiplier)
Property descriptions ​
PlayerClassDefinition: player_class ​
The PlayerClassDefinition resource that defines this player's class template
Variable descriptions ​
int experience = 0: ​
Current experience amount for this Player Experience towards the next level (what is left over after the levels it paid for; what a level costs is get_experience_needed_for_next_level())
int experience_requirement ​
Required amount of experience needed for next level up
bool follow_stance = true: ​
Stance of a companion (while the player does not control this member): follow the member in control (off: stay where it is)
bool attack_stance = true ​
Stance of a companion: fight freely, joining the fights of the party (off: passive, it only fights back when it is attacked)
Array[ActionBarSlotData] action_bar_configuration = [] ​
Actionbar configuration for this player: what each slot shows now (an effect can cover what the player put on it, see push_action_bar_override)
Dictionary action_bar_locked = ​
The slots the player cannot change (a plan of the class, an event): slot index -> true. Saved
Dictionary action_bar_reserved = ​
The slots that wait for an ability the player has not learned yet: slot index -> ability id. Saved. The ability goes on its slot when it is learned
bool is_awaiting_target = false ​
Flag indicating if player is waiting for player to select a target for an ability
Array[SkillTreeInstance] skill_tree_instances = [] ​
Active skill tree instances for this player
Array[SkillPointPoolInstance] skill_point_pools = [] ​
Skill point pool instances for available pools
Array[int] granted_skill_tree_ids = [] ​
Skill trees given to this player by a reward (a specialization, a quest, an event): saved with the player, on top of the trees of its class and its character
Array[EquipmentSlotDefinition] unlocked_equipment_slots = [] ​
Currently unlocked equipment slots for this player
Marker3D drop_location ​
Position marker for where dropped items appear
AudioListener3D audio_listener ​
The audio listen to redirect 3d audio listen position from camera to the player
Area3D interaction_area ​
Area3D for detecting nearby interactables (3m radius cylinder)
CollisionShape3D interaction_shape ​
CollisionShape3D for the interaction area
Array nearby_interactables = [] ​
Array of nearby interactables within detection radius
Variant current_interact_target = null ​
Current target detected by the interact raycast
bool can_interact = false ​
Whether the player can currently interact with a detected target
bool target_locked = false: ​
Whether player is locked onto current target
PlayerController player_controller ​
Kinda don't like process logic anyway so lets figure a better solution
PartyManager party_manager ​
The party manager this player belongs to (rewards reach the crafting manager through it)
Array[Reward] pending_rewards = [] ​
Rewards that could not be given yet (no room for an item): they wait here, are saved, and are given as soon as the bag has room
ProficiencyTracker proficiencies ​
The skill of the player in weapon types, armor classes, schools and any skill the game adds (see ProficiencyDefinition)
int chosen_language_id = 0 ​
The language the player has chosen to speak (/language). 0 = the one of the character
bool is_reserved = false ​
Is this companion waiting in the reserve of the party (out of the world, not run by anything)?
Method descriptions ​
int get_proficiency_level( proficiency_id: int ) ​
The level of a proficiency now, boosts included (see ProficiencyTracker.get_level)
int get_spoken_language_id() ​
The language this character speaks: the one the player chose, else the one of its definition
ProficiencyTracker get_proficiencies() ​
The proficiency tracker. It exists before the player is set up when something needs it early (a level 1 reward gives a proficiency level while the character is made)
void set_reserved( value: bool ) ​
A companion in the reserve leaves the world: hidden, not processed, not detected, and it detects nothing. Joining the party undoes it
Dictionary grant_reward( reward: Reward, for_good: bool = false ) ​
Give a reward. One that cannot be given right now (no room for its items) waits instead of being lost: the player is warned and it is given when there is room. The answer has pending set then. for_good: the reward is the player's from now on (a quest, a conversation, an event, a trainer): an ability or a rank it gives is saved with the player. Left off, the caller keeps the reward itself and gives it again after a load (a skill tree, the levels of a class)
AbilityInstance get_basic_attack() ​
The basic attack of a player is the one of the weapon, unless the project turns the built-in basic attack off (then there is none: slot 1 is a slot like any other)
bool is_companion() ​
Is this member run by the AI (a party member the player does not control)?
void initialize_entity( system_hub: GameHost.SystemHub ) ​
Initializes the player entity, extending the base entity initialization
void equip_starting_gear() ​
Equip starting gear from CharacterDefinition override or PlayerClassDefinition Called by PartyManager after player is in the scene tree so rig mesh assignments work
Array[SkillTree] get_skill_tree_definitions() ​
The skill trees this player has of its own: the trees of its class, then the ones of its character, then the ones a reward gave (each once)
bool grant_skill_tree( tree_id: int ) ​
Gives the player a skill tree (a reward gives it). False when it has the tree already or the tree does not exist
bool revoke_skill_tree( tree_id: int ) ​
Takes a tree a reward gave away again: what was spent in it is refunded and its rewards are taken back. False when the tree was not given by a reward
Array[SkillTreeInstance] get_all_skill_tree_instances() ​
Every skill tree the player can see: its own, the ones of the professions and the ones of the factions
Array[SkillPointPoolInstance] get_all_skill_point_pools() ​
Every skill point pool of the player: its own, the ones of its professions and the ones of the factions
SkillTreeInstance get_skill_tree_instance( tree_id: int ) ​
Get skill tree instance by definition ID (the player's own, then the ones of the professions and the factions)
SkillPointPoolInstance get_skill_point_pool_instance( pool_id: int ) ​
Get skill point pool instance by definition ID. The points of a profession or a faction pool are kept by the owner of those (SkillHolders), not by the character
bool can_spend_from_pool( pool_def: SkillPointPool, amount: int = 1 ) ​
Check if player can spend points from a specific pool
bool spend_points_from_pool( pool_def: SkillPointPool, amount: int = 1 ) ​
Spend points from a skill point pool
bool refund_points_to_pool( pool_def: SkillPointPool, amount: int = 1 ) ​
Refund points to a skill point pool
bool award_points_to_pool( pool_def: SkillPointPool, amount: int = 1 ) ​
Award points to a skill point pool
bool add_skill_points_to_pool( pool_id: int, amount: int ) ​
Gives points to a skill point pool by its id (what a skill point reward does); false when the pool does not exist or is capped
bool remove_skill_points_from_pool( pool_id: int, amount: int ) ​
Takes points that are not spent away again (an unapplied reward)
int get_available_skill_points( pool_id: int ) ​
Get available points in a pool (convenience)
Dictionary can_unlock_skill_node( tree_id: int, node_id: int ) ​
Check if player can unlock a specific node
bool unlock_skill_node( tree_id: int, node_id: int, choice_index: int = -1 ) ​
Unlock a skill node
bool refund_skill_node( tree_id: int, node_id: int, full_refund: bool = false ) ​
Refund a skill node
bool has_skill_node_unlocked( tree_id: int, node_id: int ) ​
Check if player has unlocked a specific node
int get_skill_node_rank( tree_id: int, node_id: int ) ​
Get current rank of a skill node
void reset_skill_tree( tree_id: int ) ​
Reset entire skill tree
bool is_equipment_slot_unlocked( slot: EquipmentSlotDefinition ) ​
Check if an equipment slot is unlocked
void unlock_equipment_slot( slot: EquipmentSlotDefinition ) ​
Unlock an equipment slot
void lock_equipment_slots( slots: Array ) ​
Locks several slots (what an unapplied slot reward does)
void lock_equipment_slot( slot: EquipmentSlotDefinition ) ​
Lock an equipment slot
void level_up() ​
Level up a specific player
void update_experience( amount: int ) ​
Update experience and check for level ups
bool can_level_up() ​
Check if player can level up
int get_experience_needed_for_next_level() ​
Get experience needed for next level
int get_max_level() ​
Get max level from player class
int get_action_bar_slot_count() ​
How many slots the action bar has (the setting of the project)
bool is_action_bar_slot_locked( slot_index: int ) ​
Can the player not change this slot? (the project says the bar is fixed, the plan of the class or an event locked it, or an effect covers it)
void validate_action_bar_integrity() ​
Validate all action bar slots and clean up invalid references
void update_action_bar_slot( slot_index: int, slot_data: ActionBarSlotData, by_system: bool = false ) ​
Updates the action bar configuration at the specified index Parameters:
- slot_index: The index in the action bar to update (0-based)
- ability: The ability to assign to the slot, or null to clear it
by_system is true for the game itself (events, the plan of a class, cleaning up): the player's own change of a slot that is locked is refused (the bar shows what it holds again)
void clear_action_bar_slot( slot_index: int ) ​
Clear action bar slot (by the game: a locked slot is cleared too)
void set_action_bar_slot_ability( slot_index: int, ability_id: int, lock_change: int = 0 ) ​
Puts an ability on a slot, empties it (ability_id 0), or reserves it for an ability that is not known yet (it goes there when it is learned). lock_change: 0 keep the lock as it is, 1 lock, 2 unlock. A locked slot keeps its plan: the ability goes back to it when it is learned again
void push_action_bar_override( slot_index: int, source: Variant, ability: AbilityInstance ) ​
An effect covers a slot: it shows ability (null = the slot is empty and cannot be used) and the player cannot change it. What was on the slot comes back when the effect ends (remove_action_bar_override)
void remove_action_bar_override( slot_index: int, source: Variant ) ​
Takes away what a source put on a slot of the action bar; the slot shows what was under it.
bool is_action_bar_slot_covered( slot_index: int ) ​
Is an effect covering this slot?
void apply_action_bar_layout() ​
The plan of the player class goes on the bar: each planned slot gets its ability (or waits for it) and its lock
Variant get_action_bar_content( slot_index: int ) ​
Get content at action bar slot
void initialize_action_bar( slot_count: int = 10 ) ​
Initialize action bar with default size
Array serialize_action_bar() ​
Serialize action bar configuration (what the player put on the slots: a slot an effect covers saves what is underneath)
void deserialize_action_bar( serialized_bar: Array ) ​
Deserialize action bar configuration
String get_player_class_name() ​
Get display name for current PlayerClassDefinition
bool has_valid_player_class() ​
Check if player has a valid PlayerClassDefinition assigned
void interact() ​
Performs interaction with the current nearest target
DroppedItem drop_from_bag( item: ItemInstance, quantity: int = -1 ) ​
Drops an item of the bag (or part of its stack) on the ground in front of the character. Gives the dropped item, or null when it cannot be dropped: dropped items are off in the Gameplay Config, the item is a key item, or the item is not in the bag
DroppedItem drop_item_instance( piece: ItemInstance ) ​
Drops an item that is already out of the bag (dragged out of it, or taken off) on the ground in front of the character
void entity_death( announce: bool = true ) ​
A player that dies loses items when the Gameplay Config says so
Dictionary to_save_data() ​
Save player data including skill trees and point pools
void from_save_data( save_data: Dictionary, system_hub: GameHost.SystemHub ) ​
Load player data including skill trees and point pools