hm
This commit is contained in:
parent
7455d630fc
commit
4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions
20
js/burn_motion_util.js
Normal file
20
js/burn_motion_util.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: shared-runtime/motion
|
||||
// Shared deterministic panic wander used by burning creatures.
|
||||
(function (global) {
|
||||
function updateBurnWanderAngle(entity, dt, opts = {}) {
|
||||
const worldRef = entity?.world || null;
|
||||
entity.burnTurnTimer = Math.max(0, Number(entity.burnTurnTimer || 0) - dt);
|
||||
if (entity.burnTurnTimer <= 0) {
|
||||
const bucket = Math.floor((worldRef?.time || 0) * (opts.bucketScale || 5));
|
||||
entity.burnWanderAngle = deterministicAngle(worldRef, opts.angleKey || "burn-angle", entity, bucket);
|
||||
entity.burnTurnTimer = deterministicRange(worldRef, opts.turnKey || "burn-turn", opts.turnMin ?? 0.10, opts.turnMax ?? 0.34, entity);
|
||||
} else {
|
||||
entity.burnWanderAngle += deterministicRange(worldRef, opts.jitterKey || "burn-jitter", opts.jitterMin ?? -8.0, opts.jitterMax ?? 8.0, entity) * dt;
|
||||
}
|
||||
return entity.burnWanderAngle || 0;
|
||||
}
|
||||
|
||||
global.TarinaiBurnMotionUtil = Object.freeze({ updateBurnWanderAngle });
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
Loading…
Add table
Add a link
Reference in a new issue