Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fantasy-maphub",
"name_full": "Fantasy MapHub Generators",
"version": "1.2.2",
"version": "1.2.3-add-data-other-types-of-.1",
"description": "An offline-first hub that bundles several Watabou map generators into one consistent web app: same UI patterns, local assets, and modern import/export. It adds OpenAPI docs, proto-first serialization (including pure protobuf files), and a PWA build so everything works without an internet connection.",
"license": "MPL-2.0",
"author": "mail@sunsung.fun",
Expand All @@ -27,7 +27,8 @@
"build:rewrite:tags": "node scripts/replace-tags-dist.mjs",
"build:rewrite:minify": "node scripts/minify-static-js.mjs",
"build:rewrite:hash-url": "node scripts/add-query-hash.mjs",
"build:list": "run-s build:gen:index-pages build:gen:icons build:gen:languages build:gen:openapi build:rewrite:tags build:rewrite:minify build:rewrite:hash-url",
"build:gen:sitemap": "node scripts/generate-sitemap.mjs",
"build:list": "run-s build:gen:index-pages build:gen:icons build:gen:languages build:gen:openapi build:rewrite:tags build:rewrite:minify build:rewrite:hash-url build:gen:sitemap",
"build": "vite build && npm run build:list",
"preview": "vite preview",
"test": "vitest run",
Expand Down
31 changes: 31 additions & 0 deletions protobuf/data/dwellings/decor.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package data;

import "data/dwellings/enum.proto";
import "data/dwellings/types.proto";

// // // //

message DwellingsLightObj {
DwellingsPointObj pos = 1;
float radius = 2;
float power = 3;
bool on = 4;
}

message DwellingsPropObj {
DwellingsPropType kind = 1;
DwellingsPointObj pos = 2;
DwellingsEdgeObj wall = 3;
DwellingsEdgeObj from_edge = 4;
DwellingsEdgeObj to_edge = 5;
}

message DwellingsPolygonObj {
repeated DwellingsPointObj points = 1;
}

message DwellingsDecorGroupObj {
repeated DwellingsPolygonObj polygons = 1;
}
21 changes: 20 additions & 1 deletion protobuf/data/dwellings/enum.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,23 @@ enum DwellingsDoorType {
NULL = 1;
DOORWAY = 2;
REGULAR = 3;
}
}


enum DwellingsPropType {
PROP_UNSPECIFIED = 0;
ALTAR = 1;
STATUE = 2;
CURTAIN = 3;
BED = 4;
}

enum DwellingsArchitectureType {
ARCHITECTURE_UNSPECIFIED = 0;

simple = 1;
castle = 2;
logs = 3;
modern = 4;
scifi = 5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ syntax = "proto3";
package data;

import "data/dwellings/enum.proto";
import "data/dwellings/types.proto";
import "data/dwellings/decor.proto";

// // // //

message DwellingsCellObj {
int32 i = 1;
int32 j = 2;
}

message DwellingsRoomObj {
optional string name = 1;
repeated DwellingsCellObj cells = 2;
}
reserved 3 to 9;

message DwellingsEdgeObj {
DwellingsCellObj cell = 1;
DwellingsDirectionType dir = 2;
optional string embed_type_id = 10;
optional DwellingsLightObj embed_light = 11;
repeated DwellingsPropObj embed_props = 12;
repeated DwellingsDecorGroupObj embed_decor = 13;
}

message DwellingsDoorObj {
Expand All @@ -30,4 +28,7 @@ message DwellingsStairObj {
DwellingsCellObj cell = 1;
DwellingsDirectionType dir = 2;
bool up = 3;
}
reserved 4 to 9;

optional bool embed_trapdoor = 10;
}
11 changes: 10 additions & 1 deletion protobuf/data/dwellings/obj.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ syntax = "proto3";

package data;

import "data/dwellings/lvl.proto";
import "data/dwellings/enum.proto";
import "data/dwellings/types.proto";
import "data/dwellings/level.proto";

// // // //

Expand All @@ -12,6 +14,9 @@ message DwellingsPlanObj {
repeated DwellingsDoorObj doors = 3;
repeated DwellingsEdgeObj windows = 4;
repeated DwellingsStairObj stairs = 5;
reserved 6 to 19;

repeated DwellingsCellObj embed_chimneys = 20;
}

//
Expand All @@ -20,4 +25,8 @@ message DwellingsObj {
repeated DwellingsPlanObj floors = 1;
DwellingsEdgeObj exit = 2;
DwellingsEdgeObj spiral = 3;
reserved 4 to 19;

optional string embed_name = 20;
optional DwellingsArchitectureType embed_architecture = 21;
}
22 changes: 22 additions & 0 deletions protobuf/data/dwellings/types.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

package data;

import "data/dwellings/enum.proto";

// // // //

message DwellingsCellObj {
int32 i = 1;
int32 j = 2;
}

message DwellingsPointObj {
float x = 1;
float y = 2;
}

message DwellingsEdgeObj {
DwellingsCellObj cell = 1;
DwellingsDirectionType dir = 2;
}
30 changes: 30 additions & 0 deletions protobuf/data/geo/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";

package data;

import "google/protobuf/struct.proto";

// // // //

message GeoTransformObj {
double scale = 1;
double cx = 2;
double cy = 3;
bool invert_y = 4;
uint32 precision_pow10 = 5;
}

message GeoBBoxObj {
double min_x = 1;
double min_y = 2;
double max_x = 3;
double max_y = 4;
}

message GeoPartObj {
uint32 index = 1;
string uid = 2;
google.protobuf.Struct props = 3;
string name = 4;
GeoBBoxObj bbox = 5;
}
105 changes: 105 additions & 0 deletions protobuf/data/geo/editor.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
syntax = "proto3";

package data;

import "google/protobuf/struct.proto";
import "data/geo/enum.proto";

// // // //

message EditorPoint2DObj {
double x = 1;
double y = 2;
}

message EditorPolylineObj {
repeated EditorPoint2DObj points = 1;
bool closed = 2;
}

message EditorBezierObj {
repeated EditorPoint2DObj control_points = 1;

bool closed = 2;
uint32 segments = 3;
}

message EditorArcObj {
EditorPoint2DObj center = 1;
double radius = 2;
double start_angle_rad = 3;
double end_angle_rad = 4;
bool ccw = 5;
}

message EditorLinkObj {
string a_uid = 1;
string b_uid = 2;
EditorLinkType type = 3;
google.protobuf.Struct props = 4;
}

message EditorLayerStateObj {
string layer_id = 1;
bool visible = 2;
bool locked = 3;
int32 z_index = 4;
}

message EditorGroupObj {
string group_uid = 1;
string name = 2;
repeated string member_uids = 3;
google.protobuf.Struct props = 4;
}

message EditorRoadModelObj {
string target_uid = 1;
EditorPolylineObj centerline = 2;
double width = 3;
bool closed = 4;
google.protobuf.Struct props = 5;
}

message EditorShapeModelObj {
string target_uid = 1;

oneof model {
EditorPolylineObj polyline = 2;
EditorBezierObj bezier = 3;
EditorArcObj arc = 4;
}

google.protobuf.Struct props = 10;
}

message EditorSnapNodeObj {
string node_uid = 1;
EditorPoint2DObj pos = 2;
repeated string incident_uids = 3;
google.protobuf.Struct props = 4;
}

message EditorConstraintObj {
string constraint_uid = 1;
EditorConstraintType type = 2;
repeated string target_uids = 3;
google.protobuf.Struct params = 4;
}

message EditorPayloadObj {
uint32 payload_rev = 1;
EditorCoordSpaceType coord_space = 2;

repeated EditorLayerStateObj layers = 10;
repeated EditorGroupObj groups = 11;
repeated EditorLinkObj links = 12;

repeated EditorRoadModelObj road_models = 20;
repeated EditorShapeModelObj shape_models = 21;

repeated EditorSnapNodeObj snap_nodes = 30;
repeated EditorConstraintObj constraints = 31;

google.protobuf.Struct props = 40;
}
27 changes: 24 additions & 3 deletions protobuf/data/geo/enum.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ syntax = "proto3";

package data;

import "google/protobuf/struct.proto";

// // // //

enum GeoFeatureType {
Expand Down Expand Up @@ -58,4 +56,27 @@ enum GeoType {
Polygon = 23;
MultiPolygon = 24;
reserved 25 to 50;
}
}

enum EditorCoordSpaceType {
EDITOR_COORD_SPACE_UNSPECIFIED = 0;
world = 1;
export = 2;
}

enum EditorLinkType {
EDITOR_LINK_TYPE_UNSPECIFIED = 0;
EDITOR_LINK_TYPE_PARENT_CHILD = 1;
EDITOR_LINK_TYPE_GROUP_MEMBER = 2;
EDITOR_LINK_TYPE_ATTACH = 3;
EDITOR_LINK_TYPE_OVER_UNDER = 4;
EDITOR_LINK_TYPE_ALONG = 5;
}

enum EditorConstraintType {
EDITOR_CONSTRAINT_TYPE_UNSPECIFIED = 0;
EDITOR_CONSTRAINT_TYPE_SNAP = 1;
EDITOR_CONSTRAINT_TYPE_FIXED_LENGTH = 2;
EDITOR_CONSTRAINT_TYPE_PARALLEL = 3;
EDITOR_CONSTRAINT_TYPE_PERPENDICULAR = 4;
}
14 changes: 11 additions & 3 deletions protobuf/data/geo/obj.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,37 @@ package data;

import "google/protobuf/struct.proto";
import "data/geo/enum.proto";
import "data/geo/common.proto";
import "data/geo/editor.proto";

// // // //

message GeoObj {
GeoType type = 1;
GeoObj geometry = 2;
google.protobuf.ListValue coordinates = 3;
reserved 4 to 9;
reserved 4 to 8;
string embed_uid = 9;

repeated GeoObj features = 10;
repeated GeoObj geometries = 11;
reserved 12 to 19;
reserved 12 to 16;
repeated GeoPartObj embed_parts = 17;
GeoTransformObj embed_export_transform = 18;
GeoBBoxObj embed_bbox = 19;

optional GeoGeneratorType generator = 20;
optional GeoFeatureType id = 21;
optional string version = 22;
optional string name = 23;
optional double width = 24;
reserved 25 to 39;
reserved 25 to 38;
google.protobuf.Struct embed_props = 39;

optional double road_width = 40;
optional double river_width = 41;
optional double tower_radius = 42;
optional double wall_thickness = 43;
reserved 44 to 79;
EditorPayloadObj embed_editor_payload = 80;
}
Loading