diff --git a/browser/src/CrossPlatform/AI.fs b/browser/src/CrossPlatform/AI.fs index f589450..ed19bea 100644 --- a/browser/src/CrossPlatform/AI.fs +++ b/browser/src/CrossPlatform/AI.fs @@ -58,12 +58,27 @@ let getNextState canSeePlayer enemy = ) () | _ -> enemy.State +// This conversion required because FSharp do not play +// along with NativeAOT inside interpolated strings + enums. +// Be explicit about how to display strings. +let getStateString state = + match state with + | EnemyStateType.Standing -> "Standing" + | EnemyStateType.Ambushing -> "Ambushing" + | EnemyStateType.Attack -> "Attack" + | EnemyStateType.Path -> "Path" + | EnemyStateType.Pain -> "Pain" + | EnemyStateType.Shoot -> "Shoot" + | EnemyStateType.Chase -> "Chase" + | EnemyStateType.Die -> "Die" + | EnemyStateType.Dead -> "Dead" + let preProcess game enemy = // preprocess looks for state changes based on the current game world state let canSeePlayer = enemy |> isPlayerVisibleToEnemy game let newState = enemy |> getNextState canSeePlayer if newState <> enemy.State then - Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {enemy.State} to {newState}" + Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {getStateString enemy.State} to {getStateString newState}" { enemy with State = newState } else enemy diff --git a/desktop/FSharpWolfenstein.Desktop.fsproj b/desktop/FSharpWolfenstein.Desktop.fsproj index 74c5450..39829cb 100644 --- a/desktop/FSharpWolfenstein.Desktop.fsproj +++ b/desktop/FSharpWolfenstein.Desktop.fsproj @@ -5,6 +5,8 @@ net6.0 true true + true + link