载入中...
搜索中...
未找到
BuildingAssemblyBindings.cpp
浏览该文件的文档.
4namespace eve::building {
5void exposeHouseBindings(ssq::Table& table) {
6 const auto vm = table.getHandle();
7 table.addFunc("buildingHouseRequest", [vm](PlacementWorld* world, const ssq::Object& request) {
8 auto execute = [&]() -> Result<Value> {
9 if (!world)
12 if (!value.ok()) return Result<Value>::failure(value.status());
13 auto result = executeHouseRequest(*world, value.value());
14 if (!result.ok()) return result;
15 auto projected = script::pushValue(vm, result.value());
16 if (!projected.ok()) return Result<Value>::failure(projected.status());
17 sq_pop(vm, 1);
18 return result;
19 };
20 return script::projectResult(vm, execute(), [](Value value) { return value; });
21 });
22}
23} // namespace eve::building
HSQUIRRELVM vm
Definition ECS.cpp:38
const GltfImportRequest & request
Poco::JSON::Object::Ptr result
Object::Ptr value
The single Squirrel projection for common Result, Status and Value.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
格子型建筑放置世界(脚本可直接操作)。
EVENGINE_API_FOUNDATION public API.
Definition Json.h:39
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:10
void exposeHouseBindings(ssq::Table &table)
Result< Value > executeHouseRequest(PlacementWorld &w, const Value &request)
Execute the version-1 house authoring protocol used by scripts and tools. @ownership Synchronously bo...
Result< void > pushValue(HSQUIRRELVM vm, const Value &value, const SquirrelValueOptions &options)
Push a canonical Value into the active Squirrel VM.
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.