跳转到正文

item_use_input API ​

完整接口目录 · 物品动作用法 · 工具包下载

模块说明 ​

text
Opt-in, environment-specific use-air then neutral input; not a crossbow API.

UseAirWithNeutralInput ​

python
@dataclass
class UseAirWithNeutralInput

SDK 说明:

text
Two retained attempts; no selection, charge timing, release or retry.

Construct with prepare(). Caller holds the shared action lock for dispatch
and any observation. The journal must durably bind BOTH full intents before
returning; crash recovery consults their original keys, never reruns this pair.

字段(包含继承字段):

UseAirWithNeutralInput.use ​

python
use: ActionAttempt

数据类字段;声明于 item_use_input.UseAirWithNeutralInput。

UseAirWithNeutralInput.neutral ​

python
neutral: ActionAttempt

数据类字段;声明于 item_use_input.UseAirWithNeutralInput。

UseAirWithNeutralInput.started ​

python
started: bool = False

数据类字段;声明于 item_use_input.UseAirWithNeutralInput。

该类型另有以下内部字段,参与数据类声明但不建议直接读写;创建对象时优先使用专题中的工厂方法:

python
_actions: object = field(repr=False)

UseAirWithNeutralInput.prepare ​

python
@classmethod
def prepare(cls, actions, use, *, neutral_input, idempotency_key, deadline)

SDK 说明:

text
Wrap an unstarted ItemActions.use_air attempt with explicit input.

UseAirWithNeutralInput.dispatch ​

python
async def dispatch(
    self,
    *,
    journal,
    timeout = 10,
    poll_interval = 0.05,
    before_dispatch = None,
)

SDK 说明:

text
Journal both intents before world IO; stop on any unknown/cancellation.

journal(payload) is a required async callback. Its failure sends nothing.
A pair is single-attempt even if journaling fails. The timeout covers the
journal and both dispatches. Retain this object on every exception: each
ActionAttempt keeps its key, admission ID when known, and receipt.

Neomega · 使用、开发与参考文档