cletus/bot/core/context.js
roberts ff43ffc5de
All checks were successful
Deploy Cletus Bot / deploy (push) Successful in 26s
Updated Idle and Observe logic, and added combat engagement and task locking.
2025-05-10 18:40:52 -05:00

29 lines
760 B
JavaScript

// core/context.js
let bot = null;
let stateMachine = null;
let lastChat = null;
let activeTask = null;
let combatLocked = false;
module.exports = {
setBot: (instance) => { bot = instance; },
getBot: () => bot,
setStateMachine: (machine) => { stateMachine = machine; },
getStateMachine: () => stateMachine,
setLastChat: (chat) => { lastChat = chat; },
getLastChat: () => lastChat,
setDB: (dbInstance) => { db = dbInstance; },
getDB: () => db,
getContextSnapshot: () => ({ bot, lastChat }),
setActiveTask: (taskName) => { activeTask = taskName; },
clearActiveTask: () => { activeTask = null; },
getActiveTask: () => activeTask,
setCombatLock: (value) => { combatLocked = value; },
isCombatLocked: () => combatLocked
};