diff --git a/components/GroundMotionComponent.cs b/components/GroundMotionComponent.cs index c7594b8..0c3f049 100644 --- a/components/GroundMotionComponent.cs +++ b/components/GroundMotionComponent.cs @@ -106,6 +106,10 @@ public class GroundMotionComponent : Component } float orientationErrorRadians = entity.GlobalTransform.basis.Quat().AngleTo(targetOrientation); + if (Mathf.Abs(orientationErrorRadians) > Mathf.Pi * 1.1) + { + GD.Print("moep"); + } if (orientationErrorRadians > 0) { Transform entityTransform = entity.Transform; diff --git a/components/NavigationComponent.cs b/components/NavigationComponent.cs index e87db93..fc44f78 100644 --- a/components/NavigationComponent.cs +++ b/components/NavigationComponent.cs @@ -86,6 +86,11 @@ public class NavigationComponent : Node if ((toPositionWorld - TileWorld.GetTileWorldCenterFromOffset(toCell.OffsetCoords)).LengthSquared() > Globals.EpsPositionSquared) { + // Remove the last one, because it is only the position rounded to HexGrid coordinates. + if (_pathWorldNavigationPoints.Count > 1) + { + _pathWorldNavigationPoints.RemoveAt(_pathWorldNavigationPoints.Count - 1); + } _pathWorldNavigationPoints.Add(new NavigationPoint(toPositionWorld)); } diff --git a/scenes/Game.cs b/scenes/Game.cs index 454ccf1..839e2f8 100644 --- a/scenes/Game.cs +++ b/scenes/Game.cs @@ -1,9 +1,6 @@ using Godot; -using System; using System.Diagnostics; using System.Linq; -using GoDotLog; -using Dictionary = Godot.Collections.Dictionary; using Array = Godot.Collections.Array; public class Game : Spatial @@ -80,7 +77,16 @@ public class Game : Spatial _streamContainerArea.Connect("input_event", this, nameof(OnAreaInputEvent)); _streamContainer.Connect("TileClicked", this, nameof(OnTileClicked)); _tileWorld.Connect("WorldGenerated", this, nameof(OnWorldGenerated)); - _chest.Connect("EntityClicked", this, nameof(OnEntityClicked)); + + // register entity events + Array entityNodes = FindNode("Entities").GetChildren(); + foreach (Node node in entityNodes) + { + if (node is Chest) + { + node.Connect("EntityClicked", this, nameof(OnEntityClicked)); + } + } // perform dependency injection //_streamContainer.SetWorld(_tileWorld); diff --git a/scenes/Game.tscn b/scenes/Game.tscn index e6ab0ca..c85e62f 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -35,7 +35,7 @@ albedo_color = Color( 1, 1, 1, 0.156863 ) extents = Vector3( 20, 1, 20 ) [sub_resource type="CapsuleShape" id=7] -radius = 0.4 +radius = 0.3 height = 0.2 [sub_resource type="SpatialMaterial" id=20] @@ -107,7 +107,7 @@ tracks/1/enabled = true tracks/1/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.133333, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.266667, 1, 0, 0, 0, -5.57256e-17, 1.47956e-08, -0.0876532, 0.996151, 1, 1, 1, 0.333333, 1, 0, 0, 0, -1.11023e-16, -2.8211e-10, 0.00209969, 0.999998, 1, 1, 1 ) [sub_resource type="BoxShape" id=16] -extents = Vector3( 0.2, 0.2, 0.332224 ) +extents = Vector3( 0.19, 0.19, 0.332 ) [sub_resource type="CubeMesh" id=17] @@ -320,6 +320,8 @@ fov = 60.0 script = ExtResource( 10 ) [node name="Player" type="KinematicBody" parent="."] +axis_lock_motion_y = true +move_lock_y = true script = ExtResource( 3 ) [node name="CollisionShape" type="CollisionShape" parent="Player"]