载入中...
搜索中...
未找到
Building.cpp
浏览该文件的文档.
126bool Building::hasValidateRule(const std::string &ruleName) { return PlacementSystem::hasValidateRule(ruleName); }
128bool Building::hasSnapRule(const std::string &ruleName) { return PlacementSystem::hasSnapRule(ruleName); }
130bool Building::hasSurface(const std::string &surfaceName) { return PlacementSystem::hasSurface(surfaceName); }
323 table.addClass<Ghost>("Ghost", std::function<Ghost *()>([]() -> Ghost * { return new Ghost(); }), true);
363 std::function<PlacementSession *()>([]() -> PlacementSession * { return new PlacementSession(); }), true);
393 session.addFunc("getEdgeCurveControlPointCount", &PlacementSession::getEdgeCurveControlPointCount);
484std::string BuildingDefinition::getExtra(const std::string &key, const std::string &fallback) const {
489std::string BuildingDefinition::getVisual2d(const std::string &key, const std::string &fallback) const {
494std::string BuildingDefinition::getVisual3d(const std::string &key, const std::string &fallback) const {
521void PlacedBuilding::setProp(const std::string &key, const std::string &value) { props[key] = value; }
537 if (copy.placementKind != "edge" && copy.placementKind != "corner" && copy.placementKind != "free")
539 if (!std::isfinite(copy.edgeThicknessCells) || copy.edgeThicknessCells < 0.f) copy.edgeThicknessCells = 0.f;
540 if (!std::isfinite(copy.freeRadiusCells) || copy.freeRadiusCells <= 0.f) copy.freeRadiusCells = 0.25f;
548 if (copy.supportMode != "cell_below" && copy.supportMode != "corner_below") copy.supportMode = "none";
631 for (size_t i = 0; i < mask.size(); ++i) def.footprintMask.push_back(uint8_t(mask.at(i).asInt(0) != 0 ? 1 : 0));
static void registerBuilding(const BuildingDefinition &def)
Registers building.
Definition Building.cpp:528
static int loadFromJson(const std::string &json, std::string *error=nullptr)
从 JSON 数组或单对象批量注册,返回成功数量。 元素形如: { "id": "house.wood", "displayName": "木屋", "category": "housing",...
Definition Building.cpp:637
std::string getBuildingRotationMode(const std::string &buildingId)
Returns the building rotation mode.
Definition Building.cpp:53
int registerBuildingsFromJson(const std::string &json)
从 JSON 注册建筑模板;返回成功注册数量。
Definition Building.cpp:15
int getChangeEventInstanceId(int index) const
Returns the change event instance id.
Definition Building.cpp:166
std::string getBuildingDisplayName(const std::string &buildingId)
Returns the building display name.
Definition Building.cpp:28
std::string getBuildingConnectionGroup(const std::string &buildingId)
Definition edge connection group, or empty when it falls back to id.
Definition Building.cpp:78
std::string getChangeEventBuildingId(int index) const
Returns the change event building id.
Definition Building.cpp:160
std::string getBuildingVisual3d(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building visual 3 d.
Definition Building.cpp:89
float getChangeEventRotation(int index) const
Returns the change event rotation.
Definition Building.cpp:196
int getBuildingFootprintW(const std::string &buildingId)
Returns the building footprint w.
Definition Building.cpp:38
std::string getBuildingSnapMode(const std::string &buildingId)
Returns the building snap mode.
Definition Building.cpp:48
std::string getBuildingExtra(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building extra.
Definition Building.cpp:100
bool buildingHasTag(const std::string &buildingId, const std::string &tag)
Building has tag.
Definition Building.cpp:95
int getBuildingCost(const std::string &buildingId, const std::string &resource)
Returns the building cost.
Definition Building.cpp:106
std::string getBuildingCategory(const std::string &buildingId)
Returns the building category.
Definition Building.cpp:33
std::string getBuildingChannel(const std::string &buildingId)
Returns the building channel.
Definition Building.cpp:63
PlacementSession * newSession()
Creates a session. @ownership Caller deletes unless documented otherwise.
Definition Building.cpp:121
std::string getChangeEventAction(int index) const
Returns the change event action.
Definition Building.cpp:148
std::string getChangeEventWorldId(int index) const
Returns the change event world id.
Definition Building.cpp:154
int getBuildingFootprintH(const std::string &buildingId)
Returns the building footprint h.
Definition Building.cpp:43
std::string getBuildingVisual2d(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building visual 2 d.
Definition Building.cpp:83
std::string getBuildingRenderMode(const std::string &buildingId)
Returns the building render mode.
Definition Building.cpp:68
int getChangeEventOtherCellY(int index) const
Returns the change event other cell y.
Definition Building.cpp:190
std::string getBuildingValidateRule(const std::string &buildingId)
Returns the building validate rule.
Definition Building.cpp:58
bool hasBuildingDefinition(const std::string &buildingId)
建筑模板查询(显示名/类别/占地/规则/标签/额外属性/成本)。
Definition Building.cpp:24
std::string getBuildingPlacementKind(const std::string &buildingId)
Definition placement domain (cell or edge).
Definition Building.cpp:73
int getChangeEventOtherCellX(int index) const
Returns the change event other cell x.
Definition Building.cpp:184
Ghost * newGhost()
Creates a ghost. @ownership Caller deletes unless documented otherwise.
Definition Building.cpp:116
PlacementWorld * newWorld(int width, int height, float cellSize=32.f)
工厂:创建放置世界 / 鬼影。
Definition Building.cpp:111
float getSurfaceHeightDelta() const
Sampled elevation range across the complete footprint.
Definition Ghost.h:91
void setFree(PlacementWorld *world, float worldX, float worldY, float elevation=0.f)
Set an exact unsnapped world-plane anchor for a free-domain definition.
Definition Ghost.cpp:207
void setFromWorld(PlacementWorld *world, float worldX, float worldY)
按世界吸附模式,从世界坐标刷新格子与世界位姿。
Definition Ghost.cpp:105
float getSurfaceTangentX() const
X component of the captured unit surface tangent.
Definition Ghost.h:81
std::string getSurfaceId() const
Surface identity captured by the last successful setFromSurface call.
Definition Ghost.h:71
void setFromWorld3D(PlacementWorld *world, float worldX, float worldY, float worldZ)
Sets the from world 3 d.
Definition Ghost.cpp:131
void setCorner(PlacementWorld *world, int vertexX, int vertexY)
Snap this ghost to one canonical grid vertex.
Definition Ghost.cpp:190
std::string getPlacementKind() const
Current placement domain (cell, edge, corner, or free).
Definition Ghost.h:56
float getSurfaceTangentZ() const
Z component of the captured unit surface tangent.
Definition Ghost.h:85
std::string getEdgeAxis() const
Canonical edge axis (horizontal/vertical), empty for cell ghosts.
Definition Ghost.cpp:157
void setEdge(PlacementWorld *world, int cellX, int cellY, const std::string &direction)
Snap this ghost to a canonicalized cell edge and its exact midpoint pose.
Definition Ghost.cpp:162
float getSurfaceTangentY() const
Y component of the captured unit surface tangent.
Definition Ghost.h:83
int getSurfaceSampleCount() const
Number of occupied footprint cells sampled in the current patch.
Definition Ghost.h:87
int64_t getSurfaceRevision() const
Surface revision captured by the last successful setFromSurface call.
Definition Ghost.h:73
float getSurfaceNormalY() const
Y component of the captured unit surface normal.
Definition Ghost.h:77
float getSurfaceMaxSlopeDegrees() const
Maximum sampled slope relative to the grid-plane up axis.
Definition Ghost.h:89
float getSurfaceNormalZ() const
Z component of the captured unit surface normal.
Definition Ghost.h:79
void setFromSurface(PlacementWorld *world, const std::string &surface, float x, float y)
Sets the from surface.
Definition Ghost.cpp:225
float getSurfaceNormalX() const
X component of the captured unit surface normal.
Definition Ghost.h:75
PlacementEditExecuteStatus executeReplace(int instanceId)
Replace an existing instance with the selected definition atomically.
Definition PlacementSession.cpp:365
PatternUpdateStatus setPatternSubdivisions(int subdivisions)
Configure analytic segments used by edge_cubic_bezier.
Definition PlacementSession.cpp:496
PatternUpdateStatus setPatternRadius(int radius)
Configure the circle radius used by circle_brush.
Definition PlacementSession.cpp:490
int getAreaPreviewCount() const
Number of cells in the last successful preview.
Definition PlacementSession.h:160
AreaExecuteStatus previewBrush(int centerCellX, int centerCellY, int radius)
Cache a non-mutating circular cell brush preview.
Definition PlacementSession.cpp:392
std::string getPatternKind() const
Stable name of the currently authored pattern, or empty.
Definition PlacementSession.cpp:541
int getLastPlacedCount() const
Number of ids committed by the last successful edge-line operation.
Definition PlacementSession.h:142
bool startPlacement(PlacementWorld *world, const std::string &buildingId)
Starts placement.
Definition PlacementSession.cpp:83
PatternUpdateStatus setPatternSurface(const std::string &surfaceName)
Configure an optional named surface for edge_cubic_bezier.
Definition PlacementSession.cpp:502
int getAreaPreviewCellX(int index) const
Returns the area preview cell x.
Definition PlacementSession.cpp:440
bool getPatternPreviewAccepted(int index) const
Whether one concrete preview anchor passed validation.
Definition PlacementSession.cpp:569
FreeUpdateStatus updateFree(PlacementWorld *world, float worldX, float worldY, float elevation=0.f)
Refresh a free-object ghost at an exact world-plane position.
Definition PlacementSession.cpp:183
int getLastEditedId() const
Instance id affected by the last successful move/replace, or zero.
Definition PlacementSession.h:150
PlacementEditExecuteStatus executeMove(int instanceId)
Move an existing instance to the current domain-specific ghost pose atomically.
Definition PlacementSession.cpp:338
PatternUpdateStatus beginPattern(const std::string &kind)
Start a renderer-neutral built-in pattern request.
Definition PlacementSession.cpp:454
AreaExecuteStatus previewRectangle(int minCellX, int minCellY, int maxCellX, int maxCellY)
Cache a non-mutating inclusive rectangular preview for UI/BuildingFX.
Definition PlacementSession.cpp:376
int getPatternPointCount() const
Number of authoring points in the current pattern.
Definition PlacementSession.h:192
EdgePathUpdateStatus appendEdgeCurveControlPoint(float x, float y)
Append a cubic Bezier control point; exactly four controls are accepted.
Definition PlacementSession.cpp:291
bool getAreaPreviewAccepted(int index) const
Returns the area preview accepted.
Definition PlacementSession.cpp:446
int getPatternPreviewX(int index) const
Logical x coordinate for one concrete preview anchor, or zero.
Definition PlacementSession.cpp:545
int getAreaPreviewCellY(int index) const
Returns the area preview cell y.
Definition PlacementSession.cpp:443
EdgeUpdateStatus updateEdge(PlacementWorld *world, int cellX, int cellY, const std::string &direction)
Refresh an edge-object ghost from a cell-relative cardinal edge.
Definition PlacementSession.cpp:163
bool updateFromWorld3D(PlacementWorld *world, float worldX, float worldY, float worldZ)
Updates from world 3 d.
Definition PlacementSession.cpp:143
EdgeLineExecuteStatus executeEdgeLine(int startVertexX, int startVertexY, int endVertexX, int endVertexY)
Atomically place an axis-aligned edge line between logical vertices.
Definition PlacementSession.cpp:230
std::string getPatternPreviewReason(int index) const
Stable rejection reason for an area anchor, or empty.
Definition PlacementSession.cpp:575
AreaExecuteStatus executeBrush(int centerCellX, int centerCellY, int radius)
Atomically place a circular brush using the selected definition.
Definition PlacementSession.cpp:424
int getEdgeCurveControlPointCount() const
Number of currently authored cubic Bezier control points.
Definition PlacementSession.h:134
CornerUpdateStatus updateCorner(PlacementWorld *world, int vertexX, int vertexY)
Refresh a corner-object ghost at a canonical grid vertex.
Definition PlacementSession.cpp:173
EdgePathUpdateStatus appendEdgePathVertex(int vertexX, int vertexY)
Append one orthogonally connected logical vertex to the current edge path.
Definition PlacementSession.cpp:255
int getPatternPreviewCount() const
Number of concrete edge/cell anchors in the last pattern preview.
Definition PlacementSession.h:196
bool updateFromWorld(PlacementWorld *world, float worldX, float worldY)
Updates from world.
Definition PlacementSession.cpp:134
EdgeLineExecuteStatus executeEdgePath()
Atomically commit the complete edge path.
Definition PlacementSession.cpp:264
AreaExecuteStatus executeRectangle(int minCellX, int minCellY, int maxCellX, int maxCellY)
Atomically place an inclusive rectangle using the selected definition.
Definition PlacementSession.cpp:407
EdgeLineExecuteStatus executeEdgeCurveOnSurface(int subdivisions, const std::string &surfaceName)
Sample a named custom surface and atomically commit the authored curve.
Definition PlacementSession.cpp:315
EdgePathUpdateStatus beginEdgePath(int vertexX, int vertexY)
Start a multi-segment edge path at one logical grid vertex.
Definition PlacementSession.cpp:245
PatternExecuteStatus executePattern()
Atomically commit the complete cached pattern request.
Definition PlacementSession.cpp:526
PatternUpdateStatus appendPatternPoint(float x, float y)
Append one logical grid point/control to the current pattern.
Definition PlacementSession.cpp:471
EdgeLineExecuteStatus executeEdgeCurve(int subdivisions)
Sample and atomically commit the authored cubic Bezier curve.
Definition PlacementSession.cpp:299
EdgePathUpdateStatus beginEdgeCurve(float x, float y)
Begin authoring four cubic Bezier controls in logical grid space.
Definition PlacementSession.cpp:280
std::string getPatternPreviewAxis(int index) const
Edge axis for an edge preview anchor, or empty for area anchors.
Definition PlacementSession.cpp:559
PatternUpdateStatus previewPattern()
Expand and cache the complete pattern without world mutation.
Definition PlacementSession.cpp:510
bool updateFromSurface(PlacementWorld *world, const std::string &surface, float x, float y)
Updates from surface.
Definition PlacementSession.cpp:153
int getLastPlacedId(int index) const
Instance id from the last successful edge-line operation, or zero.
Definition PlacementSession.cpp:333
int getEdgePathVertexCount() const
Number of logical vertices in the current edge path.
Definition PlacementSession.h:117
int getPatternPreviewY(int index) const
Logical y coordinate for one concrete preview anchor, or zero.
Definition PlacementSession.cpp:552
std::string getAreaPreviewReason(int index) const
Returns the area preview reason.
Definition PlacementSession.cpp:449
static std::vector< std::string > surfaceNames()
Definition PlacementSystem.cpp:283
static const std::vector< BuildingChangeEvent > & events()
Definition PlacementSystem.cpp:405
static float getPlaneSurfaceHeight()
Definition PlacementSystem.cpp:293
static void setPlaneSurfaceHeight(float h)
Definition PlacementSystem.cpp:291
static bool hasSurface(const std::string &name)
Definition PlacementSystem.cpp:146
static bool hasSnapRule(const std::string &name)
Definition PlacementSystem.cpp:75
static void clearEvents()
Definition PlacementSystem.cpp:403
static bool hasValidateRule(const std::string &name)
Definition PlacementSystem.cpp:63
float getBuildingSurfaceNormalZ(int instanceId) const
Z component of the unit surface normal captured at placement time.
Definition PlacementWorld.cpp:584
bool isEdgeEmpty(const std::string &channel, int cellX, int cellY, const std::string &direction) const
Return whether an edge is unoccupied in the requested channel.
Definition PlacementWorld.cpp:500
int getBuildingSupportCount(int instanceId) const
Number of direct structural supports used by an instance.
Definition PlacementWorld.cpp:443
std::string canPlaceReason(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
Can place reason.
Definition PlacementWorld.cpp:629
std::string canPlaceEdgeReason(const std::string &buildingId, int cellX, int cellY, const std::string &direction)
Stable rejection token for edge placement.
Definition PlacementWorld.cpp:695
int placeFree(const std::string &buildingId, float worldX, float worldY, float elevation=0.f, float rotationDeg=0.f)
Compatibility-only script projection of exact free placement.
Definition PlacementWorld.cpp:718
std::string getBuildingProp(int instanceId, const std::string &key, const std::string &fallback={}) const
Returns the building prop.
Definition PlacementWorld.cpp:599
bool canPlaceEdge(const std::string &buildingId, int cellX, int cellY, const std::string &direction)
Validate edge placement without mutation.
Definition PlacementWorld.cpp:690
float getBuildingWorldY(int instanceId) const
Returns the building world y.
Definition PlacementWorld.cpp:414
int getActiveLevel() const
Floor used by compatibility placement/query APIs.
Definition PlacementWorld.h:75
int placeCorner(const std::string &buildingId, int vertexX, int vertexY)
Compatibility-only script projection of canonical corner placement.
Definition PlacementWorld.cpp:702
int getBuildingCellY(int instanceId) const
Returns the building cell y.
Definition PlacementWorld.cpp:404
float getBuildingSurfaceNormalX(int instanceId) const
X component of the unit surface normal captured at placement time.
Definition PlacementWorld.cpp:574
int getEdgeConnectionMask(int instanceId) const
Six-bit local connection mask for an edge object's compatible neighbours.
Definition PlacementWorld.cpp:556
int getFreeOccupantAtLevel(const std::string &channel, float worldX, float worldY, int level) const
Query a free-domain footprint at an explicit floor.
Definition PlacementWorld.cpp:541
void setGridFromLayer(map::TileLayer *layer)
Sets the grid from layer.
Definition PlacementWorld.cpp:95
float getBuildingWorldX(int instanceId) const
Returns the building world x.
Definition PlacementWorld.cpp:409
std::string canPlaceFreeReason(const std::string &buildingId, float worldX, float worldY)
Can place free reason.
Definition PlacementWorld.cpp:727
bool moveBuilding(int instanceId, int cellX, int cellY, float rotationDeg=-1.f)
Moves building.
Definition PlacementWorld.cpp:738
int getOccupantAtLevel(const std::string &channel, int cellX, int cellY, int level) const
Query one channel at an explicit discrete floor.
Definition PlacementWorld.cpp:339
int getBuildingLevel(int instanceId) const
Return an instance's authoritative discrete floor.
Definition PlacementWorld.cpp:438
float getBuildingElevation(int instanceId) const
Returns the building elevation.
Definition PlacementWorld.cpp:433
float getFloorHeight() const
Height between discrete floors along the grid plane normal.
Definition PlacementWorld.h:71
bool isCellEmptyInChannel(const std::string &channel, int cellX, int cellY) const
已放置建筑实例查询。
Definition PlacementWorld.cpp:384
int removeBuildingCascade(int instanceId)
Compatibility-only script projection of the canonical Result removal API.
Definition PlacementWorld.cpp:782
int getBuildingSupportAt(int instanceId, int index) const
Direct structural support id by stable footprint order, or zero.
Definition PlacementWorld.cpp:448
int getBuildingCellX(int instanceId) const
Returns the building cell x.
Definition PlacementWorld.cpp:399
float cellToWorld3DX(int cellX, int cellY, float elevation) const
Cell to world 3 dx.
Definition PlacementWorld.cpp:168
bool buildingHasTag(int instanceId, const std::string &tag) const
Building has tag.
Definition PlacementWorld.cpp:612
int placeAt(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
Place at.
Definition PlacementWorld.cpp:636
int placeEdge(const std::string &buildingId, int cellX, int cellY, const std::string &direction)
Place an edge definition on a north/east/south/west edge; returns instance id or 0.
Definition PlacementWorld.cpp:685
void setFloorHeight(float height)
Set positive height between discrete floors. Invalid values are ignored.
Definition PlacementWorld.cpp:281
void setExtra(const std::string &key, const std::string &value)
世界级额外属性(键值)。
Definition PlacementWorld.cpp:54
void setActiveLevel(int level)
Select the floor used by compatibility placement/query APIs.
Definition PlacementWorld.h:77
void setTerrain(int cellX, int cellY, int semantic)
Sets the terrain.
Definition PlacementWorld.cpp:212
float getBuildingRotation(int instanceId) const
Returns the building rotation.
Definition PlacementWorld.cpp:594
int64_t getBuildingSurfaceRevision(int instanceId) const
Surface provider revision captured when this instance was placed.
Definition PlacementWorld.cpp:569
int worldToCell3DX(float worldX, float worldY, float worldZ) const
World to cell 3 dx.
Definition PlacementWorld.cpp:193
int getEdgeOccupant(const std::string &channel, int cellX, int cellY, const std::string &direction) const
Return the occupant of a canonicalized north/east/south/west cell edge.
Definition PlacementWorld.cpp:467
bool canPlaceFree(const std::string &buildingId, float worldX, float worldY)
Can place free.
Definition PlacementWorld.cpp:723
int placeAtWorld3D(const std::string &buildingId, float worldX, float worldY, float worldZ, float rotationDeg=0.f)
Place at world 3 d.
Definition PlacementWorld.cpp:646
int getEdgeOccupantAtLevel(const std::string &channel, int cellX, int cellY, const std::string &direction, int level) const
Query a canonical edge at an explicit discrete floor.
Definition PlacementWorld.cpp:472
bool canPlace(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
便捷操作(转发 PlacementSystem):放置 / 移除 / 移动。
Definition PlacementWorld.cpp:624
std::string getEdgeVariant(int instanceId) const
Stable topology variant name for an edge instance.
Definition PlacementWorld.cpp:560
int getCornerOccupantAtLevel(const std::string &channel, int vertexX, int vertexY, int level) const
Query a corner-domain occupant at an explicit floor.
Definition PlacementWorld.cpp:510
void setBuildingProp(int instanceId, const std::string &key, const std::string &value)
Sets the building prop.
Definition PlacementWorld.cpp:605
std::string getBuildingId(int instanceId) const
Returns the building id.
Definition PlacementWorld.cpp:394
std::string getExtra(const std::string &key, const std::string &fallback={}) const
Returns the extra.
Definition PlacementWorld.cpp:58
int worldToCell3DY(float worldX, float worldY, float worldZ) const
World to cell 3 dy.
Definition PlacementWorld.cpp:199
void setStagger(const std::string &axis, const std::string &index)
Sets the stagger.
Definition PlacementWorld.cpp:88
int placeAtWorld(const std::string &buildingId, float worldX, float worldY, float rotationDeg=0.f)
Place at world.
Definition PlacementWorld.cpp:641
int getCornerOccupant(const std::string &channel, int vertexX, int vertexY) const
Query a corner-domain occupant at the active floor.
Definition PlacementWorld.cpp:505
int getAnyOccupant(int cellX, int cellY) const
Returns the any occupant.
Definition PlacementWorld.cpp:357
std::string canPlaceCornerReason(const std::string &buildingId, int vertexX, int vertexY)
Stable corner placement rejection token.
Definition PlacementWorld.cpp:710
std::string canRemoveBuildingReason(int instanceId) const
Stable rejection token for ordinary removal (support_in_use when depended on).
Definition PlacementWorld.cpp:777
float cellToWorld3DY(int cellX, int cellY, float elevation) const
Cell to world 3 dy.
Definition PlacementWorld.cpp:174
int getAnyOccupantAtLevel(int cellX, int cellY, int level) const
Query the first occupant across channels at an explicit floor.
Definition PlacementWorld.cpp:361
int getFreeOccupant(const std::string &channel, float worldX, float worldY) const
Return the first free-domain object whose circular footprint contains the point.
Definition PlacementWorld.cpp:536
std::string getBuildingSurfaceId(int instanceId) const
Surface provider identity captured when this instance was placed.
Definition PlacementWorld.cpp:564
std::string getBuildingChannel(int instanceId) const
Returns the building channel.
Definition PlacementWorld.cpp:589
void setTerrainGidMapJson(const std::string &json)
Sets the terrain gid map json.
Definition PlacementWorld.cpp:256
float getBuildingWorldZ(int instanceId) const
Returns the building world z.
Definition PlacementWorld.cpp:424
int getOccupantInChannel(const std::string &channel, int cellX, int cellY) const
Returns the occupant in channel.
Definition PlacementWorld.cpp:335
bool canPlaceCorner(const std::string &buildingId, int vertexX, int vertexY)
Validate corner placement without mutation.
Definition PlacementWorld.cpp:706
float getBuildingSurfaceNormalY(int instanceId) const
Y component of the unit surface normal captured at placement time.
Definition PlacementWorld.cpp:579
float cellToWorld3DZ(int cellX, int cellY, float elevation) const
Cell to world 3 dz.
Definition PlacementWorld.cpp:180
bool isCornerEmpty(const std::string &channel, int vertexX, int vertexY) const
Return whether a corner-domain address is empty in one channel.
Definition PlacementWorld.cpp:532
int getBuildingDependentCount(int instanceId) const
Number of instances that directly depend on this instance.
Definition PlacementWorld.cpp:456
static Document parse(const std::string &text, std::string *error=nullptr)
Parse.
Definition Json.cpp:623
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:10
void exposeHouseBindings(ssq::Table &table)
Definition BuildingAssemblyBindings.cpp:5
std::string placementKind
Placement domain: cell (default), edge, corner, or free.
Definition BuildingTypes.h:111
std::unordered_map< std::string, std::string > visual2d
Definition BuildingTypes.h:157
std::vector< float > freeFootprintVertices
Optional convex local polygon as x/y pairs in grid-cell units, centered on the free anchor.
Definition BuildingTypes.h:119
std::unordered_map< std::string, int > cost
Definition BuildingTypes.h:154
std::unordered_map< std::string, std::string > visual3d
Definition BuildingTypes.h:159
std::string supportMode
Structural support policy: none, cell_below, or corner_below.
Definition BuildingTypes.h:129
float freeFootprintHeightCells
Optional oriented-box height in grid-cell units; positive width and height select OBB collision.
Definition BuildingTypes.h:117
bool maskAt(int localX, int localY) const
占地掩码在局部坐标 (localX, localY) 处是否占用。
Definition Building.cpp:504
std::unordered_map< std::string, std::string > extra
Definition BuildingTypes.h:155
std::string getVisual2d(const std::string &key, const std::string &fallback={}) const
Returns the visual 2 d.
Definition Building.cpp:489
int getCost(const std::string &resource, int fallback=0) const
Returns the cost.
Definition Building.cpp:499
std::string getExtra(const std::string &key, const std::string &fallback={}) const
Returns the extra.
Definition Building.cpp:484
float maxSurfaceSlopeDegrees
Maximum angle between a footprint normal and the grid-plane up axis.
Definition BuildingTypes.h:143
std::vector< uint8_t > footprintMask
可选占地掩码,长度 footprintW*footprintH;空表示实心矩形。行主序、原点在最小 x/y。
Definition BuildingTypes.h:135
float freeRadiusCells
Circular free-domain collision radius measured in grid-cell units.
Definition BuildingTypes.h:113
std::vector< std::string > tags
Definition BuildingTypes.h:146
float edgeThicknessCells
Solid edge thickness in cells; zero disables free/edge collision.
Definition BuildingTypes.h:123
float freeFootprintWidthCells
Optional oriented-box width in grid-cell units; positive width and height select OBB collision.
Definition BuildingTypes.h:115
std::string getVisual3d(const std::string &key, const std::string &fallback={}) const
Returns the visual 3 d.
Definition Building.cpp:494
void setProp(const std::string &key, const std::string &value)
Sets the prop.
Definition Building.cpp:521
std::string getProp(const std::string &key, const std::string &fallback={}) const
Returns the prop.
Definition Building.cpp:516
std::unordered_map< std::string, std::string > props
Definition BuildingTypes.h:233