You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
hexmap/common/src/actions/TileAction.ts

28 lines
929 B

import {BaseAction} from "./BaseAction";
import {StorageCoordinates} from "../state/Coordinates";
import {AppAction} from "./AppAction";
export const TILE_PAINT = "TILE_PAINT"
export interface TilePaintAction extends BaseAction {
readonly type: typeof TILE_PAINT
readonly at: StorageCoordinates
}
export function isTilePaintAction(action: AppAction): action is TilePaintAction {
return action.type === TILE_PAINT
}
export const TILE_REMOVE = "TILE_REMOVE"
export interface TileRemoveAction extends BaseAction {
readonly type: typeof TILE_REMOVE
readonly at: StorageCoordinates
}
export function isTileRemoveAction(action: AppAction): action is TileRemoveAction {
return action.type === TILE_REMOVE
}
export function isTileAction(action: AppAction): action is TileAction {
return isTilePaintAction(action) || isTileRemoveAction(action)
}
export type TileAction = TilePaintAction | TileRemoveAction