载入中...
搜索中...
未找到
BuildingTypes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
10#include "common/Revision.h"
11
12#include <cstdint>
13#include <string>
14#include <unordered_map>
15#include <vector>
16
17namespace eve::building {
18
20enum class EdgeAxis : uint8_t { Horizontal, Vertical };
21
30 int x = 0;
31 int y = 0;
33
35 bool operator==(const EdgeAddress &) const = default;
36};
37
40 int x = 0;
41 int y = 0;
42
44 bool operator==(const CornerAddress &) const = default;
45};
46
49 uint64_t value = 0;
50
52 explicit operator bool() const { return value != 0; }
54 bool operator==(const EdgeCurveGroupId &) const = default;
55};
56
59 float x = 0.f;
60 float y = 0.f;
61
63 bool operator==(const EdgeCurveControlPoint &) const = default;
64};
65
68 float worldX = 0.f;
69 float worldY = 0.f;
70 float worldZ = 0.f;
71 float normalX = 0.f;
72 float normalY = 1.f;
73 float normalZ = 0.f;
74
76 bool operator==(const EdgeCurveSurfaceSample &) const = default;
77};
78
82 std::string buildingId;
83 int level = 0;
84 std::vector<EdgeCurveControlPoint> controlPoints;
85 int subdivisions = 0;
86 std::vector<int> instanceIds;
90 std::string surfaceId;
91 uint64_t surfaceRevision = 0;
93 std::vector<EdgeCurveSurfaceSample> surfaceSamples;
94
96 bool operator==(const EdgeCurveGroup &) const = default;
97};
98
101 std::string id;
102 std::string displayName;
103 std::string category;
106 std::string channel;
108 std::string renderMode;
110 std::string placementKind = "cell";
112 float freeRadiusCells = 0.25f;
114 float freeFootprintWidthCells = 0.f;
116 float freeFootprintHeightCells = 0.f;
118 std::vector<float> freeFootprintVertices;
120 std::string connectionGroup;
122 std::string structuralRole;
124 std::string supportMode = "none";
126 std::string supportTag;
127 int footprintW = 1;
128 int footprintH = 1;
130 std::vector<uint8_t> footprintMask;
132 std::string snapMode = "grid";
134 std::string rotationMode = "cardinal";
136 std::string validateRule = "default";
138 float maxSurfaceSlopeDegrees = 180.f;
140 float maxSurfaceHeightDelta = -1.f;
141 std::vector<std::string> tags;
143 std::vector<int> requireTerrain;
144 std::vector<int> forbidTerrain;
148 int requireAdjacentTerrain = -1;
149 std::unordered_map<std::string, int> cost;
150 std::unordered_map<std::string, std::string> extra;
152 std::unordered_map<std::string, std::string> visual2d;
154 std::unordered_map<std::string, std::string> visual3d;
155
157 bool hasTag(const std::string &tag) const;
159 std::string getExtra(const std::string &key, const std::string &fallback = {}) const;
161 std::string getVisual2d(const std::string &key, const std::string &fallback = {}) const;
163 std::string getVisual3d(const std::string &key, const std::string &fallback = {}) const;
165 int getCost(const std::string &resource, int fallback = 0) const;
167 bool maskAt(int localX, int localY) const;
168};
169
178 std::string id;
179 std::string type = "building.garrison.member";
180 std::vector<std::string> tags;
181};
182
185 int instanceId = 0;
186 std::string buildingId;
188 std::string placementKind = "cell";
196 float freeRadius = 0.f;
198 float freeHalfWidth = 0.f;
200 float freeHalfHeight = 0.f;
202 std::vector<float> freeFootprintVertices;
203 int originCellX = 0;
204 int originCellY = 0;
206 int level = 0;
207 float worldX = 0.f;
208 float worldY = 0.f;
210 float elevation = 0.f;
212 std::string surfaceId;
214 uint64_t surfaceRevision = 0;
216 float surfaceNormalX = 0.f;
217 float surfaceNormalY = 1.f;
218 float surfaceNormalZ = 0.f;
220 float surfaceTangentX = 1.f;
221 float surfaceTangentY = 0.f;
222 float surfaceTangentZ = 0.f;
223 int surfaceSampleCount = 0;
224 float surfaceMaxSlopeDegrees = 0.f;
225 float surfaceHeightDelta = 0.f;
226 float rotationDeg = 0.f;
227 std::string channel;
228 std::unordered_map<std::string, std::string> props;
229 std::vector<std::string> tags;
231 std::vector<int> supportInstanceIds;
233 std::vector<GarrisonMember> garrison;
235 eve::Revision garrisonRevision = eve::Revision::zero();
236
238 bool hasTag(const std::string &tag) const;
240 std::string getProp(const std::string &key, const std::string &fallback = {}) const;
242 void setProp(const std::string &key, const std::string &value);
243};
244
247 std::string action;
248 std::string worldId;
249 std::string buildingId;
251 std::string otherBuildingId;
252 int instanceId = 0;
253 int cellX = -1;
254 int cellY = -1;
255 int otherCellX = -1;
256 int otherCellY = -1;
257 int level = 0;
258 int otherLevel = 0;
259 float rotationDeg = 0.f;
260 float worldX = 0.f;
261 float worldY = 0.f;
262 float elevation = 0.f;
263 std::string channel;
264};
265
268 std::string buildingId;
269 int cellX = 0;
270 int cellY = 0;
272 int level = 0;
273 float worldX = 0.f;
274 float worldY = 0.f;
275 float elevation = 0.f;
277 std::string surfaceId;
278 uint64_t surfaceRevision = 0;
279 float surfaceNormalX = 0.f;
280 float surfaceNormalY = 1.f;
281 float surfaceNormalZ = 0.f;
285 float rotationDeg = 0.f;
287};
288
291 int cellX = 0;
292 int cellY = 0;
293 float worldX = 0.f;
294 float worldY = 0.f;
295 float elevation = 0.f;
296};
297
303
307 std::vector<PlacedBuilding> removed;
308};
309
315
316} // namespace eve::building
double value
#define EVENGINE_API_WORLD
Definition Export.h:109
std::uint32_t key
float elevation
int level
const std::string * tag
Monotonic state revision for concurrency and change checks.
std::string resource
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:7
EdgeAxis
Canonical orientation of an edge in logical grid coordinates.
一次成功放置变更的事件(供脚本 poll / C++ hook)。
std::string otherBuildingId
Previous definition id for a replace event; empty for other actions.
std::string action
place / remove / move / rotate
建筑模板(进程级注册表中的定义)。
std::unordered_map< std::string, std::string > visual2d
std::vector< float > freeFootprintVertices
Optional convex local polygon as x/y pairs in grid-cell units, centered on the free anchor.
std::string structuralRole
Structural classification such as floor, wall, ceiling, roof, or stair.
std::unordered_map< std::string, int > cost
std::unordered_map< std::string, std::string > visual3d
std::string channel
占地格子尺寸。
std::unordered_map< std::string, std::string > extra
std::string requireAdjacentTag
非空:邻格需有带该 tag 的建筑。
std::vector< int > requireTerrain
空 = 不限制地形语义。
std::string supportTag
Optional tag required on every supporting instance.
std::string connectionGroup
Edge topology compatibility group; empty falls back to building id.
std::vector< uint8_t > footprintMask
可选占地掩码,长度 footprintW*footprintH;空表示实心矩形。行主序、原点在最小 x/y。
std::vector< std::string > tags
Canonical address of one logical grid vertex used by corner objects.
bool operator==(const CornerAddress &) const =default
Operator ==.
Canonical address of one grid edge.
bool operator==(const EdgeAddress &) const =default
Operator ==.
One cubic Bezier control point in logical grid-vertex space.
bool operator==(const EdgeCurveControlPoint &) const =default
Operator ==.
Strong world-local identity of one authoritative edge-curve group.
bool operator==(const EdgeCurveGroupId &) const =default
Operator ==.
World-owned authoritative description and membership of one committed edge curve.
bool operator==(const EdgeCurveGroup &) const =default
Operator ==.
std::vector< EdgeCurveSurfaceSample > surfaceSamples
Owning subdivisions+1 centerline frames for deterministic surface conformance.
std::string surfaceId
Stable provider-returned surface identity shared by every committed sample.
std::vector< EdgeCurveControlPoint > controlPoints
std::string surfaceProviderName
Provider key used to author surfaceSamples; empty means planar projection.
std::vector< int > instanceIds
One committed 3D centerline frame sampled from a custom placement surface.
bool operator==(const EdgeCurveSurfaceSample &) const =default
Operator ==.
One persistent member of a placed building's logical garrison.
std::vector< std::string > tags
已放置的建筑实例。
std::vector< float > freeFootprintVertices
Committed convex local polygon as world-plane x/y pairs; empty selects OBB or circle.
std::vector< std::string > tags
EdgeAddress edge
Canonical edge address when placementKind is edge.
std::vector< GarrisonMember > garrison
Authoritative logical garrison membership, not a render list.
EdgeCurveGroupId edgeCurveGroupId
Optional link to a world-owned curve group; zero means an ordinary edge.
std::unordered_map< std::string, std::string > props
std::vector< int > supportInstanceIds
Derived support links rebuilt from authoritative level/address data.
CornerAddress corner
Canonical grid vertex when placementKind is corner.
std::string surfaceId
Stable provider-local surface name used to create this placement; empty for unsurfaced placement.
Owning before/after receipt produced by one committed placement edit.
校验上下文:传给可插拔规则。
int level
Discrete floor whose occupancy and adjacency are queried.
std::string surfaceId
Surface metadata available to validation rules for surface-derived ghosts.
int excludeInstanceId
move 时排除自身占用
Result metadata for an atomic rebuild of all derived structural links.
Owning record of one committed dependent-first structural removal.
std::vector< PlacedBuilding > removed
Removed instances in the exact order in which occupancy was released.