Skip to content

Commit

Permalink
allow direct placement on empty land
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Apr 22, 2024
1 parent 5acd118 commit 61796e4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions web/src/lib/actions/ActionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {tour} from '$lib/ui/tour/drive';
import {info} from '$lib/ui/information/info';
import {modalStack} from '$utils/ui/modals/ModalContainer.svelte';
import {landmenu} from '$lib/ui/landmenu/landmenu';
import {zeroAddress} from 'viem';

export class ActionHandler {
onCellClicked(x: number, y: number) {
Expand Down Expand Up @@ -91,15 +92,17 @@ export class ActionHandler {
return;
}
accountData.addMove({x, y, color: currentColor, player}, $epochState.epoch);
} else if (currentState.cells[cellID]) {
if (currentState.owners[cellID]?.toLowerCase() !== account.$state.address?.toLowerCase()) {
menu = {
x,
y,
cell: currentState.viewCells[cellID],
owner: currentState.owners[cellID],
};
}
} else if (
currentState.cells[cellID] &&
currentState.owners[cellID]?.toLowerCase() !== account.$state.address?.toLowerCase() &&
currentState.owners[cellID]?.toLowerCase() !== zeroAddress
) {
menu = {
x,
y,
cell: currentState.viewCells[cellID],
owner: currentState.owners[cellID],
};
} else {
if (!$epochState.isActionPhase) {
info.setRevealPhase();
Expand Down

0 comments on commit 61796e4

Please sign in to comment.