载入中...
搜索中...
未找到
BuildingTypes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
4
5
11#include "common/Revision.h"
12
13#include <cstdint>
14#include <string>
15#include <unordered_map>
16#include <vector>
17
18namespace eve::building {
19
21enum class EdgeAxis : uint8_t { Horizontal, Vertical };
22
31 int x = 0;
32 int y = 0;
34
36 bool operator==(const EdgeAddress &) const = default;
37};
38
41 int x = 0;
42 int y = 0;
43
45 bool operator==(const CornerAddress &) const = default;
46};
47
50 uint64_t value = 0;
51
53 explicit operator bool() const { return value != 0; }
55 bool operator==(const EdgeCurveGroupId &) const = default;
56};
57
60 float x = 0.f;
61 float y = 0.f;
62
64 bool operator==(const EdgeCurveControlPoint &) const = default;
65};
66
69 float worldX = 0.f;
70 float worldY = 0.f;
71 float worldZ = 0.f;
72 float normalX = 0.f;
73 float normalY = 1.f;
74 float normalZ = 0.f;
75
77 bool operator==(const EdgeCurveSurfaceSample &) const = default;
78};
79
83 std::string buildingId;
84 int level = 0;
85 std::vector<EdgeCurveControlPoint> controlPoints;
86 int subdivisions = 0;
87 std::vector<int> instanceIds;
91 std::string surfaceId;
92 uint64_t surfaceRevision = 0;
94 std::vector<EdgeCurveSurfaceSample> surfaceSamples;
95
97 bool operator==(const EdgeCurveGroup &) const = default;
98};
99
102 std::string id;
103 std::string displayName;
104 std::string category;
107 std::string channel;
109 std::string renderMode;
111 std::string placementKind = "cell";
113 float freeRadiusCells = 0.25f;
115 float freeFootprintWidthCells = 0.f;
117 float freeFootprintHeightCells = 0.f;
119 std::vector<float> freeFootprintVertices;
121 std::string connectionGroup;
123 float edgeThicknessCells = 0.f;
125 std::vector<std::string> blockedByEdgeChannels;
127 std::string structuralRole;
129 std::string supportMode = "none";
131 std::string supportTag;
132 int footprintW = 1;
133 int footprintH = 1;
135 std::vector<uint8_t> footprintMask;
137 std::string snapMode = "grid";
139 std::string rotationMode = "cardinal";
141 std::string validateRule = "default";
143 float maxSurfaceSlopeDegrees = 180.f;
145 float maxSurfaceHeightDelta = -1.f;
146 std::vector<std::string> tags;
148 std::vector<int> requireTerrain;
149 std::vector<int> forbidTerrain;
153 int requireAdjacentTerrain = -1;
154 std::unordered_map<std::string, int> cost;
155 std::unordered_map<std::string, std::string> extra;
157 std::unordered_map<std::string, std::string> visual2d;
159 std::unordered_map<std::string, std::string> visual3d;
160
162 bool hasTag(const std::string &tag) const;
164 std::string getExtra(const std::string &key, const std::string &fallback = {}) const;
166 std::string getVisual2d(const std::string &key, const std::string &fallback = {}) const;
168 std::string getVisual3d(const std::string &key, const std::string &fallback = {}) const;
170 int getCost(const std::string &resource, int fallback = 0) const;
172 bool maskAt(int localX, int localY) const;
173};
174
183 std::string id;
184 std::string type = "building.garrison.member";
185 std::vector<std::string> tags;
186};
187
190 int instanceId = 0;
191 std::string buildingId;
193 std::string placementKind = "cell";
201 float freeRadius = 0.f;
203 float freeHalfWidth = 0.f;
205 float freeHalfHeight = 0.f;
207 std::vector<float> freeFootprintVertices;
208 int originCellX = 0;
209 int originCellY = 0;
211 int level = 0;
212 float worldX = 0.f;
213 float worldY = 0.f;
215 float elevation = 0.f;
217 std::string surfaceId;
219 uint64_t surfaceRevision = 0;
221 float surfaceNormalX = 0.f;
222 float surfaceNormalY = 1.f;
223 float surfaceNormalZ = 0.f;
225 float surfaceTangentX = 1.f;
226 float surfaceTangentY = 0.f;
227 float surfaceTangentZ = 0.f;
228 int surfaceSampleCount = 0;
229 float surfaceMaxSlopeDegrees = 0.f;
230 float surfaceHeightDelta = 0.f;
231 float rotationDeg = 0.f;
232 std::string channel;
233 std::unordered_map<std::string, std::string> props;
234 std::vector<std::string> tags;
236 std::vector<int> supportInstanceIds;
238 std::vector<GarrisonMember> garrison;
240 eve::Revision garrisonRevision = eve::Revision::zero();
241
243 bool hasTag(const std::string &tag) const;
245 std::string getProp(const std::string &key, const std::string &fallback = {}) const;
247 void setProp(const std::string &key, const std::string &value);
248};
249
252 std::string action;
253 std::string worldId;
254 std::string buildingId;
256 std::string otherBuildingId;
257 int instanceId = 0;
258 int cellX = -1;
259 int cellY = -1;
260 int otherCellX = -1;
261 int otherCellY = -1;
262 int level = 0;
263 int otherLevel = 0;
264 float rotationDeg = 0.f;
265 float worldX = 0.f;
266 float worldY = 0.f;
267 float elevation = 0.f;
268 std::string channel;
269};
270
273 std::string buildingId;
274 int cellX = 0;
275 int cellY = 0;
277 int level = 0;
278 float worldX = 0.f;
279 float worldY = 0.f;
280 float elevation = 0.f;
282 std::string surfaceId;
283 uint64_t surfaceRevision = 0;
284 float surfaceNormalX = 0.f;
285 float surfaceNormalY = 1.f;
286 float surfaceNormalZ = 0.f;
290 float rotationDeg = 0.f;
292};
293
296 int cellX = 0;
297 int cellY = 0;
298 float worldX = 0.f;
299 float worldY = 0.f;
300 float elevation = 0.f;
301};
302
308
312 std::vector<PlacedBuilding> removed;
313};
314
320
321} // namespace eve::building
SQObjectPtr key
Definition ECS.cpp:155
int instanceId
#define EVENGINE_API_WORLD
Definition Export.h:109
float elevation
int level
const std::string * tag
Object::Ptr value
Monotonic state revision for concurrency and change checks.
std::string resource
Share string attribute map operations through the Windows Foundation DLL.
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:10
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< std::string > blockedByEdgeChannels
Edge channels that block this free-domain footprint at the same floor.
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.