event tweaking

This commit is contained in:
legop3
2026-04-19 16:16:20 -04:00
parent aee4f61976
commit adb13fc69c
8 changed files with 48 additions and 48 deletions
@@ -1,5 +1,5 @@
const STEP_MS = 220;
const STEPS = 10;
const STEPS = 40;
module.exports = {
id: 'cameraWhiplash',
+1 -1
View File
@@ -1,4 +1,4 @@
const DURATION_MS = 5 * 60 * 1000;
const DURATION_MS = 15 * 60 * 1000;
const LIGHT_ENFORCE_TICK_MS = 3000;
let activeTimer = null;
+11 -15
View File
@@ -1,19 +1,15 @@
const STROBE_MS = 10000;
const TICK_MS = 350;
const STROBE_MS = 30 * 1000;
const TICK_MS = 70;
let activeTimer = null;
async function applyAll(ctx, state) {
function applyAll(ctx, state) {
const entities = ctx.getHomeAssistantEntities();
await Promise.all(
entities.map(async (entity) => {
try {
await ctx.setHomeAssistantEntityState(entity.id, state);
} catch (err) {
ctx.logger.warn('lightStrobe entity set failed', { entityId: entity.id, error: err.message });
}
}),
);
entities.forEach((entity) => {
ctx.setHomeAssistantEntityState(entity.id, state).catch((err) => {
ctx.logger.warn('lightStrobe entity set failed', { entityId: entity.id, error: err.message });
});
});
}
function startStrobe(ctx, effect = {}) {
@@ -26,7 +22,7 @@ function startStrobe(ctx, effect = {}) {
let on = Boolean(effect.on);
ctx.saveEffect('lightStrobe', { endsAt, on });
activeTimer = setInterval(async () => {
activeTimer = setInterval(() => {
if (Date.now() >= endsAt) {
clearInterval(activeTimer);
activeTimer = null;
@@ -34,7 +30,7 @@ function startStrobe(ctx, effect = {}) {
return;
}
on = !on;
await applyAll(ctx, on ? 'on' : 'off');
applyAll(ctx, on ? 'on' : 'off');
ctx.saveEffect('lightStrobe', { endsAt, on });
}, TICK_MS);
}
@@ -45,7 +41,7 @@ module.exports = {
goal: 300,
async run(ctx) {
startStrobe(ctx, { endsAt: Date.now() + STROBE_MS, on: false });
ctx.sendAlert({ color: '#ffc107', title: 'Light Strobe', message: 'Room light strobe started.' });
ctx.sendAlert({ color: '#ffc107', title: 'Light Strobe', message: 'All room controls strobing for 30 seconds.' });
},
async recover(ctx, effect) {
if (!effect || Number(effect.endsAt || 0) <= Date.now()) {
@@ -1,16 +0,0 @@
const COLORS = ['#f44336', '#ff9800', '#ffeb3b', '#4caf50', '#2196f3', '#9c27b0', '#e91e63'];
const TITLES = ['RARARARARARARARARE', 'CHIRPET CHIRPET CHIRPET', 'meowmowmoowmomwowm', 'theleash'];
module.exports = {
id: 'rogueEventSpam',
name: 'Event Flood',
goal: 100,
async run(ctx) {
for (let i = 0; i < 500; i += 1) {
const color = COLORS[Math.floor(Math.random() * COLORS.length)];
const title = TITLES[Math.floor(Math.random() * TITLES.length)];
const message = `Event ${i + 1} / 10`;
ctx.sendAlert({ color, title, message });
}
},
};
-2
View File
@@ -4,7 +4,6 @@ const lightStrobe = require('./definitions/lightStrobe');
const ghostTypingSpam = require('./definitions/ghostTypingSpam');
const darkness = require('./definitions/darkness');
const discordStalkerPing = require('./definitions/discordStalkerPing');
const rogueEventSpam = require('./definitions/rogueEventSpam');
const modeJam = require('./definitions/modeJam');
const assignmentRoulette = require('./definitions/assignmentRoulette');
const chatSpam = require('./definitions/chatSpam');
@@ -16,7 +15,6 @@ const orderedRewards = [
ghostTypingSpam,
darkness,
discordStalkerPing,
rogueEventSpam,
modeJam,
assignmentRoulette,
chatSpam,