y
This commit is contained in:
parent
61718e2981
commit
f657b6a4a4
94 changed files with 3970 additions and 1241 deletions
|
|
@ -40,13 +40,13 @@ function updateFirecracker(item, dt, worldRef) {
|
|||
if ((worldRef.effects.length || 0) >= effectCap) return;
|
||||
const a = global.deterministicAngle(worldRef, "fire-effect-angle", seed || x, y, worldRef.time || 0);
|
||||
const speed = global.deterministicRange(worldRef, "fire-effect-speed", 3, 15, seed || x, y);
|
||||
worldRef.effects.push(new Effect("flame", x, y, {
|
||||
worldRef.spawnEffect("flame", x, y, {
|
||||
vx: Math.cos(a) * speed * 0.35,
|
||||
vy: -Math.max(4, speed * 0.65),
|
||||
size: Math.max(4, size * 0.58),
|
||||
life: global.deterministicRange(worldRef, "fire-effect-life", 0.18, 0.34, seed || x, y),
|
||||
color: "rgba(236,46,24,0.78)",
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function fireInteractionBudget(worldRef) {
|
||||
|
|
@ -99,6 +99,7 @@ function updateFirecracker(item, dt, worldRef) {
|
|||
t.burnTimer = Math.max(t.burnTimer || 0, 5.0);
|
||||
t.thought = FIRE_BURNING_TEXT;
|
||||
t.lastPanicCause = "burning";
|
||||
if (source && source !== t) t.lastPanicThreat = source;
|
||||
t.lastPanicDetail = FIRE_BURNING_TEXT;
|
||||
t.fearTimer = Math.max(t.fearTimer || 0, 1.5);
|
||||
t.sleeping = false;
|
||||
|
|
@ -114,6 +115,7 @@ function updateFirecracker(item, dt, worldRef) {
|
|||
t.firePanicCooldownUntil = now + 0.85;
|
||||
t.firePanicTimer = Math.max(t.firePanicTimer || 0, 1.4);
|
||||
t.lastPanicCause = "fire_seen";
|
||||
if (source && source !== t) t.lastPanicThreat = source;
|
||||
t.lastPanicDetail = FIRE_SEEN_TEXT;
|
||||
t.thought = FIRE_SEEN_TEXT;
|
||||
if (typeof t.enterPanic === "function") t.enterPanic({ threat: source, target: source, reason: FIRE_SEEN_TEXT, fear: 1.25, wake: true, cause: "fire_seen", surpriseTimer: 0.55, awakeLockTimer: 0.35 });
|
||||
|
|
@ -350,14 +352,11 @@ function updateFirecracker(item, dt, worldRef) {
|
|||
const d = distXY(item.x, item.y, ant.x, ant.y);
|
||||
if (d <= spreadRadius + Math.max(ant.r || 5, 4)) changed = igniteAntByFire(ant, item, worldRef) || changed;
|
||||
}
|
||||
const nearby = typeof worldRef.nearbyItems === "function" ? (worldRef.nearbyItems(item.x, item.y, spreadRadius + 38, true) || []) : (worldRef.items || []);
|
||||
const nearby = typeof worldRef.nearbyNonGrassItems === "function"
|
||||
? (worldRef.nearbyNonGrassItems(item.x, item.y, spreadRadius + 38, true) || [])
|
||||
: (worldRef.items || []);
|
||||
for (const it of nearby) {
|
||||
if (!it || it.dead || it === item) continue;
|
||||
if (it.type === "grass" && distXY(item.x, item.y, it.x, it.y) <= spreadRadius + Math.max(it.r || 16, 12)) {
|
||||
const extinguished = tryGrassExtinguishFire(it, item, worldRef, dt);
|
||||
changed = extinguished || changed;
|
||||
if (!extinguished && (item.amount || 0) > 0) changed = igniteGrassByFire(it, item, worldRef, dt) || changed;
|
||||
}
|
||||
if (it.type === "zunchi" && distXY(item.x, item.y, it.x, it.y) <= spreadRadius + Math.max(it.r || 15, 12)) changed = igniteZunchiByFire(it, item, worldRef, dt) || changed;
|
||||
if (it.type === "nest_box" && distXY(item.x, item.y, it.x, it.y) <= spreadRadius + Math.max(it.r || 42, 28) * 1.15) changed = igniteNestBoxByFire(it, item, worldRef) || changed;
|
||||
if (it.type === "water" && distXY(item.x, item.y, it.x, it.y) <= spreadRadius + Math.max(it.r || 10, 8)) {
|
||||
|
|
@ -366,6 +365,12 @@ function updateFirecracker(item, dt, worldRef) {
|
|||
changed = true;
|
||||
}
|
||||
}
|
||||
for (const grass of worldRef.nearbyGrass?.(item.x, item.y, spreadRadius + 38, true) || []) {
|
||||
if (!grass || grass.dead || distXY(item.x, item.y, grass.x, grass.y) > spreadRadius + Math.max(grass.r || 16, 12)) continue;
|
||||
const extinguished = tryGrassExtinguishFire(grass, item, worldRef, dt);
|
||||
changed = extinguished || changed;
|
||||
if (!extinguished && (item.amount || 0) > 0) changed = igniteGrassByFire(grass, item, worldRef, dt) || changed;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue