From 21833381bcc06e4179481435c378ab9dd5c94bee Mon Sep 17 00:00:00 2001 From: Allan Martinez Date: Sat, 24 Feb 2024 11:31:42 -0800 Subject: [PATCH 1/3] add debug env variable to speed up creature walking animation --- .env.example | 4 ++++ src/animations.ts | 5 +++++ src/debug.ts | 2 ++ 3 files changed, 11 insertions(+) diff --git a/.env.example b/.env.example index 114f2940a..3d8c2faa6 100644 --- a/.env.example +++ b/.env.example @@ -49,6 +49,10 @@ 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=true + # ============================================================================= # SERVER # ============================================================================= diff --git a/src/animations.ts b/src/animations.ts index a79387bd0..d945cc412 100644 --- a/src/animations.ts +++ b/src/animations.ts @@ -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 } from './debug'; // to fix @ts-expect-error 2554: properly type the arguments for the trigger functions in `game.ts` @@ -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 = 100; + } + const that = this; const anim = () => { diff --git a/src/debug.ts b/src/debug.ts index ec6648c4e..514f521a9 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -45,3 +45,5 @@ 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); From 6a3b8e0e66bf70984f838230cd5149c972a09f56 Mon Sep 17 00:00:00 2001 From: Allan Martinez Date: Sat, 24 Feb 2024 11:46:04 -0800 Subject: [PATCH 2/3] add env var to control debug walk speed --- .env.example | 1 + src/animations.ts | 4 ++-- src/debug.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 3d8c2faa6..66cee5b04 100644 --- a/.env.example +++ b/.env.example @@ -52,6 +52,7 @@ 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=true +DEBUG_WALK_SPEED=100 #ms # ============================================================================= # SERVER diff --git a/src/animations.ts b/src/animations.ts index d945cc412..d63b4561c 100644 --- a/src/animations.ts +++ b/src/animations.ts @@ -4,7 +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 } from './debug'; +import { DEBUG_ENABLE_FAST_WALKING, DEBUG_WALK_SPEED } from './debug'; // to fix @ts-expect-error 2554: properly type the arguments for the trigger functions in `game.ts` @@ -55,7 +55,7 @@ export class Animations { speed = Number(speed); if (DEBUG_ENABLE_FAST_WALKING) { - speed = 100; + speed = DEBUG_WALK_SPEED; } const that = this; diff --git a/src/debug.ts b/src/debug.ts index 514f521a9..dd7385b0e 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -47,3 +47,4 @@ export const DEBUG_DISABLE_MUSIC = 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 = d && Number(process.env.DEBUG_WALK_SPEED); From d32ff2402743073607d34b716b7e6a001367cc8d Mon Sep 17 00:00:00 2001 From: Allan Martinez Date: Tue, 27 Feb 2024 17:53:11 -0800 Subject: [PATCH 3/3] renamed to innclude units: DEBUG_WALK_SPEED_MS --- .env.example | 4 ++-- src/animations.ts | 4 ++-- src/debug.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 66cee5b04..967dc6e2e 100644 --- a/.env.example +++ b/.env.example @@ -51,8 +51,8 @@ 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=true -DEBUG_WALK_SPEED=100 #ms +DEBUG_ENABLE_FAST_WALKING=false +DEBUG_WALK_SPEED_MS=100 # ============================================================================= # SERVER diff --git a/src/animations.ts b/src/animations.ts index d63b4561c..0ca12ab40 100644 --- a/src/animations.ts +++ b/src/animations.ts @@ -4,7 +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 } from './debug'; +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` @@ -55,7 +55,7 @@ export class Animations { speed = Number(speed); if (DEBUG_ENABLE_FAST_WALKING) { - speed = DEBUG_WALK_SPEED; + speed = DEBUG_WALK_SPEED_MS; } const that = this; diff --git a/src/debug.ts b/src/debug.ts index dd7385b0e..8c4fae03f 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -47,4 +47,4 @@ export const DEBUG_DISABLE_MUSIC = 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 = d && Number(process.env.DEBUG_WALK_SPEED); +export const DEBUG_WALK_SPEED_MS = d && Number(process.env.DEBUG_WALK_SPEED_MS);