Add Ghost actually being removed correctly
This commit is contained in:
		
							parent
							
								
									8eb56b39e1
								
							
						
					
					
						commit
						611612892c
					
				| @ -136,6 +136,11 @@ release_block={ | ||||
| "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(224, 40),"global_position":Vector2(238, 110),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) | ||||
| ] | ||||
| } | ||||
| place_block={ | ||||
| "deadzone": 0.5, | ||||
| "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(202, 14),"global_position":Vector2(216, 84),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) | ||||
| ] | ||||
| } | ||||
| 
 | ||||
| [internationalization] | ||||
| 
 | ||||
|  | ||||
| @ -53,8 +53,9 @@ size = Vector3(43.3174, 26.5295, 43.4319) | ||||
| [node name="Player" parent="." instance=ExtResource("10_3xiy2")] | ||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.332064, 1.5426, 3.65156) | ||||
| 
 | ||||
| [node name="table" parent="." node_paths=PackedStringArray("TrenchbroomMap") instance=ExtResource("11_7trvw")] | ||||
| [node name="table" parent="." node_paths=PackedStringArray("Hud", "TrenchbroomMap") instance=ExtResource("11_7trvw")] | ||||
| transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 2.83695, 0, -4.36558) | ||||
| Hud = NodePath("../HUD") | ||||
| TrenchbroomMap = NodePath("../DemoMap") | ||||
| RelativeScale = 0.005 | ||||
| 
 | ||||
|  | ||||
| @ -7,6 +7,8 @@ namespace Gmtk24 { | ||||
|         public Player Player; | ||||
|         [Export] | ||||
|         public RichTextLabel HoverText; | ||||
|         [Export] | ||||
|         public bool InteractionPaused = false; | ||||
| 
 | ||||
|         private Interactible Hovered; | ||||
| 
 | ||||
| @ -24,7 +26,7 @@ namespace Gmtk24 { | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             if (collider is Interactible interactible) { | ||||
|             if (!InteractionPaused && collider is Interactible interactible) { | ||||
|                 if (interactible != Hovered) { | ||||
|                     Hovered?.SetHovered(false); | ||||
|                     interactible.SetHovered(true); | ||||
| @ -48,6 +50,7 @@ namespace Gmtk24 { | ||||
|         public override void _UnhandledInput(InputEvent @event) { | ||||
|             if (@event.IsAction("interact") && Hovered != null) { | ||||
|                 Hovered.HandleInput(@event); | ||||
|                 GetViewport().SetInputAsHandled(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -62,11 +62,15 @@ namespace Gmtk24 { | ||||
|                 CurrentPitch = Mathf.Clamp(CurrentPitch, -Mathf.Pi * 0.49f, 0); | ||||
|             } | ||||
| 
 | ||||
|             if (@event.IsActionPressed("release_block")) { | ||||
|                 if (HeldBlock != null) { | ||||
|             if (HeldBlock != null) { | ||||
|                 if (@event.IsActionPressed("release_block")) { | ||||
|                     EmitSignal(SignalName.BlockRelease, HeldBlock, (uint)BlockReleaseType.Throw); | ||||
|                     HeldBlock = null; | ||||
|                 } | ||||
|                 if (@event.IsActionPressed("place_block")) { | ||||
|                     EmitSignal(SignalName.BlockRelease, HeldBlock, (uint)BlockReleaseType.Place); | ||||
|                     HeldBlock = null; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -3,6 +3,9 @@ using System.Linq; | ||||
| 
 | ||||
| namespace Gmtk24 { | ||||
|     public partial class Table : Interactible { | ||||
|         [Export] | ||||
|         public Hud Hud; | ||||
| 
 | ||||
|         [Export(PropertyHint.NodeType, "FuncGodotMap")] | ||||
|         public Node3D TrenchbroomMap; | ||||
|         [ExportCategory("SpawnOptions")] | ||||
| @ -86,9 +89,13 @@ namespace Gmtk24 { | ||||
|                 Mode = BuildingBlock.BlockMode.NonPhysical, | ||||
|             }; | ||||
|             AddChild(GhostBlock); | ||||
| 
 | ||||
|             // Hud.InteractionPaused = true; | ||||
|         } | ||||
| 
 | ||||
|         public void OnBlockRelease(BuildingBlock block, uint typeUint) { | ||||
|             // Hud.InteractionPaused = false; | ||||
| 
 | ||||
|             if (GhostBlock != null) { | ||||
|                 GhostBlock.QueueFree(); | ||||
|                 GhostBlock = null; | ||||
| @ -97,7 +104,6 @@ namespace Gmtk24 { | ||||
|             BlockReleaseType type = (BlockReleaseType)typeUint; | ||||
|             switch (type) { | ||||
|                 case BlockReleaseType.Throw: { | ||||
| 
 | ||||
|                         block.SetMode(BuildingBlock.BlockMode.Physical); | ||||
|                         block.Reparent(this); | ||||
|                         var normal = Orbit.Camera.ProjectRayNormal(Orbit.Camera.GetViewport().GetMousePosition()); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user