summaryrefslogtreecommitdiff
path: root/src/world/cell.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/world/cell.js')
-rw-r--r--src/world/cell.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/world/cell.js b/src/world/cell.js
index 5783d72..6e013c6 100644
--- a/src/world/cell.js
+++ b/src/world/cell.js
@@ -29,13 +29,20 @@ export function cells_apply(cells, proposals) {
(acc, prop) => {
const change = (prop.world_updates || []).reduce(
(acc_, update) => {
- acc_[update.y][update.x].type = update.to;
+ const cell = acc_[update.y][update.x];
+ if (update.to) { cell.type = update.to; }
+ if (update.flags) {
+ cell.flags = cell.flags || {}
+ for (let k of Object.keys(update.flags)) {
+ cell.flags[k] = update.flags[k];
+ }
+ }
return acc_
},
[...acc]
);
return change;
},
- [...cells]
+ [...cells].map(row => row.map(cell => ({ ...cell, flags: {}, })))
);
}