Fix issue #100: Add walls to maps
Some checks failed
Test / test (push) Failing after 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-16 00:59:56 +00:00
parent c9ee16f2f2
commit 3c3df58d8d
13 changed files with 1546 additions and 1 deletions

View File

@@ -27,6 +27,19 @@ const MapSchema = new Schema({
x: { type: Number, default: 0 },
y: { type: Number, default: 0 }
}],
// Segments that block the map like walls. The endpoints are image pixels from the top left corner
// of the image, like a pin — and the very space Foundry draws a scene's walls in, so a paired
// scene and map trade them as they stand. `move`/`sight` say what passes through the segment, and
// `door` is 0 (not a door), 1 (open) or 2 (closed), following Foundry's own wall values.
walls: [{
x1: { type: Number, default: 0 },
y1: { type: Number, default: 0 },
x2: { type: Number, default: 0 },
y2: { type: Number, default: 0 },
move: { type: Boolean, default: true },
sight: { type: Boolean, default: true },
door: { type: Number, min: 0, max: 2, default: 0 }
}],
campaign: {
type: Schema.Types.ObjectId,
ref: 'Campaign',
@@ -39,7 +52,16 @@ const MapSchema = new Schema({
ref: 'Folder',
default: null
},
// The Foundry scene whose walls this map mirrors once the linked world has paired them (see
// routes/foundry-link.js): the whole wall set of one is the whole wall set of the other.
foundrySceneId: { type: String },
date: { type: Date, default: Date.now }
});
// A scene walls one map of a campaign at most, like a Foundry actor one actor row.
MapSchema.index(
{ campaign: 1, foundrySceneId: 1 },
{ unique: true, partialFilterExpression: { foundrySceneId: { $type: 'string' } } }
);
module.exports = mongoose.model('Map', MapSchema);