CraftingJob ​
Inherits: RefCounted
Represents an active crafting operation with progress tracking Uses a single completion timer instead of polling for smoother performance Progress is calculated on-demand from timer.time_left when needed
Variables ​
CraftingRecipeDefinition | recipe | null |
Entity | crafter | null |
CraftSchoolInstance | craft_school_instance | null |
int | quantity | 1 |
float | duration_per_item | 1.0 |
float | total_duration | 1.0 |
bool | is_active | false |
bool | was_cancelled | false |
bool | is_completed | false |
int | start_time | 0 |
Timer | completion_timer | null |
ChronoManager | chrono_manager |
Methods ​
void | start() |
void | cancel() |
float | get_completion_percentage() |
float | get_remaining_time() |
float | get_elapsed_time() |
int | get_current_item_index() |
float | get_current_item_progress() |
int | get_completed_item_count() |
Dictionary | get_save_data() |
void | restore_from_save( data: Dictionary ) |
String | get_time_remaining_formatted() |
Dictionary | get_job_summary() |
Signals ​
item_completed( item_index: int, total_items: int ) ​
========== SIGNALS ==========
job_completed() ​
Emitted when the crafting is done.
job_cancelled() ​
Emitted when the crafting is cancelled.
Variable descriptions ​
CraftingRecipeDefinition recipe = null ​
The recipe being crafted
Entity crafter = null ​
The entity doing the crafting
CraftSchoolInstance craft_school_instance = null ​
The craft school instance handling this job
int quantity = 1 ​
How many items are being crafted
float duration_per_item = 1.0 ​
Time per individual item
float total_duration = 1.0 ​
Total time for the entire job
bool is_active = false ​
Whether this job is currently active
bool was_cancelled = false ​
Whether this job was cancelled
bool is_completed = false ​
Whether this job completed successfully
int start_time = 0 ​
When the job started (using Time.get_ticks_msec())
Timer completion_timer = null ​
Single completion timer from ChronoManager pool
ChronoManager chrono_manager ​
ChronoManager system ref
Method descriptions ​
void start() ​
Start the crafting job
void cancel() ​
Cancel the crafting job
float get_completion_percentage() ​
Get completion percentage (0.0 to 1.0)
float get_remaining_time() ​
Get remaining time in seconds
float get_elapsed_time() ​
Get elapsed time in seconds
int get_current_item_index() ​
Get current item being worked on (1-indexed)
float get_current_item_progress() ​
Get progress on current item (0.0 to 1.0)
int get_completed_item_count() ​
Get how many items have been completed so far
Dictionary get_save_data() ​
Get data for saving the job state
void restore_from_save( data: Dictionary ) ​
Restore job from saved data
String get_time_remaining_formatted() ​
Get formatted time remaining string
Dictionary get_job_summary() ​
Get job summary for UI display