DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.86k stars 471 forks source link

replace EventManager scanning (and other forms of event detection) with dfhooks-based event callbacks #4793

Open myk002 opened 2 months ago

myk002 commented 2 months ago

job-related hooks are the top priority. This API may be sufficient:

// called after a new job object is inserted in the jobs linked list
void dfhooks_on_job_created(df::job *job);

// called after a job is assigned to a unit
void dfhooks_on_job_assigned(df::job *job, df::unit *unit);

// called after job is completed, but before the job object is destroyed or reused for a repeat job
enum JobCompletionStatus {
    UNKNOWN = -1,
    SUCCESS,
    ABANDONED,  // e.g. due to missing items, etc.
    CANCELED_BY_PLAYER
};
void dfhooks_on_job_completion(df::job *job, JobCompletionStatus completion_status);