Skip to content

Commit

Permalink
Merge pull request #2551 from allmtz/faster-walking
Browse files Browse the repository at this point in the history
Modify creature walk speed in debug mode
  • Loading branch information
DreadKnight authored Feb 28, 2024
2 parents 1d3085f + d32ff24 commit 0be088e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ DEBUG_DISABLE_MUSIC=false
# like Ctrl+Alt+C for developer tools, etc.
DEBUG_DISABLE_HOTKEYS=false

# If true, creature walking animation will be much shorter
# Useful for minimizing the down time waiting for creatures to get in position
DEBUG_ENABLE_FAST_WALKING=false
DEBUG_WALK_SPEED_MS=100

# =============================================================================
# SERVER
# =============================================================================
Expand Down
5 changes: 5 additions & 0 deletions src/animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Creature } from './creature';
import { Hex } from './utility/hex';
import { Ability } from './ability';
import { QuadraticCurve } from './utility/curve';
import { DEBUG_ENABLE_FAST_WALKING, DEBUG_WALK_SPEED_MS } from './debug';

// to fix @ts-expect-error 2554: properly type the arguments for the trigger functions in `game.ts`

Expand Down Expand Up @@ -53,6 +54,10 @@ export class Animations {
let speed = !opts.overrideSpeed ? creature.animation.walk_speed : opts.overrideSpeed;
speed = Number(speed);

if (DEBUG_ENABLE_FAST_WALKING) {
speed = DEBUG_WALK_SPEED_MS;
}

const that = this;

const anim = () => {
Expand Down
3 changes: 3 additions & 0 deletions src/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ export const DEBUG_DISABLE_MUSIC =
d && toBool(process.env.DEBUG_DISABLE_MUSIC) && DEBUG_AUTO_START_GAME;

export const DEBUG_DISABLE_HOTKEYS = d && toBool(process.env.DEBUG_DISABLE_HOTKEYS);

export const DEBUG_ENABLE_FAST_WALKING = d && toBool(process.env.DEBUG_ENABLE_FAST_WALKING);
export const DEBUG_WALK_SPEED_MS = d && Number(process.env.DEBUG_WALK_SPEED_MS);

0 comments on commit 0be088e

Please sign in to comment.