live scan fix
This commit is contained in:
@@ -126,8 +126,9 @@
|
||||
|
||||
// --- Bind to GameEvents (passive, zero server cost) ---
|
||||
try {
|
||||
// New incoming attack detected
|
||||
uw.$.Observer(uw.GameEvents.attack.incoming).subscribe(
|
||||
// New incoming attack detected (This event works according to logs)
|
||||
const attackEvent = uw.GameEvents?.attack?.incoming || 'attack:incoming';
|
||||
uw.$.Observer(attackEvent).subscribe(
|
||||
'GRC_TRACKER_ATTACK',
|
||||
function(e, data) {
|
||||
// Small delay so game model updates before we read it
|
||||
@@ -141,17 +142,25 @@
|
||||
|
||||
try {
|
||||
// Any command state changed (sent, landed, recalled, etc.)
|
||||
uw.$.Observer(uw.GameEvents.command.change).subscribe(
|
||||
// Fallback to string if the constant doesn't exist in this version
|
||||
const cmdEvent = (uw.GameEvents?.command && uw.GameEvents.command.change)
|
||||
? uw.GameEvents.command.change
|
||||
: 'CommandsMenuBubble:change';
|
||||
|
||||
uw.$.Observer(cmdEvent).subscribe(
|
||||
'GRC_TRACKER_CMD',
|
||||
function(e, data) {
|
||||
setTimeout(_pushMovements, 500);
|
||||
}
|
||||
);
|
||||
log('[tracker] ✅ Subscribed to command.change event');
|
||||
log('[tracker] ✅ Subscribed to command changes');
|
||||
} catch (e) {
|
||||
log(`[tracker] Could not subscribe to command.change: ${e}`);
|
||||
log(`[tracker] Could not subscribe to command changes: ${e}`);
|
||||
}
|
||||
|
||||
// --- Failsafe: push every 15 seconds regardless of events ---
|
||||
setInterval(_pushMovements, 15000);
|
||||
|
||||
}, 6000); // 6s after boot — ensures CommandsMenuBubble model is loaded
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user