载入中...
搜索中...
未找到
RTSStageBindings.cpp
浏览该文件的文档.
16 auto* faction = handle.table == ecs::current() ? dynamic_cast<Faction*>(ecs::try_get(handle)) : nullptr;
28 return batch.bindAccount(account.value().get(), [&rts, handle](std::string_view name) -> std::optional<Value> {
29 auto* faction = handle.table == ecs::current() ? dynamic_cast<Faction*>(ecs::try_get(handle)) : nullptr;
43 cls.addFunc("stageAbility", [vm](RTS* self, transaction::AtomicBatch* batch, const std::string& casterText,
75 cls.addFunc("stageProduction", [vm](RTS* self, transaction::AtomicBatch* batch, const std::string& producerText,
95 Status::failure(Diagnostic::error(DiagnosticCode::StaleHandle, "faction is stale", "producer")));
112 cls.addFunc("stagePayment", [vm](RTS* self, transaction::AtomicBatch* batch, const std::string& factionText,
RTS module owner and phase-one composition profile entry point.
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.
Definition Diagnostic.cpp:21
static std::optional< LogicalId > parse(std::string_view text)
Parses a scoped logical name.
Definition Identity.cpp:37
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.cpp:28
Faction domain root; membership is a set of typed runtime handles.
Definition RTSTypes.h:1192
Result< RTSPreparedAbility > prepareScriptAbility(Unit &caster, std::string ability, SubjectRef target, WorldPosition point)
Stage ability admission for an outer card/resource transaction. @cost Linear in caster cooldown count...
Definition RTSScriptActions.cpp:418
Building * findBuilding(SubjectRef subject) const noexcept
Resolve a module-owned building by persistent subject identity.
Definition RTS.cpp:980
Unit * findUnit(SubjectRef subject) const noexcept
Resolve a module-owned unit by persistent subject identity.
Definition RTS.cpp:978
Faction * findFaction(SubjectRef subject) const noexcept
Resolve a module-owned faction by persistent subject identity.
Definition RTS.cpp:3592
Result< RTSPreparedProduction > prepareScriptUnit(Building &producer, SubjectRef unitSubject, LogicalId unitDefinition, int priority=0)
Queue one data-defined unit through canonical production, action and economy providers....
Definition RTSScriptActions.cpp:63
Single-use composition of domain participants and one payer's costs. Owns staged participants,...
Definition AtomicBatch.h:19
Result< void > reject(Status status)
Preserve the first admission error and reject further execution.
Definition AtomicBatch.cpp:25
static Result< resource::CostSpec > parseCost(const std::string &json)
Parse a positive-integer resource cost object at the script boundary.
Definition AtomicBatch.cpp:49
Result< void > retainScriptOwner(void *vm)
Retain the current native script method's self for staged lifetimes.
Definition AtomicBatch.cpp:115
Result< void > add(std::vector< std::unique_ptr< ITransactionParticipant > > effects, std::optional< resource::CostSpec > cost={})
Append owning effects and optional cost without executing them. @cost Linear in effect/cost count; st...
Definition AtomicBatch.cpp:88
Result< void > protect(resource::ResourceCost floor)
Preserve a resource floor after the complete merged payment. Multiple contributors combine floors by ...
Definition AtomicBatch.cpp:75
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
Result< SubjectRef > parseScriptSubject(std::string_view text, std::string_view path)
Definition RTSScriptInternal.h:12
void exposeStageBindings(ssq::Class &cls)
Definition RTSStageBindings.cpp:41
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
@ InvalidArgument
@ NotFound
@ StaleHandle
static eve::Result< ResourceCost > create(std::string_view resourceId, std::int64_t amountValue)
Construct and validate one cost item.
Definition ResourceAccount.cpp:63