diff --git a/entities/Player.cs b/entities/Player.cs index 811f816..1976ee2 100644 --- a/entities/Player.cs +++ b/entities/Player.cs @@ -11,6 +11,8 @@ public class Player : Entity, IInteractionInterface { public int WoodCount; public int GoldCount; + public bool HasAxe = false; + public TaskQueueComponent TaskQueueComponent; public NavigationComponent NavigationComponent { get; private set; } public InteractionComponent InteractionComponent { get; set; } @@ -178,8 +180,10 @@ public class Player : Entity, IInteractionInterface { Debug.Assert(_toolAttachement != null); if (toolName == "Axe") { _toolAttachement.Visible = true; + HasAxe = true; } else if (toolName == "") { _toolAttachement.Visible = false; + HasAxe = false; } } @@ -192,6 +196,12 @@ public class Player : Entity, IInteractionInterface { GD.Print("Player Opening Box"); stateMachine.Travel("Interaction"); } else if (InteractionComponent.TargetEntity is Tree) { + if (!HasAxe) { + GD.Print("Not chopping tree, player has no Axe!"); + InteractionComponent.EndInteraction(); + return; + } + GD.Print("Player Chopping Tree"); stateMachine.Travel("Hit"); } diff --git a/entities/Player.tscn b/entities/Player.tscn index 75ce71c..ff5daf5 100644 --- a/entities/Player.tscn +++ b/entities/Player.tscn @@ -397,6 +397,9 @@ generate_lightmap = false [node name="PirateAsset" parent="Geometry" instance=ExtResource( 8 )] transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) +[node name="Skeleton" parent="Geometry/PirateAsset/Armature" index="0"] +bones/4/bound_children = [ NodePath("ToolAttachement") ] + [node name="ToolAttachement" type="BoneAttachment" parent="Geometry/PirateAsset/Armature/Skeleton" index="5"] transform = Transform( 1, 7.13626e-08, -4.47035e-08, 1.64262e-07, -1, -1.00583e-07, 1.19209e-07, 1.18278e-07, -1, -0.72, 0.45, 1.78362e-08 ) visible = false diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 6246406..ab3d4d6 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -415,6 +415,9 @@ WorldNode = NodePath("../World") [node name="WorldInfo" parent="Player" index="2"] WorldPath = NodePath("../../World") +[node name="Skeleton" parent="Player/Geometry/PirateAsset/Armature" index="0"] +bones/4/bound_children = [ ] + [node name="ToolAttachement" parent="Player/Geometry/PirateAsset/Armature/Skeleton" index="5"] transform = Transform( 1, 7.13626e-08, -4.47035e-08, 1.64262e-07, -1, -1.00583e-07, 1.19209e-07, 1.18278e-07, -1, -0.72, 0.45, 1.78362e-08 ) diff --git a/scenes/World.cs b/scenes/World.cs index 12e6fd0..3799636 100644 --- a/scenes/World.cs +++ b/scenes/World.cs @@ -763,7 +763,6 @@ public class World : Spatial { EmitSignal("TileHovered", tile); HexTile3D.TileTypeInfo tileTypeInfo = GetTileTypeInfoAtOffset(tile.OffsetCoords); - GD.Print("Hover on TileType " + tileTypeInfo.Name + " color: " + tileTypeInfo.Color); } public void OnBlockingSpatialRemoved(Spatial spatialNode) {