refactor: prepare grass
This commit is contained in:
parent
d6846f294a
commit
8dce162677
|
@ -7,6 +7,7 @@ import {
|
|||
import Renderable from './room/renderable';
|
||||
|
||||
const DIRT = 6;
|
||||
const GRASS = [1, 2, 3, 4, 10, 11, 12];
|
||||
const TILLED = 7;
|
||||
|
||||
export default (Room) => class FarmableRoom extends Room {
|
||||
|
@ -92,7 +93,10 @@ export default (Room) => class FarmableRoom extends Room {
|
|||
|
||||
mayPrepareSoilAt(target) {
|
||||
const [tiles] = this.tiles;
|
||||
return DIRT === tiles.tileAt(target);
|
||||
return (
|
||||
DIRT === tiles.tileAt(target)
|
||||
|| -1 !== GRASS.indexOf(tiles.tileAt(target))
|
||||
);
|
||||
}
|
||||
|
||||
maySowAt(center) {
|
||||
|
@ -117,7 +121,7 @@ export default (Room) => class FarmableRoom extends Room {
|
|||
prepareSoilAt(target) {
|
||||
if ('client' !== process.env.SIDE) {
|
||||
const [tiles] = this.tiles;
|
||||
tiles.setTileAt(target, TILLED);
|
||||
tiles.setTileAt(target, DIRT === tiles.tileAt(target) ? TILLED : DIRT);
|
||||
this.adjustWaterAt(target, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user