载入中...
搜索中...
未找到
Building.cpp
浏览该文件的文档.
1#include "building/Building.h"
4
5#include <simplesquirrel/simplesquirrel.hpp>
6
7namespace eve::building {
8
10
11int Building::registerBuildingsFromJson(const std::string &json) {
13 return BuildingRegistry::loadFromJson(json, nullptr);
14}
15
17
19
20bool Building::hasBuildingDefinition(const std::string &buildingId) {
21 return BuildingRegistry::find(buildingId) != nullptr;
22}
23
24std::string Building::getBuildingDisplayName(const std::string &buildingId) {
25 const auto *def = BuildingRegistry::find(buildingId);
26 return def ? def->displayName : std::string{};
27}
28
29std::string Building::getBuildingCategory(const std::string &buildingId) {
30 const auto *def = BuildingRegistry::find(buildingId);
31 return def ? def->category : std::string{};
32}
33
34int Building::getBuildingFootprintW(const std::string &buildingId) {
35 const auto *def = BuildingRegistry::find(buildingId);
36 return def ? def->footprintW : 0;
37}
38
39int Building::getBuildingFootprintH(const std::string &buildingId) {
40 const auto *def = BuildingRegistry::find(buildingId);
41 return def ? def->footprintH : 0;
42}
43
44std::string Building::getBuildingSnapMode(const std::string &buildingId) {
45 const auto *def = BuildingRegistry::find(buildingId);
46 return def ? def->snapMode : std::string{};
47}
48
49std::string Building::getBuildingRotationMode(const std::string &buildingId) {
50 const auto *def = BuildingRegistry::find(buildingId);
51 return def ? def->rotationMode : std::string{};
52}
53
54std::string Building::getBuildingValidateRule(const std::string &buildingId) {
55 const auto *def = BuildingRegistry::find(buildingId);
56 return def ? def->validateRule : std::string{};
57}
58
59std::string Building::getBuildingChannel(const std::string &buildingId) {
60 const auto *def = BuildingRegistry::find(buildingId);
61 return def ? def->channel : std::string{};
62}
63
64std::string Building::getBuildingRenderMode(const std::string &buildingId) {
65 const auto *def = BuildingRegistry::find(buildingId);
66 return def ? def->renderMode : std::string{};
67}
68
69std::string Building::getBuildingPlacementKind(const std::string &buildingId) {
70 const auto *def = BuildingRegistry::find(buildingId);
71 return def ? def->placementKind : std::string{};
72}
73
74std::string Building::getBuildingConnectionGroup(const std::string &buildingId) {
75 const auto *def = BuildingRegistry::find(buildingId);
76 return def ? def->connectionGroup : std::string{};
77}
78
79std::string Building::getBuildingVisual2d(const std::string &buildingId, const std::string &key,
80 const std::string &fallback) {
81 const auto *def = BuildingRegistry::find(buildingId);
82 return def ? def->getVisual2d(key, fallback) : fallback;
83}
84
85std::string Building::getBuildingVisual3d(const std::string &buildingId, const std::string &key,
86 const std::string &fallback) {
87 const auto *def = BuildingRegistry::find(buildingId);
88 return def ? def->getVisual3d(key, fallback) : fallback;
89}
90
91bool Building::buildingHasTag(const std::string &buildingId, const std::string &tag) {
92 const auto *def = BuildingRegistry::find(buildingId);
93 return def ? def->hasTag(tag) : false;
94}
95
96std::string Building::getBuildingExtra(const std::string &buildingId, const std::string &key,
97 const std::string &fallback) {
98 const auto *def = BuildingRegistry::find(buildingId);
99 return def ? def->getExtra(key, fallback) : fallback;
100}
101
102int Building::getBuildingCost(const std::string &buildingId, const std::string &resource) {
103 const auto *def = BuildingRegistry::find(buildingId);
104 return def ? def->getCost(resource, 0) : 0;
105}
106
107PlacementWorld *Building::newWorld(int width, int height, float cellSize) {
109 return new PlacementWorld(width, height, cellSize);
110}
111
116
121
122bool Building::hasValidateRule(const std::string &ruleName) {
123 return PlacementSystem::hasValidateRule(ruleName);
124}
125
126bool Building::hasSnapRule(const std::string &ruleName) {
127 return PlacementSystem::hasSnapRule(ruleName);
128}
129
130bool Building::hasSurface(const std::string &surfaceName) {
131 return PlacementSystem::hasSurface(surfaceName);
132}
133
137
139 const auto names = PlacementSystem::surfaceNames();
140 if (index < 0 || index >= int(names.size())) return {};
141 return names[size_t(index)];
142}
143
145
147
149
151
152std::string Building::getChangeEventAction(int index) const {
153 const auto &evs = PlacementSystem::events();
154 if (index < 0 || size_t(index) >= evs.size()) return {};
155 return evs[size_t(index)].action;
156}
157
159 const auto &evs = PlacementSystem::events();
160 if (index < 0 || size_t(index) >= evs.size()) return {};
161 return evs[size_t(index)].worldId;
162}
163
165 const auto &evs = PlacementSystem::events();
166 if (index < 0 || size_t(index) >= evs.size()) return {};
167 return evs[size_t(index)].buildingId;
168}
169
171 const auto &evs = PlacementSystem::events();
172 if (index < 0 || size_t(index) >= evs.size()) return 0;
173 return evs[size_t(index)].instanceId;
174}
175
177 const auto &evs = PlacementSystem::events();
178 if (index < 0 || size_t(index) >= evs.size()) return -1;
179 return evs[size_t(index)].cellX;
180}
181
183 const auto &evs = PlacementSystem::events();
184 if (index < 0 || size_t(index) >= evs.size()) return -1;
185 return evs[size_t(index)].cellY;
186}
187
189 const auto &evs = PlacementSystem::events();
190 if (index < 0 || size_t(index) >= evs.size()) return -1;
191 return evs[size_t(index)].otherCellX;
192}
193
195 const auto &evs = PlacementSystem::events();
196 if (index < 0 || size_t(index) >= evs.size()) return -1;
197 return evs[size_t(index)].otherCellY;
198}
199
201 const auto &evs = PlacementSystem::events();
202 if (index < 0 || size_t(index) >= evs.size()) return 0.f;
203 return evs[size_t(index)].rotationDeg;
204}
205
206void Building::expose(ssq::Table &table) {
207 auto cls = table.addClass(name, Building::create, false);
208 expose(cls);
209
210 auto world = table.addClass<PlacementWorld>(
211 "PlacementWorld",
212 std::function<PlacementWorld *(int, int, float)>(
213 [](int w, int h, float cs) -> PlacementWorld * {
214 return new PlacementWorld(w, h, cs);
215 }),
216 true);
217 world.addFunc("destroy", &PlacementWorld::destroy);
218 world.addFunc("getId", &PlacementWorld::getId);
219 world.addFunc("setId", &PlacementWorld::setId);
220 world.addFunc("getWidth", &PlacementWorld::getWidth);
221 world.addFunc("getHeight", &PlacementWorld::getHeight);
222 world.addFunc("getCellSize", &PlacementWorld::getCellSize);
223 world.addFunc("setCellSize", &PlacementWorld::setCellSize);
224 world.addFunc("getOriginX", &PlacementWorld::getOriginX);
225 world.addFunc("getOriginY", &PlacementWorld::getOriginY);
226 world.addFunc("setOrigin", &PlacementWorld::setOrigin);
227 world.addFunc("getFloorHeight", &PlacementWorld::getFloorHeight);
228 world.addFunc("setFloorHeight", &PlacementWorld::setFloorHeight);
229 world.addFunc("getActiveLevel", &PlacementWorld::getActiveLevel);
230 world.addFunc("setActiveLevel", &PlacementWorld::setActiveLevel);
231 world.addFunc("getSnapMode", &PlacementWorld::getSnapMode);
232 world.addFunc("setSnapMode", &PlacementWorld::setSnapMode);
233 world.addFunc("getValidateRule", &PlacementWorld::getValidateRule);
234 world.addFunc("setValidateRule", &PlacementWorld::setValidateRule);
235 world.addFunc("setGridLayout", &PlacementWorld::setGridLayout);
236 world.addFunc("getGridLayoutName", &PlacementWorld::getGridLayoutName);
237 world.addFunc("setGridPlane", &PlacementWorld::setGridPlane);
238 world.addFunc("getGridPlaneName", &PlacementWorld::getGridPlaneName);
239 world.addFunc("setCellGap", &PlacementWorld::setCellGap);
240 world.addFunc("setHexSideLength", &PlacementWorld::setHexSideLength);
241 world.addFunc("setStagger", &PlacementWorld::setStagger);
242 world.addFunc("setGridFromLayer", &PlacementWorld::setGridFromLayer);
243 world.addFunc("hasGridFromLayer", &PlacementWorld::hasGridFromLayer);
244 world.addFunc("setExtra", &PlacementWorld::setExtra);
245 world.addFunc("getExtra", &PlacementWorld::getExtra);
246 world.addFunc("worldToCellX", &PlacementWorld::worldToCellX);
247 world.addFunc("worldToCellY", &PlacementWorld::worldToCellY);
248 world.addFunc("cellToWorldX", &PlacementWorld::cellToWorldX);
249 world.addFunc("cellToWorldY", &PlacementWorld::cellToWorldY);
250 world.addFunc("cellToWorld3DX", &PlacementWorld::cellToWorld3DX);
251 world.addFunc("cellToWorld3DY", &PlacementWorld::cellToWorld3DY);
252 world.addFunc("cellToWorld3DZ", &PlacementWorld::cellToWorld3DZ);
253 world.addFunc("worldToCell3DX", &PlacementWorld::worldToCell3DX);
254 world.addFunc("worldToCell3DY", &PlacementWorld::worldToCell3DY);
255 world.addFunc("fillTerrain", &PlacementWorld::fillTerrain);
256 world.addFunc("setTerrain", &PlacementWorld::setTerrain);
257 world.addFunc("getTerrain", &PlacementWorld::getTerrain);
258 world.addFunc("inBounds", &PlacementWorld::inBounds);
259 world.addFunc("bindTileLayer", &PlacementWorld::bindTileLayer);
260 world.addFunc("getTileLayer", &PlacementWorld::getTileLayer);
261 world.addFunc("clearTileLayer", &PlacementWorld::clearTileLayer);
262 world.addFunc("setTerrainGidMapJson", &PlacementWorld::setTerrainGidMapJson);
263 world.addFunc("setTerrainGid", &PlacementWorld::setTerrainGid);
264 world.addFunc("clearTerrainGidMap", &PlacementWorld::clearTerrainGidMap);
265 world.addFunc("getOccupant", &PlacementWorld::getOccupant);
266 world.addFunc("getOccupantInChannel", &PlacementWorld::getOccupantInChannel);
267 world.addFunc("getOccupantAtLevel", &PlacementWorld::getOccupantAtLevel);
268 world.addFunc("getAnyOccupant", &PlacementWorld::getAnyOccupant);
269 world.addFunc("getAnyOccupantAtLevel", &PlacementWorld::getAnyOccupantAtLevel);
270 world.addFunc("isCellEmpty", &PlacementWorld::isCellEmpty);
271 world.addFunc("isCellEmptyInChannel", &PlacementWorld::isCellEmptyInChannel);
272 world.addFunc("getEdgeOccupant", &PlacementWorld::getEdgeOccupant);
273 world.addFunc("getEdgeOccupantAtLevel", &PlacementWorld::getEdgeOccupantAtLevel);
274 world.addFunc("isEdgeEmpty", &PlacementWorld::isEdgeEmpty);
275 world.addFunc("getEdgeConnectionMask", &PlacementWorld::getEdgeConnectionMask);
276 world.addFunc("getEdgeVariant", &PlacementWorld::getEdgeVariant);
277 world.addFunc("getBuildingCount", &PlacementWorld::getBuildingCount);
278 world.addFunc("hasBuilding", &PlacementWorld::hasBuilding);
279 world.addFunc("getBuildingId", &PlacementWorld::getBuildingId);
280 world.addFunc("getBuildingCellX", &PlacementWorld::getBuildingCellX);
281 world.addFunc("getBuildingCellY", &PlacementWorld::getBuildingCellY);
282 world.addFunc("getBuildingWorldX", &PlacementWorld::getBuildingWorldX);
283 world.addFunc("getBuildingWorldY", &PlacementWorld::getBuildingWorldY);
284 world.addFunc("getBuildingWorldZ", &PlacementWorld::getBuildingWorldZ);
285 world.addFunc("getBuildingElevation", &PlacementWorld::getBuildingElevation);
286 world.addFunc("getBuildingLevel", &PlacementWorld::getBuildingLevel);
287 world.addFunc("getBuildingSupportCount", &PlacementWorld::getBuildingSupportCount);
288 world.addFunc("getBuildingSupportAt", &PlacementWorld::getBuildingSupportAt);
289 world.addFunc("getBuildingDependentCount", &PlacementWorld::getBuildingDependentCount);
290 world.addFunc("getBuildingSurfaceId", &PlacementWorld::getBuildingSurfaceId);
291 world.addFunc("getBuildingSurfaceRevision", &PlacementWorld::getBuildingSurfaceRevision);
292 world.addFunc("getBuildingSurfaceNormalX", &PlacementWorld::getBuildingSurfaceNormalX);
293 world.addFunc("getBuildingSurfaceNormalY", &PlacementWorld::getBuildingSurfaceNormalY);
294 world.addFunc("getBuildingSurfaceNormalZ", &PlacementWorld::getBuildingSurfaceNormalZ);
295 world.addFunc("getBuildingChannel", &PlacementWorld::getBuildingChannel);
296 world.addFunc("getBuildingRotation", &PlacementWorld::getBuildingRotation);
297 world.addFunc("getBuildingProp", &PlacementWorld::getBuildingProp);
298 world.addFunc("setBuildingProp", &PlacementWorld::setBuildingProp);
299 world.addFunc("buildingHasTag", &PlacementWorld::buildingHasTag);
300 world.addFunc("getBuildingInstanceAt", &PlacementWorld::getBuildingInstanceAt);
301 world.addFunc("canPlace", &PlacementWorld::canPlace);
302 world.addFunc("canPlaceReason", &PlacementWorld::canPlaceReason);
303 world.addFunc("placeAt", &PlacementWorld::placeAt);
304 world.addFunc("placeAtWorld", &PlacementWorld::placeAtWorld);
305 world.addFunc("placeAtWorld3D", &PlacementWorld::placeAtWorld3D);
306 world.addFunc("placeGhost", &PlacementWorld::placeGhost);
307 world.addFunc("placeEdge", &PlacementWorld::placeEdge);
308 world.addFunc("canPlaceEdge", &PlacementWorld::canPlaceEdge);
309 world.addFunc("canPlaceEdgeReason", &PlacementWorld::canPlaceEdgeReason);
310 world.addFunc("placeCorner", &PlacementWorld::placeCorner);
311 world.addFunc("canPlaceCorner", &PlacementWorld::canPlaceCorner);
312 world.addFunc("canPlaceCornerReason", &PlacementWorld::canPlaceCornerReason);
313 world.addFunc("getCornerOccupant", &PlacementWorld::getCornerOccupant);
314 world.addFunc("getCornerOccupantAtLevel", &PlacementWorld::getCornerOccupantAtLevel);
315 world.addFunc("isCornerEmpty", &PlacementWorld::isCornerEmpty);
316 world.addFunc("placeFree", &PlacementWorld::placeFree);
317 world.addFunc("canPlaceFree", &PlacementWorld::canPlaceFree);
318 world.addFunc("canPlaceFreeReason", &PlacementWorld::canPlaceFreeReason);
319 world.addFunc("getFreeOccupant", &PlacementWorld::getFreeOccupant);
320 world.addFunc("getFreeOccupantAtLevel", &PlacementWorld::getFreeOccupantAtLevel);
321 world.addFunc("removeBuilding", &PlacementWorld::removeBuilding);
322 world.addFunc("canRemoveBuildingReason", &PlacementWorld::canRemoveBuildingReason);
323 world.addFunc("removeBuildingCascade", &PlacementWorld::removeBuildingCascade);
324 world.addFunc("moveBuilding", &PlacementWorld::moveBuilding);
325 world.addFunc("clearBuildings", &PlacementWorld::clearBuildings);
326
327 auto ghost = table.addClass<Ghost>(
328 "Ghost", std::function<Ghost *()>([]() -> Ghost * { return new Ghost(); }), true);
329 ghost.addFunc("destroy", &Ghost::destroy);
330 ghost.addFunc("getBuildingId", &Ghost::getBuildingId);
331 ghost.addFunc("setBuildingId", &Ghost::setBuildingId);
332 ghost.addFunc("getCellX", &Ghost::getCellX);
333 ghost.addFunc("getCellY", &Ghost::getCellY);
334 ghost.addFunc("setCell", &Ghost::setCell);
335 ghost.addFunc("getWorldX", &Ghost::getWorldX);
336 ghost.addFunc("getWorldY", &Ghost::getWorldY);
337 ghost.addFunc("setWorld", &Ghost::setWorld);
338 ghost.addFunc("getElevation", &Ghost::getElevation);
339 ghost.addFunc("setElevation", &Ghost::setElevation);
340 ghost.addFunc("getRotationDeg", &Ghost::getRotationDeg);
341 ghost.addFunc("setRotationDeg", &Ghost::setRotationDeg);
342 ghost.addFunc("rotateBy", &Ghost::rotateBy);
343 ghost.addFunc("getPlacementKind", &Ghost::getPlacementKind);
344 ghost.addFunc("getEdgeAxis", &Ghost::getEdgeAxis);
345 ghost.addFunc("setEdge", &Ghost::setEdge);
346 ghost.addFunc("setCorner", &Ghost::setCorner);
347 ghost.addFunc("setFree", &Ghost::setFree);
348 ghost.addFunc("isValid", &Ghost::isValid);
349 ghost.addFunc("getReason", &Ghost::getReason);
350 ghost.addFunc("getSurfaceId", &Ghost::getSurfaceId);
351 ghost.addFunc("getSurfaceRevision", &Ghost::getSurfaceRevision);
352 ghost.addFunc("getSurfaceNormalX", &Ghost::getSurfaceNormalX);
353 ghost.addFunc("getSurfaceNormalY", &Ghost::getSurfaceNormalY);
354 ghost.addFunc("getSurfaceNormalZ", &Ghost::getSurfaceNormalZ);
355 ghost.addFunc("getSurfaceTangentX", &Ghost::getSurfaceTangentX);
356 ghost.addFunc("getSurfaceTangentY", &Ghost::getSurfaceTangentY);
357 ghost.addFunc("getSurfaceTangentZ", &Ghost::getSurfaceTangentZ);
358 ghost.addFunc("getSurfaceSampleCount", &Ghost::getSurfaceSampleCount);
359 ghost.addFunc("getSurfaceMaxSlopeDegrees", &Ghost::getSurfaceMaxSlopeDegrees);
360 ghost.addFunc("getSurfaceHeightDelta", &Ghost::getSurfaceHeightDelta);
361 ghost.addFunc("setFromWorld", &Ghost::setFromWorld);
362 ghost.addFunc("setFromWorld3D", &Ghost::setFromWorld3D);
363 ghost.addFunc("setFromSurface", &Ghost::setFromSurface);
364 ghost.addFunc("validate", &Ghost::validate);
365
366 auto session = table.addClass<PlacementSession>(
367 "PlacementSession", std::function<PlacementSession *()>([]() -> PlacementSession * {
368 return new PlacementSession();
369 }),
370 true);
371 session.addFunc("destroy", &PlacementSession::destroy);
372 session.addFunc("startPlacement", &PlacementSession::startPlacement);
373 session.addFunc("stopPlacement", &PlacementSession::stopPlacement);
374 session.addFunc("isActive", &PlacementSession::isActive);
375 session.addFunc("getBuildingId", &PlacementSession::getBuildingId);
376 session.addFunc("getGhost", &PlacementSession::getGhost);
377 session.addFunc("setMode", &PlacementSession::setMode);
378 session.addFunc("getMode", &PlacementSession::getMode);
379 session.addFunc("setRotationDeg", &PlacementSession::setRotationDeg);
380 session.addFunc("rotateBy", &PlacementSession::rotateBy);
381 session.addFunc("getRotationDeg", &PlacementSession::getRotationDeg);
382 session.addFunc("updateFromWorld", &PlacementSession::updateFromWorld);
383 session.addFunc("updateFromWorld3D", &PlacementSession::updateFromWorld3D);
384 session.addFunc("updateFromSurface", &PlacementSession::updateFromSurface);
385 session.addFunc("updateEdge", &PlacementSession::updateEdge);
386 session.addFunc("updateCorner", &PlacementSession::updateCorner);
387 session.addFunc("updateFree", &PlacementSession::updateFree);
388 session.addFunc("isValid", &PlacementSession::isValid);
389 session.addFunc("getReason", &PlacementSession::getReason);
390 session.addFunc("execute", &PlacementSession::execute);
391 session.addFunc("executeEdgeLine", &PlacementSession::executeEdgeLine);
392 session.addFunc("beginEdgePath", &PlacementSession::beginEdgePath);
393 session.addFunc("appendEdgePathVertex", &PlacementSession::appendEdgePathVertex);
394 session.addFunc("executeEdgePath", &PlacementSession::executeEdgePath);
395 session.addFunc("getEdgePathVertexCount", &PlacementSession::getEdgePathVertexCount);
396 session.addFunc("beginEdgeCurve", &PlacementSession::beginEdgeCurve);
397 session.addFunc("appendEdgeCurveControlPoint",
399 session.addFunc("executeEdgeCurve", &PlacementSession::executeEdgeCurve);
400 session.addFunc("executeEdgeCurveOnSurface",
402 session.addFunc("getEdgeCurveControlPointCount",
404 session.addFunc("getLastPlacedCount", &PlacementSession::getLastPlacedCount);
405 session.addFunc("getLastPlacedId", &PlacementSession::getLastPlacedId);
406 session.addFunc("executeMove", &PlacementSession::executeMove);
407 session.addFunc("executeReplace", &PlacementSession::executeReplace);
408 session.addFunc("getLastEditedId", &PlacementSession::getLastEditedId);
409 session.addFunc("previewRectangle", &PlacementSession::previewRectangle);
410 session.addFunc("previewBrush", &PlacementSession::previewBrush);
411 session.addFunc("executeRectangle", &PlacementSession::executeRectangle);
412 session.addFunc("executeBrush", &PlacementSession::executeBrush);
413 session.addFunc("getAreaPreviewCount", &PlacementSession::getAreaPreviewCount);
414 session.addFunc("getAreaPreviewCellX", &PlacementSession::getAreaPreviewCellX);
415 session.addFunc("getAreaPreviewCellY", &PlacementSession::getAreaPreviewCellY);
416 session.addFunc("getAreaPreviewAccepted", &PlacementSession::getAreaPreviewAccepted);
417 session.addFunc("getAreaPreviewReason", &PlacementSession::getAreaPreviewReason);
418 session.addFunc("beginPattern", &PlacementSession::beginPattern);
419 session.addFunc("appendPatternPoint", &PlacementSession::appendPatternPoint);
420 session.addFunc("setPatternRadius", &PlacementSession::setPatternRadius);
421 session.addFunc("setPatternSubdivisions", &PlacementSession::setPatternSubdivisions);
422 session.addFunc("setPatternSurface", &PlacementSession::setPatternSurface);
423 session.addFunc("previewPattern", &PlacementSession::previewPattern);
424 session.addFunc("executePattern", &PlacementSession::executePattern);
425 session.addFunc("getPatternKind", &PlacementSession::getPatternKind);
426 session.addFunc("getPatternPointCount", &PlacementSession::getPatternPointCount);
427 session.addFunc("getPatternPreviewCount", &PlacementSession::getPatternPreviewCount);
428 session.addFunc("getPatternPreviewX", &PlacementSession::getPatternPreviewX);
429 session.addFunc("getPatternPreviewY", &PlacementSession::getPatternPreviewY);
430 session.addFunc("getPatternPreviewAxis", &PlacementSession::getPatternPreviewAxis);
431 session.addFunc("getPatternPreviewAccepted",
433 session.addFunc("getPatternPreviewReason", &PlacementSession::getPatternPreviewReason);
434}
435
436void Building::expose(ssq::Class &cls) {
437 cls.addFunc("registerBuildingsFromJson", &Building::registerBuildingsFromJson);
438 cls.addFunc("clearBuildingDefinitions", &Building::clearBuildingDefinitions);
439 cls.addFunc("getBuildingDefinitionCount", &Building::getBuildingDefinitionCount);
440 cls.addFunc("hasBuildingDefinition", &Building::hasBuildingDefinition);
441 cls.addFunc("getBuildingDisplayName", &Building::getBuildingDisplayName);
442 cls.addFunc("getBuildingCategory", &Building::getBuildingCategory);
443 cls.addFunc("getBuildingFootprintW", &Building::getBuildingFootprintW);
444 cls.addFunc("getBuildingFootprintH", &Building::getBuildingFootprintH);
445 cls.addFunc("getBuildingSnapMode", &Building::getBuildingSnapMode);
446 cls.addFunc("getBuildingRotationMode", &Building::getBuildingRotationMode);
447 cls.addFunc("getBuildingValidateRule", &Building::getBuildingValidateRule);
448 cls.addFunc("getBuildingChannel", &Building::getBuildingChannel);
449 cls.addFunc("getBuildingRenderMode", &Building::getBuildingRenderMode);
450 cls.addFunc("getBuildingPlacementKind", &Building::getBuildingPlacementKind);
451 cls.addFunc("getBuildingConnectionGroup", &Building::getBuildingConnectionGroup);
452 cls.addFunc("getBuildingVisual2d", &Building::getBuildingVisual2d);
453 cls.addFunc("getBuildingVisual3d", &Building::getBuildingVisual3d);
454 cls.addFunc("buildingHasTag", &Building::buildingHasTag);
455 cls.addFunc("getBuildingExtra", &Building::getBuildingExtra);
456 cls.addFunc("getBuildingCost", &Building::getBuildingCost);
457 cls.addFunc("newWorld", &Building::newWorld);
458 cls.addFunc("newGhost", &Building::newGhost);
459 cls.addFunc("newSession", &Building::newSession);
460 cls.addFunc("hasValidateRule", &Building::hasValidateRule);
461 cls.addFunc("hasSnapRule", &Building::hasSnapRule);
462 cls.addFunc("hasSurface", &Building::hasSurface);
463 cls.addFunc("getSurfaceCount", &Building::getSurfaceCount);
464 cls.addFunc("getSurfaceName", &Building::getSurfaceName);
465 cls.addFunc("setPlaneSurfaceHeight", &Building::setPlaneSurfaceHeight);
466 cls.addFunc("getPlaneSurfaceHeight", &Building::getPlaneSurfaceHeight);
467 cls.addFunc("clearChangeEvents", &Building::clearChangeEvents);
468 cls.addFunc("getChangeEventCount", &Building::getChangeEventCount);
469 cls.addFunc("getChangeEventAction", &Building::getChangeEventAction);
470 cls.addFunc("getChangeEventWorldId", &Building::getChangeEventWorldId);
471 cls.addFunc("getChangeEventBuildingId", &Building::getChangeEventBuildingId);
472 cls.addFunc("getChangeEventInstanceId", &Building::getChangeEventInstanceId);
473 cls.addFunc("getChangeEventCellX", &Building::getChangeEventCellX);
474 cls.addFunc("getChangeEventCellY", &Building::getChangeEventCellY);
475 cls.addFunc("getChangeEventOtherCellX", &Building::getChangeEventOtherCellX);
476 cls.addFunc("getChangeEventOtherCellY", &Building::getChangeEventOtherCellY);
477 cls.addFunc("getChangeEventRotation", &Building::getChangeEventRotation);
478}
479
480} // namespace eve::building
float w
Definition AnimClip.cpp:738
HSQOBJECT cls
Definition ECS.cpp:21
std::uint32_t key
int h
std::uint32_t height
std::uint32_t width
std::string name
const std::string * tag
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
World3D * world
std::string resource
std::optional< InteractionSession > session
Definition Tactics.cpp:39
float size
Definition TreeMesh.cpp:156
uint32_t index
static void clear()
Clears .
static int count()
Returns the number of .
static int loadFromJson(const std::string &json, std::string *error=nullptr)
从 JSON 数组或单对象批量注册,返回成功数量。 元素形如: { "id": "house.wood", "displayName": "木屋", "category": "housing",...
static const BuildingDefinition * find(const std::string &id)
Finds .
建筑放置模块(eve.Building)。
Definition Building.h:20
std::string getBuildingRotationMode(const std::string &buildingId)
Returns the building rotation mode.
Definition Building.cpp:49
int registerBuildingsFromJson(const std::string &json)
从 JSON 注册建筑模板;返回成功注册数量。
Definition Building.cpp:11
bool hasSnapRule(const std::string &name)
True when snap rule.
Definition Building.cpp:126
int getChangeEventInstanceId(int index) const
Returns the change event instance id.
Definition Building.cpp:170
std::string getBuildingDisplayName(const std::string &buildingId)
Returns the building display name.
Definition Building.cpp:24
void setPlaneSurfaceHeight(float h)
Sets the plane surface height.
Definition Building.cpp:144
std::string getBuildingConnectionGroup(const std::string &buildingId)
Definition edge connection group, or empty when it falls back to id.
Definition Building.cpp:74
std::string getChangeEventBuildingId(int index) const
Returns the change event building id.
Definition Building.cpp:164
std::string getBuildingVisual3d(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building visual 3 d.
Definition Building.cpp:85
bool hasValidateRule(const std::string &name)
扩展规则是否存在(校验/吸附)。
Definition Building.cpp:122
float getChangeEventRotation(int index) const
Returns the change event rotation.
Definition Building.cpp:200
int getBuildingFootprintW(const std::string &buildingId)
Returns the building footprint w.
Definition Building.cpp:34
int getSurfaceCount()
Returns the surface count.
Definition Building.cpp:134
void clearBuildingDefinitions()
清空全部建筑模板。
Definition Building.cpp:16
std::string getBuildingSnapMode(const std::string &buildingId)
Returns the building snap mode.
Definition Building.cpp:44
std::string getBuildingExtra(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building extra.
Definition Building.cpp:96
bool buildingHasTag(const std::string &buildingId, const std::string &tag)
Building has tag.
Definition Building.cpp:91
float getPlaneSurfaceHeight()
Returns the plane surface height.
Definition Building.cpp:146
int getChangeEventCellY(int index) const
Returns the change event cell y.
Definition Building.cpp:182
int getBuildingCost(const std::string &buildingId, const std::string &resource)
Returns the building cost.
Definition Building.cpp:102
std::string getBuildingCategory(const std::string &buildingId)
Returns the building category.
Definition Building.cpp:29
std::string getBuildingChannel(const std::string &buildingId)
Returns the building channel.
Definition Building.cpp:59
PlacementSession * newSession()
Creates a session. @ownership Caller deletes unless documented otherwise.
Definition Building.cpp:117
std::string getChangeEventAction(int index) const
Returns the change event action.
Definition Building.cpp:152
int getChangeEventCellX(int index) const
Returns the change event cell x.
Definition Building.cpp:176
std::string getChangeEventWorldId(int index) const
Returns the change event world id.
Definition Building.cpp:158
int getBuildingFootprintH(const std::string &buildingId)
Returns the building footprint h.
Definition Building.cpp:39
std::string getBuildingVisual2d(const std::string &buildingId, const std::string &key, const std::string &fallback={})
Returns the building visual 2 d.
Definition Building.cpp:79
void clearChangeEvents()
变更事件队列(放置/移除/移动)。
Definition Building.cpp:148
std::string getBuildingRenderMode(const std::string &buildingId)
Returns the building render mode.
Definition Building.cpp:64
int getChangeEventOtherCellY(int index) const
Returns the change event other cell y.
Definition Building.cpp:194
std::string getSurfaceName(int index)
Returns the surface name.
Definition Building.cpp:138
int getChangeEventCount() const
Returns the change event count.
Definition Building.cpp:150
bool hasSurface(const std::string &name)
True when surface.
Definition Building.cpp:130
std::string getBuildingValidateRule(const std::string &buildingId)
Returns the building validate rule.
Definition Building.cpp:54
bool hasBuildingDefinition(const std::string &buildingId)
建筑模板查询(显示名/类别/占地/规则/标签/额外属性/成本)。
Definition Building.cpp:20
int getBuildingDefinitionCount()
已注册建筑模板数量。
Definition Building.cpp:18
std::string getBuildingPlacementKind(const std::string &buildingId)
Definition placement domain (cell or edge).
Definition Building.cpp:69
int getChangeEventOtherCellX(int index) const
Returns the change event other cell x.
Definition Building.cpp:188
Ghost * newGhost()
Creates a ghost. @ownership Caller deletes unless documented otherwise.
Definition Building.cpp:112
PlacementWorld * newWorld(int width, int height, float cellSize=32.f)
工厂:创建放置世界 / 鬼影。
Definition Building.cpp:107
EVENGINE_API_WORLD public API.
Definition Ghost.h:16
float getElevation() const
Returns the elevation.
Definition Ghost.h:45
int getCellY() const
Returns the cell y.
Definition Ghost.h:34
float getWorldY() const
Returns the world y.
Definition Ghost.h:41
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
void setRotationDeg(float deg)
Sets the rotation deg.
Definition Ghost.cpp:94
int getCellX() const
Returns the cell x.
Definition Ghost.h:32
void setElevation(float elevation)
Sets the elevation.
Definition Ghost.cpp:75
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
bool validate(PlacementWorld *world)
对当前姿态做校验,写入 valid_/reason_。
Definition Ghost.cpp:270
void setFromWorld3D(PlacementWorld *world, float worldX, float worldY, float worldZ)
Sets the from world 3 d.
Definition Ghost.cpp:131
std::string getReason() const
Returns the reason.
Definition Ghost.h:69
void setCorner(PlacementWorld *world, int vertexX, int vertexY)
Snap this ghost to one canonical grid vertex.
Definition Ghost.cpp:190
bool isValid() const
True when valid.
Definition Ghost.h:67
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
float getWorldX() const
Returns the world x.
Definition Ghost.h:39
float getRotationDeg() const
Returns the rotation deg.
Definition Ghost.h:50
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
std::string getBuildingId() const
Returns the building id.
Definition Ghost.h:27
void setWorld(float worldX, float worldY)
Sets the world.
Definition Ghost.cpp:54
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
void rotateBy(float deltaDeg)
Rotate by.
Definition Ghost.cpp:101
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
void setCell(int cellX, int cellY)
Sets the cell.
Definition Ghost.cpp:33
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
void setBuildingId(const std::string &id)
Sets the building id.
Definition Ghost.cpp:13
void destroy()
Destroys .
Definition Ghost.cpp:11
float getSurfaceNormalX() const
X component of the captured unit surface normal.
Definition Ghost.h:75
EVENGINE_API_WORLD public API.
PlacementEditExecuteStatus executeReplace(int instanceId)
Replace an existing instance with the selected definition atomically.
float getRotationDeg() const
Returns the rotation deg.
PatternUpdateStatus setPatternSubdivisions(int subdivisions)
Configure analytic segments used by edge_cubic_bezier.
void stopPlacement()
Stops placement.
PatternUpdateStatus setPatternRadius(int radius)
Configure the circle radius used by circle_brush.
void setRotationDeg(float deg)
Sets the rotation deg.
int getAreaPreviewCount() const
Number of cells in the last successful preview.
bool isActive() const
True when active.
void setMode(const std::string &mode)
Sets the mode.
AreaExecuteStatus previewBrush(int centerCellX, int centerCellY, int radius)
Cache a non-mutating circular cell brush preview.
std::string getPatternKind() const
Stable name of the currently authored pattern, or empty.
std::string getMode() const
Returns the mode.
int getLastPlacedCount() const
Number of ids committed by the last successful edge-line operation.
bool startPlacement(PlacementWorld *world, const std::string &buildingId)
Starts placement.
PatternUpdateStatus setPatternSurface(const std::string &surfaceName)
Configure an optional named surface for edge_cubic_bezier.
int getAreaPreviewCellX(int index) const
Returns the area preview cell x.
bool getPatternPreviewAccepted(int index) const
Whether one concrete preview anchor passed validation.
FreeUpdateStatus updateFree(PlacementWorld *world, float worldX, float worldY, float elevation=0.f)
Refresh a free-object ghost at an exact world-plane position.
int getLastEditedId() const
Instance id affected by the last successful move/replace, or zero.
PlacementEditExecuteStatus executeMove(int instanceId)
Move an existing instance to the current domain-specific ghost pose atomically.
PatternUpdateStatus beginPattern(const std::string &kind)
Start a renderer-neutral built-in pattern request.
AreaExecuteStatus previewRectangle(int minCellX, int minCellY, int maxCellX, int maxCellY)
Cache a non-mutating inclusive rectangular preview for UI/BuildingFX.
int getPatternPointCount() const
Number of authoring points in the current pattern.
EdgePathUpdateStatus appendEdgeCurveControlPoint(float x, float y)
Append a cubic Bezier control point; exactly four controls are accepted.
bool getAreaPreviewAccepted(int index) const
Returns the area preview accepted.
bool isValid() const
True when valid.
int getPatternPreviewX(int index) const
Logical x coordinate for one concrete preview anchor, or zero.
std::string getReason() const
Returns the reason.
int getAreaPreviewCellY(int index) const
Returns the area preview cell y.
EdgeUpdateStatus updateEdge(PlacementWorld *world, int cellX, int cellY, const std::string &direction)
Refresh an edge-object ghost from a cell-relative cardinal edge.
bool updateFromWorld3D(PlacementWorld *world, float worldX, float worldY, float worldZ)
Updates from world 3 d.
EdgeLineExecuteStatus executeEdgeLine(int startVertexX, int startVertexY, int endVertexX, int endVertexY)
Atomically place an axis-aligned edge line between logical vertices.
std::string getPatternPreviewReason(int index) const
Stable rejection reason for an area anchor, or empty.
AreaExecuteStatus executeBrush(int centerCellX, int centerCellY, int radius)
Atomically place a circular brush using the selected definition.
std::string getBuildingId() const
Returns the building id.
int getEdgeCurveControlPointCount() const
Number of currently authored cubic Bezier control points.
CornerUpdateStatus updateCorner(PlacementWorld *world, int vertexX, int vertexY)
Refresh a corner-object ghost at a canonical grid vertex.
EdgePathUpdateStatus appendEdgePathVertex(int vertexX, int vertexY)
Append one orthogonally connected logical vertex to the current edge path.
int getPatternPreviewCount() const
Number of concrete edge/cell anchors in the last pattern preview.
Ghost * getGhost() const
Returns the ghost.
bool updateFromWorld(PlacementWorld *world, float worldX, float worldY)
Updates from world.
EdgeLineExecuteStatus executeEdgePath()
Atomically commit the complete edge path.
AreaExecuteStatus executeRectangle(int minCellX, int minCellY, int maxCellX, int maxCellY)
Atomically place an inclusive rectangle using the selected definition.
EdgeLineExecuteStatus executeEdgeCurveOnSurface(int subdivisions, const std::string &surfaceName)
Sample a named custom surface and atomically commit the authored curve.
void rotateBy(float deltaDeg)
Rotate by.
EdgePathUpdateStatus beginEdgePath(int vertexX, int vertexY)
Start a multi-segment edge path at one logical grid vertex.
PatternExecuteStatus executePattern()
Atomically commit the complete cached pattern request.
PatternUpdateStatus appendPatternPoint(float x, float y)
Append one logical grid point/control to the current pattern.
EdgeLineExecuteStatus executeEdgeCurve(int subdivisions)
Sample and atomically commit the authored cubic Bezier curve.
EdgePathUpdateStatus beginEdgeCurve(float x, float y)
Begin authoring four cubic Bezier controls in logical grid space.
std::string getPatternPreviewAxis(int index) const
Edge axis for an edge preview anchor, or empty for area anchors.
PatternUpdateStatus previewPattern()
Expand and cache the complete pattern without world mutation.
bool updateFromSurface(PlacementWorld *world, const std::string &surface, float x, float y)
Updates from surface.
int getLastPlacedId(int index) const
Instance id from the last successful edge-line operation, or zero.
int getEdgePathVertexCount() const
Number of logical vertices in the current edge path.
int getPatternPreviewY(int index) const
Logical y coordinate for one concrete preview anchor, or zero.
std::string getAreaPreviewReason(int index) const
Returns the area preview reason.
static std::vector< std::string > surfaceNames()
static const std::vector< BuildingChangeEvent > & events()
static void setPlaneSurfaceHeight(float h)
static void ensureBuiltins()
确保内置规则已注册(模块首次使用时自动调用)。
static bool hasSurface(const std::string &name)
static bool hasSnapRule(const std::string &name)
static bool hasValidateRule(const std::string &name)
格子型建筑放置世界(脚本可直接操作)。
float getBuildingSurfaceNormalZ(int instanceId) const
Z component of the unit surface normal captured at placement time.
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.
int getBuildingSupportCount(int instanceId) const
Number of direct structural supports used by an instance.
std::string canPlaceReason(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
Can place reason.
std::string canPlaceEdgeReason(const std::string &buildingId, int cellX, int cellY, const std::string &direction)
Stable rejection token for edge placement.
bool inBounds(int cellX, int cellY) const
In bounds.
int worldToCellX(float worldX) const
世界像素 ↔ 格子坐标。
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.
float getOriginX() const
Returns the origin x.
void destroy()
释放资源并使其失效。
int getTerrain(int cellX, int cellY) const
Returns the terrain.
std::string getBuildingProp(int instanceId, const std::string &key, const std::string &fallback={}) const
Returns the building prop.
void setCellSize(float s)
Sets the cell size.
int getWidth() const
尺寸 / 格子大小 / 原点。
bool canPlaceEdge(const std::string &buildingId, int cellX, int cellY, const std::string &direction)
Validate edge placement without mutation.
float getBuildingWorldY(int instanceId) const
Returns the building world y.
int getActiveLevel() const
Floor used by compatibility placement/query APIs.
int placeCorner(const std::string &buildingId, int vertexX, int vertexY)
Compatibility-only script projection of canonical corner placement.
void clearBuildings()
Clears buildings.
int getBuildingCellY(int instanceId) const
Returns the building cell y.
float getBuildingSurfaceNormalX(int instanceId) const
X component of the unit surface normal captured at placement time.
float getOriginY() const
Returns the origin y.
int getEdgeConnectionMask(int instanceId) const
Six-bit local connection mask for an edge object's compatible neighbours.
int getFreeOccupantAtLevel(const std::string &channel, float worldX, float worldY, int level) const
Query a free-domain footprint at an explicit floor.
void setGridFromLayer(map::TileLayer *layer)
Sets the grid from layer.
void setHexSideLength(float s)
Sets the hex side length.
float getBuildingWorldX(int instanceId) const
Returns the building world x.
std::string canPlaceFreeReason(const std::string &buildingId, float worldX, float worldY)
Can place free reason.
bool moveBuilding(int instanceId, int cellX, int cellY, float rotationDeg=-1.f)
Moves building.
int getOccupantAtLevel(const std::string &channel, int cellX, int cellY, int level) const
Query one channel at an explicit discrete floor.
void setValidateRule(const std::string &rule)
Sets the validate rule.
std::string getGridLayoutName() const
Returns the grid layout name.
int getBuildingLevel(int instanceId) const
Return an instance's authoritative discrete floor.
float getBuildingElevation(int instanceId) const
Returns the building elevation.
float getFloorHeight() const
Height between discrete floors along the grid plane normal.
int getOccupant(int cellX, int cellY) const
占用查询:格子上建筑实例 / 是否为空。
bool isCellEmptyInChannel(const std::string &channel, int cellX, int cellY) const
已放置建筑实例查询。
int removeBuildingCascade(int instanceId)
Compatibility-only script projection of the canonical Result removal API.
bool hasBuilding(int instanceId) const
True when building.
int getBuildingSupportAt(int instanceId, int index) const
Direct structural support id by stable footprint order, or zero.
void setOrigin(float x, float y)
Sets the origin.
int getBuildingInstanceAt(int index) const
按插入顺序取实例 id。
int getBuildingCellX(int instanceId) const
Returns the building cell x.
float cellToWorld3DX(int cellX, int cellY, float elevation) const
Cell to world 3 dx.
bool buildingHasTag(int instanceId, const std::string &tag) const
Building has tag.
std::string getSnapMode() const
放置策略:吸附模式 / 校验规则。
int placeAt(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
Place at.
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.
std::string getId() const
世界 id(用于变更事件定位)。
void setGridLayout(const std::string &layout)
Sets the grid layout.
std::string getValidateRule() const
Returns the validate rule.
void setFloorHeight(float height)
Set positive height between discrete floors. Invalid values are ignored.
void setExtra(const std::string &key, const std::string &value)
世界级额外属性(键值)。
bool hasGridFromLayer() const
True when grid from layer.
void setCellGap(float gapX, float gapY)
Sets the cell gap.
int getBuildingCount() const
Returns the building count.
void setActiveLevel(int level)
Select the floor used by compatibility placement/query APIs.
bool isCellEmpty(int cellX, int cellY) const
True when cell empty.
map::TileLayer * getTileLayer() const
Returns the tile layer.
void setTerrain(int cellX, int cellY, int semantic)
Sets the terrain.
void setTerrainGid(int gid, int semantic)
Sets the terrain gid.
bool removeBuilding(int instanceId)
Removes building.
float getBuildingRotation(int instanceId) const
Returns the building rotation.
void clearTileLayer()
Clears tile layer.
int64_t getBuildingSurfaceRevision(int instanceId) const
Surface provider revision captured when this instance was placed.
int worldToCell3DX(float worldX, float worldY, float worldZ) const
World to cell 3 dx.
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.
bool canPlaceFree(const std::string &buildingId, float worldX, float worldY)
Can place free.
float cellToWorldX(int cellX) const
Cell to world x.
int placeAtWorld3D(const std::string &buildingId, float worldX, float worldY, float worldZ, float rotationDeg=0.f)
Place at world 3 d.
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.
std::string getGridPlaneName() const
Returns the grid plane name.
bool canPlace(const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
便捷操作(转发 PlacementSystem):放置 / 移除 / 移动。
float cellToWorldY(int cellY) const
Cell to world y.
std::string getEdgeVariant(int instanceId) const
Stable topology variant name for an edge instance.
void setId(const std::string &id)
Sets the id.
int placeGhost(Ghost *ghost)
Place ghost.
int worldToCellY(float worldY) const
World to cell y.
int getCornerOccupantAtLevel(const std::string &channel, int vertexX, int vertexY, int level) const
Query a corner-domain occupant at an explicit floor.
void setBuildingProp(int instanceId, const std::string &key, const std::string &value)
Sets the building prop.
std::string getBuildingId(int instanceId) const
Returns the building id.
void setGridPlane(const std::string &plane)
Sets the grid plane.
void setSnapMode(const std::string &mode)
Sets the snap mode.
void bindTileLayer(map::TileLayer *layer)
Binds tile layer.
std::string getExtra(const std::string &key, const std::string &fallback={}) const
Returns the extra.
int worldToCell3DY(float worldX, float worldY, float worldZ) const
World to cell 3 dy.
void setStagger(const std::string &axis, const std::string &index)
Sets the stagger.
int placeAtWorld(const std::string &buildingId, float worldX, float worldY, float rotationDeg=0.f)
Place at world.
float getCellSize() const
Returns the cell size.
int getCornerOccupant(const std::string &channel, int vertexX, int vertexY) const
Query a corner-domain occupant at the active floor.
int getAnyOccupant(int cellX, int cellY) const
Returns the any occupant.
std::string canPlaceCornerReason(const std::string &buildingId, int vertexX, int vertexY)
Stable corner placement rejection token.
std::string canRemoveBuildingReason(int instanceId) const
Stable rejection token for ordinary removal (support_in_use when depended on).
float cellToWorld3DY(int cellX, int cellY, float elevation) const
Cell to world 3 dy.
int getAnyOccupantAtLevel(int cellX, int cellY, int level) const
Query the first occupant across channels at an explicit floor.
int getHeight() const
Returns the height.
int getFreeOccupant(const std::string &channel, float worldX, float worldY) const
Return the first free-domain object whose circular footprint contains the point.
std::string getBuildingSurfaceId(int instanceId) const
Surface provider identity captured when this instance was placed.
std::string getBuildingChannel(int instanceId) const
Returns the building channel.
void setTerrainGidMapJson(const std::string &json)
Sets the terrain gid map json.
float getBuildingWorldZ(int instanceId) const
Returns the building world z.
int getOccupantInChannel(const std::string &channel, int cellX, int cellY) const
Returns the occupant in channel.
bool canPlaceCorner(const std::string &buildingId, int vertexX, int vertexY)
Validate corner placement without mutation.
float getBuildingSurfaceNormalY(int instanceId) const
Y component of the unit surface normal captured at placement time.
float cellToWorld3DZ(int cellX, int cellY, float elevation) const
Cell to world 3 dz.
void fillTerrain(int semantic)
地形语义(占用检查用)。
void clearTerrainGidMap()
Clears terrain gid map.
bool isCornerEmpty(const std::string &channel, int vertexX, int vertexY) const
Return whether a corner-domain address is empty in one channel.
int getBuildingDependentCount(int instanceId) const
Number of instances that directly depend on this instance.
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:7