change explosion sounds to factorio sounds

This commit is contained in:
2025-12-01 18:38:06 +01:00
parent 461cefd5e8
commit d501277511
15 changed files with 24 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,12 +2,13 @@ import type { grenadeExplosionAlert } from "web/alerts/types";
import type { AlertRunner } from "./index"; import type { AlertRunner } from "./index";
const duration = 1000; const duration = 1000;
const volume = 0.1; const volume = 1;
export default async function execute( export default async function execute(
alert: grenadeExplosionAlert, alert: grenadeExplosionAlert,
): Promise<AlertRunner> { ): Promise<AlertRunner> {
const audio = new Audio("/alerts/public/explosion2.ogg"); const audioPath = `/alerts/public/explosions/factorioexplosion${Math.ceil(Math.random() * 5)}.ogg`;
const audio = new Audio(audioPath);
audio.volume = volume; audio.volume = volume;
const parentDiv = document.createElement("div"); const parentDiv = document.createElement("div");

View File

@@ -2,12 +2,13 @@ import type { userBlastAlert } from "web/alerts/types";
import type { AlertRunner } from "./index"; import type { AlertRunner } from "./index";
const duration = 1000; const duration = 1000;
const volume = 0.1; const volume = 1;
export default async function execute( export default async function execute(
alert: userBlastAlert, alert: userBlastAlert,
): Promise<AlertRunner> { ): Promise<AlertRunner> {
const audio = new Audio("/alerts/public/explosion1.ogg"); const audioPath = `/alerts/public/explosions/factorioexplosion${Math.ceil(Math.random() * 5)}.ogg`;
const audio = new Audio(audioPath);
audio.volume = volume; audio.volume = volume;
const parentDiv = document.createElement("div"); const parentDiv = document.createElement("div");

View File

@@ -2,7 +2,7 @@ import type { userExecutionAlert } from "web/alerts/types";
import type { AlertRunner } from "./index"; import type { AlertRunner } from "./index";
const duration = 3000; const duration = 3000;
const volume = 0.1; const volume = 1;
export default async function execute( export default async function execute(
alert: userExecutionAlert, alert: userExecutionAlert,
@@ -56,9 +56,13 @@ export default async function execute(
const randomX = Math.floor(Math.random() * (window.innerWidth - 800)); const randomX = Math.floor(Math.random() * (window.innerWidth - 800));
const randomY = Math.floor(Math.random() * (window.innerHeight - 800)); const randomY = Math.floor(Math.random() * (window.innerHeight - 800));
const audio1 = new Audio("/alerts/public/explosion1.ogg"); const audio1 = new Audio(
const audio2 = new Audio("/alerts/public/explosion2.ogg"); "/alerts/public/explosions/factoriolargeexplosion1.ogg",
const audio3 = new Audio("/alerts/public/explosion3.ogg"); );
const audio2 = new Audio(
"/alerts/public/explosions/factoriolargeexplosion1.ogg",
);
const audio3 = new Audio("/alerts/public/explosions/factorionuke.ogg");
audio1.volume = volume; audio1.volume = volume;
audio2.volume = volume; audio2.volume = volume;

View File

@@ -33,6 +33,16 @@ export default Bun.serve({
return new Response(`${target} not found`, { status: 404 }); return new Response(`${target} not found`, { status: 404 });
return new Response(file); return new Response(file);
}, },
// TODO: make this nicer, i don't want to redefine the same thing here every time
"/alerts/public/explosions/:filename": async (req) => {
const target = req.params.filename;
const file = Bun.file(
`${import.meta.dir}/alerts/www/public/explosions/${target}`,
);
if (!(await file.exists()))
return new Response(`${target} not found`, { status: 404 });
return new Response(file);
},
"/": async (req, srv) => { "/": async (req, srv) => {
if (req.headers.get("Upgrade") === "websocket") { if (req.headers.get("Upgrade") === "websocket") {
srv.upgrade(req); srv.upgrade(req);