From e08ba2ca37269cd0423231f168b6e5825a8664e0 Mon Sep 17 00:00:00 2001 From: copygirl Date: Sat, 1 May 2021 14:45:17 +0200 Subject: [PATCH] Fix CreativeBuilding being active on other players --- src/CreativeBuilding.cs | 8 ++++++-- src/Cursor.cs | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CreativeBuilding.cs b/src/CreativeBuilding.cs index 1228331..2cd2d78 100644 --- a/src/CreativeBuilding.cs +++ b/src/CreativeBuilding.cs @@ -13,7 +13,9 @@ public class CreativeBuilding : Node2D [Export] public int MaxLength { get; set; } = 6; + private Player _player; private Texture _blockTex; + private BlockPos _startPos; private Facing _direction; private int _length; @@ -23,13 +25,15 @@ public class CreativeBuilding : Node2D public override void _Ready() { + _player = GetParent(); _blockTex = GD.Load("res://gfx/block.png"); } public override void _PhysicsProcess(float delta) { - if (!(this.GetGame() is Client client)) return; - Update(); + if (!_player.IsLocal) return; + var client = this.GetClient(); + Update(); // Make sure _Draw is being called. if (EscapeMenu.Instance.Visible || !client.Cursor.Visible) { _currentMode = null; return; } diff --git a/src/Cursor.cs b/src/Cursor.cs index 4181010..48214b4 100644 --- a/src/Cursor.cs +++ b/src/Cursor.cs @@ -9,6 +9,8 @@ public class Cursor : Node2D public override void _Notification(int what) { + // TODO: Keep mouse visible when it was pressed down in the game window. + // Meaning the game will continue to receive mouse move updates. switch (what) { case MainLoop.NotificationWmMouseEnter: Visible = true; break; case MainLoop.NotificationWmMouseExit: Visible = false; break;