Skip to content

Commit

Permalink
cancel block line build when unable to place blocks
Browse files Browse the repository at this point in the history
also prioritize secondary action over primary
  • Loading branch information
siecvi committed Jan 13, 2025
1 parent 05a0749 commit dd6e938
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Sources/Client/Client_Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ namespace spades {
if (!CanLocalPlayerUseTool()) {
winp.primary = false;
winp.secondary = false;

player.SetBlockCursorDragging(false);
}

// disable weapon while reloading (except shotgun)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Client/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ namespace spades {
newInput.secondary = false;
}

if (newInput.primary)
newInput.secondary = false;
if (newInput.secondary)
newInput.primary = false;
if (newInput.secondary != weapInput.secondary) {
if (newInput.secondary) {
if (blockCursorActive) {
Expand Down
1 change: 1 addition & 0 deletions Sources/Client/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ namespace spades {
void PlayerJump();
bool IsBlockCursorActive() { return blockCursorActive; }
bool IsBlockCursorDragging() { return blockCursorDragging; }
void SetBlockCursorDragging(bool value) { blockCursorDragging = value; }
IntVector3 GetBlockCursorPos() { return blockCursorPos; }
IntVector3 GetBlockCursorDragPos() { return blockCursorDragPos; }
bool IsReadyToUseTool();
Expand Down

0 comments on commit dd6e938

Please sign in to comment.