Skip to content

🏷️ Agent 动作能力

tongsim.entity.ability.impl.action

tongsim.entity.ability.impl.action

定义 AgentActionAbility 接口及其具体实现 AgentActionAbilityImpl。

  • AgentActionAbility: 角色动画执行的接口,提供同步与异步执行方法。
  • AgentActionAbilityImpl: 接口实现类,基于 AnimationStreamer 提供 Action 的执行与结果收集功能。

AgentActionAbility

Bases: Protocol

AgentActionAbility 定义了角色动画执行的相关接口。

该接口用于管理 Action 执行及结果收集,包括同步与异步执行方法。 每个 Action 由若干 Animation 组成,do_action()async_do_action() 方法将统一负责执行并收集结果。

Source code in src\tongsim\entity\ability\impl\action.py
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
class AgentActionAbility(Protocol):
    """
    AgentActionAbility 定义了角色动画执行的相关接口。

    该接口用于管理 Action 执行及结果收集,包括同步与异步执行方法。
    每个 Action 由若干 Animation 组成,`do_action()` 和 `async_do_action()` 方法将统一负责执行并收集结果。
    """

    async def async_enqueue_action(
        self, action: ActionBase, track_result: bool = False
    ) -> ActionBase:
        """
        异步将 Action 加入执行队列,不阻塞当前流程。

        Args:
            action (ActionBase): 要加入队列的 Action 对象。
            track_result (bool): 是否跟踪 Action 的执行结果,默认为 False。

        Returns:
            ActionBase: 已加入队列的 Action 对象。
        """

    def enqueue_action(
        self, action: ActionBase, track_result: bool = False
    ) -> ActionBase:
        """
        同步将 Action 加入队列。

        Args:
            action (ActionBase): 要加入队列的 Action 对象。
            track_result (bool): 是否跟踪 Action 的执行结果,默认为 False。

        Returns:
            ActionBase: 已加入队列的 Action 对象。
        """

    async def async_do_action(
        self, action: ActionBase | None = None, cancel_on_error: bool = False
    ) -> list[AnimResultInfo] | None:
        """
        异步执行指定的 Action 对象,并收集 Animation 结果。

        如果 `action` 为 None,则执行当前队列中的所有 Action。

        Args:
            action (ActionBase | None): 要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。
            cancel_on_error (bool): 遇到异常时是否取消剩余 Animation,默认为 False。

        Returns:
            list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

        """

    def do_action(
        self, action: ActionBase | None = None, cancel_on_error: bool = False
    ) -> list[AnimResultInfo] | None:
        """
        同步执行指定的 Action 对象,并收集 Animation 结果。

        如果 `action` 为 None,则执行当前队列中的所有 Action。

        Args:
            action (ActionBase | None): 要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。
            cancel_on_error (bool): 遇到异常时是否取消剩余 Animation,默认为 False。

        Returns:
            list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

        """

    async def async_get_playable_animation_names(self) -> list[str]:
        """
        异步获取当前智能体可播放的动画名称列表。

        Returns:
            list[str]: 可用动画名称的字符串列表。
        """

    def get_playable_animation_names(self) -> list[str]:
        """
        获取当前智能体可播放的动画名称列表(同步接口)。

        Returns:
            list[str]: 可用动画名称的字符串列表。
        """

    def enable_idle_random_anim(self, is_enable: bool) -> bool:
        """
        启用或禁用智能体的闲置状态随机动画(同步接口)。

        当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

        Args:
            is_enable (bool): 是否启用随机闲置动画。True 表示启用,False 表示禁用。

        Returns:
            bool: 操作是否成功。True 表示设置成功,False 表示失败。
        """

    async def async_enable_idle_random_anim(self, is_enable: bool) -> bool:
        """
        启用或禁用智能体的闲置状态随机动画(异步接口)。

        当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

        Args:
            is_enable (bool): 是否启用随机闲置动画。True 表示启用,False 表示禁用。

        Returns:
            bool: 操作是否成功。True 表示设置成功,False 表示失败。
        """

    def is_action_queue_empty(self) -> bool:
        """
        判断当前智能体的动作队列是否为空(同步接口)。

        如果队列为空,表示当前没有待执行的动作。

        Returns:
            bool: 若队列为空返回 True,否则返回 False。
        """

    async def async_is_action_queue_empty(self) -> bool:
        """
        判断当前智能体的动作队列是否为空(异步接口)。

        如果队列为空,表示当前没有待执行的动作。

        Returns:
            bool: 若队列为空返回 True,否则返回 False。
        """

    def get_agent_action_status(self) -> dict:
        """
        获取当前智能体的动作状态信息(同步接口)。

        Returns:
            dict: 动作状态信息字典
        """

    async def async_get_agent_action_status(self) -> dict:
        """
        获取当前智能体的动作状态信息(异步接口)。

        Returns:
            dict: 动作状态信息字典
        """

    def get_taking_entity_id(self, which_hand: AnimCmdHandType) -> str | None:
        """
        获取指定手上当前拿着的对象 ID(同步接口)。

        Args:
            which_hand (AnimCmdHandType): 哪只手

        Returns:
            str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。
        """

    async def async_get_taking_entity_id(
        self, which_hand: AnimCmdHandType
    ) -> str | None:
        """
        获取指定手上当前拿着的对象 ID(异步接口)。

        Args:
            which_hand (AnimCmdHandType): 哪只手
        Returns:
            str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。
        """

    def set_emotion(self, emotion: dict) -> None:
        """
        设置智能体的情绪状态(同步接口)。

        Args:
            emotion (dict): 情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间
        """

    async def async_set_emotion(self, emotion: dict) -> None:
        """
        设置智能体的情绪状态(异步接口)。

        Args:
            emotion (dict): 情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间
        """

    def set_enable_physics_body(self, is_enable: bool) -> bool:
        """
        设定是否开启人物的物理碰撞(同步接口)。

        Args:
            is_enable (bool): 是否开启。

        Returns:
            是否成功设置。
        """

    async def async_set_enable_physics_body(self, is_enable: bool) -> bool:
        """
        设定是否开启人物的物理碰撞(异步接口)。

        Args:
            is_enable (bool): 是否开启。

        Returns:
            是否成功设置。
        """

    def set_move_ability(
        self,
        walk_speed: float,
        run_speed: float,
        jump_z_velocity: float,
        crouch_speed: float,
        move_friction: float = 0.5,
    ) -> bool:
        """
        设置运动参数(同步接口)只适用于InputAnimation动作的状态。

        Args:
             walk_speed (float): 行走速度
             run_speed (float): 奔跑速度
             jump_z_velocity (float): 跳跃z轴初速度
             crouch_speed (float): 蹲伏移动速度
             move_friction (float): 撞到障碍物后的摩擦系数
        """

    async def async_set_move_ability(
        self,
        walk_speed: float,
        run_speed: float,
        jump_z_velocity: float,
        crouch_speed: float,
        move_friction: float = 0.5,
    ) -> bool:
        """
        设置运动参数(异步接口)只适用于InputAnimation动作的状态。

        Args:
             walk_speed (float): 行走速度
             run_speed (float): 奔跑速度
             jump_z_velocity (float): 跳跃z轴初速度
             crouch_speed (float): 蹲伏移动速度
             move_friction (float): 撞到障碍物后的摩擦系数
        """

async_enqueue_action async

async_enqueue_action(
    action: ActionBase, track_result: bool = False
) -> ActionBase

异步将 Action 加入执行队列,不阻塞当前流程。

Parameters:

Name Type Description Default
action ActionBase

要加入队列的 Action 对象。

required
track_result bool

是否跟踪 Action 的执行结果,默认为 False。

False

Returns:

Name Type Description
ActionBase ActionBase

已加入队列的 Action 对象。

Source code in src\tongsim\entity\ability\impl\action.py
37
38
39
40
41
42
43
44
45
46
47
48
49
async def async_enqueue_action(
    self, action: ActionBase, track_result: bool = False
) -> ActionBase:
    """
    异步将 Action 加入执行队列,不阻塞当前流程。

    Args:
        action (ActionBase): 要加入队列的 Action 对象。
        track_result (bool): 是否跟踪 Action 的执行结果,默认为 False。

    Returns:
        ActionBase: 已加入队列的 Action 对象。
    """

enqueue_action

enqueue_action(
    action: ActionBase, track_result: bool = False
) -> ActionBase

同步将 Action 加入队列。

Parameters:

Name Type Description Default
action ActionBase

要加入队列的 Action 对象。

required
track_result bool

是否跟踪 Action 的执行结果,默认为 False。

False

Returns:

Name Type Description
ActionBase ActionBase

已加入队列的 Action 对象。

Source code in src\tongsim\entity\ability\impl\action.py
51
52
53
54
55
56
57
58
59
60
61
62
63
def enqueue_action(
    self, action: ActionBase, track_result: bool = False
) -> ActionBase:
    """
    同步将 Action 加入队列。

    Args:
        action (ActionBase): 要加入队列的 Action 对象。
        track_result (bool): 是否跟踪 Action 的执行结果,默认为 False。

    Returns:
        ActionBase: 已加入队列的 Action 对象。
    """

async_do_action async

async_do_action(
    action: ActionBase | None = None,
    cancel_on_error: bool = False,
) -> list[AnimResultInfo] | None

异步执行指定的 Action 对象,并收集 Animation 结果。

如果 action 为 None,则执行当前队列中的所有 Action。

Parameters:

Name Type Description Default
action ActionBase | None

要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。

None
cancel_on_error bool

遇到异常时是否取消剩余 Animation,默认为 False。

False

Returns:

Type Description
list[AnimResultInfo] | None

list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

Source code in src\tongsim\entity\ability\impl\action.py
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
async def async_do_action(
    self, action: ActionBase | None = None, cancel_on_error: bool = False
) -> list[AnimResultInfo] | None:
    """
    异步执行指定的 Action 对象,并收集 Animation 结果。

    如果 `action` 为 None,则执行当前队列中的所有 Action。

    Args:
        action (ActionBase | None): 要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。
        cancel_on_error (bool): 遇到异常时是否取消剩余 Animation,默认为 False。

    Returns:
        list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

    """

do_action

do_action(
    action: ActionBase | None = None,
    cancel_on_error: bool = False,
) -> list[AnimResultInfo] | None

同步执行指定的 Action 对象,并收集 Animation 结果。

如果 action 为 None,则执行当前队列中的所有 Action。

Parameters:

Name Type Description Default
action ActionBase | None

要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。

None
cancel_on_error bool

遇到异常时是否取消剩余 Animation,默认为 False。

False

Returns:

Type Description
list[AnimResultInfo] | None

list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

Source code in src\tongsim\entity\ability\impl\action.py
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
def do_action(
    self, action: ActionBase | None = None, cancel_on_error: bool = False
) -> list[AnimResultInfo] | None:
    """
    同步执行指定的 Action 对象,并收集 Animation 结果。

    如果 `action` 为 None,则执行当前队列中的所有 Action。

    Args:
        action (ActionBase | None): 要执行的 Action 对象。如果为 None,则执行队列中的所有 Action。
        cancel_on_error (bool): 遇到异常时是否取消剩余 Animation,默认为 False。

    Returns:
        list[AnimResultInfo] | None: 每个 Animation 的执行结果,或 None(若 action 为 None)。

    """

async_get_playable_animation_names async

async_get_playable_animation_names() -> list[str]

异步获取当前智能体可播放的动画名称列表。

Returns:

Type Description
list[str]

list[str]: 可用动画名称的字符串列表。

Source code in src\tongsim\entity\ability\impl\action.py
 99
100
101
102
103
104
105
async def async_get_playable_animation_names(self) -> list[str]:
    """
    异步获取当前智能体可播放的动画名称列表。

    Returns:
        list[str]: 可用动画名称的字符串列表。
    """

get_playable_animation_names

get_playable_animation_names() -> list[str]

获取当前智能体可播放的动画名称列表(同步接口)。

Returns:

Type Description
list[str]

list[str]: 可用动画名称的字符串列表。

Source code in src\tongsim\entity\ability\impl\action.py
107
108
109
110
111
112
113
def get_playable_animation_names(self) -> list[str]:
    """
    获取当前智能体可播放的动画名称列表(同步接口)。

    Returns:
        list[str]: 可用动画名称的字符串列表。
    """

enable_idle_random_anim

enable_idle_random_anim(is_enable: bool) -> bool

启用或禁用智能体的闲置状态随机动画(同步接口)。

当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

Parameters:

Name Type Description Default
is_enable bool

是否启用随机闲置动画。True 表示启用,False 表示禁用。

required

Returns:

Name Type Description
bool bool

操作是否成功。True 表示设置成功,False 表示失败。

Source code in src\tongsim\entity\ability\impl\action.py
115
116
117
118
119
120
121
122
123
124
125
126
def enable_idle_random_anim(self, is_enable: bool) -> bool:
    """
    启用或禁用智能体的闲置状态随机动画(同步接口)。

    当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

    Args:
        is_enable (bool): 是否启用随机闲置动画。True 表示启用,False 表示禁用。

    Returns:
        bool: 操作是否成功。True 表示设置成功,False 表示失败。
    """

async_enable_idle_random_anim async

async_enable_idle_random_anim(is_enable: bool) -> bool

启用或禁用智能体的闲置状态随机动画(异步接口)。

当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

Parameters:

Name Type Description Default
is_enable bool

是否启用随机闲置动画。True 表示启用,False 表示禁用。

required

Returns:

Name Type Description
bool bool

操作是否成功。True 表示设置成功,False 表示失败。

Source code in src\tongsim\entity\ability\impl\action.py
128
129
130
131
132
133
134
135
136
137
138
139
async def async_enable_idle_random_anim(self, is_enable: bool) -> bool:
    """
    启用或禁用智能体的闲置状态随机动画(异步接口)。

    当启用后,智能体在没有执行其他动作时,将自动播放预定义的随机闲置动画。

    Args:
        is_enable (bool): 是否启用随机闲置动画。True 表示启用,False 表示禁用。

    Returns:
        bool: 操作是否成功。True 表示设置成功,False 表示失败。
    """

is_action_queue_empty

is_action_queue_empty() -> bool

判断当前智能体的动作队列是否为空(同步接口)。

如果队列为空,表示当前没有待执行的动作。

Returns:

Name Type Description
bool bool

若队列为空返回 True,否则返回 False。

Source code in src\tongsim\entity\ability\impl\action.py
141
142
143
144
145
146
147
148
149
def is_action_queue_empty(self) -> bool:
    """
    判断当前智能体的动作队列是否为空(同步接口)。

    如果队列为空,表示当前没有待执行的动作。

    Returns:
        bool: 若队列为空返回 True,否则返回 False。
    """

async_is_action_queue_empty async

async_is_action_queue_empty() -> bool

判断当前智能体的动作队列是否为空(异步接口)。

如果队列为空,表示当前没有待执行的动作。

Returns:

Name Type Description
bool bool

若队列为空返回 True,否则返回 False。

Source code in src\tongsim\entity\ability\impl\action.py
151
152
153
154
155
156
157
158
159
async def async_is_action_queue_empty(self) -> bool:
    """
    判断当前智能体的动作队列是否为空(异步接口)。

    如果队列为空,表示当前没有待执行的动作。

    Returns:
        bool: 若队列为空返回 True,否则返回 False。
    """

get_agent_action_status

get_agent_action_status() -> dict

获取当前智能体的动作状态信息(同步接口)。

Returns:

Name Type Description
dict dict

动作状态信息字典

Source code in src\tongsim\entity\ability\impl\action.py
161
162
163
164
165
166
167
def get_agent_action_status(self) -> dict:
    """
    获取当前智能体的动作状态信息(同步接口)。

    Returns:
        dict: 动作状态信息字典
    """

async_get_agent_action_status async

async_get_agent_action_status() -> dict

获取当前智能体的动作状态信息(异步接口)。

Returns:

Name Type Description
dict dict

动作状态信息字典

Source code in src\tongsim\entity\ability\impl\action.py
169
170
171
172
173
174
175
async def async_get_agent_action_status(self) -> dict:
    """
    获取当前智能体的动作状态信息(异步接口)。

    Returns:
        dict: 动作状态信息字典
    """

get_taking_entity_id

get_taking_entity_id(
    which_hand: AnimCmdHandType,
) -> str | None

获取指定手上当前拿着的对象 ID(同步接口)。

Parameters:

Name Type Description Default
which_hand AnimCmdHandType

哪只手

required

Returns:

Type Description
str | None

str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。

Source code in src\tongsim\entity\ability\impl\action.py
177
178
179
180
181
182
183
184
185
186
def get_taking_entity_id(self, which_hand: AnimCmdHandType) -> str | None:
    """
    获取指定手上当前拿着的对象 ID(同步接口)。

    Args:
        which_hand (AnimCmdHandType): 哪只手

    Returns:
        str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。
    """

async_get_taking_entity_id async

async_get_taking_entity_id(
    which_hand: AnimCmdHandType,
) -> str | None

获取指定手上当前拿着的对象 ID(异步接口)。

Parameters:

Name Type Description Default
which_hand AnimCmdHandType

哪只手

required

Returns: str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。

Source code in src\tongsim\entity\ability\impl\action.py
188
189
190
191
192
193
194
195
196
197
198
async def async_get_taking_entity_id(
    self, which_hand: AnimCmdHandType
) -> str | None:
    """
    获取指定手上当前拿着的对象 ID(异步接口)。

    Args:
        which_hand (AnimCmdHandType): 哪只手
    Returns:
        str | None: 被拿取对象的实体 ID,若未拿取任何对象则返回 None。
    """

set_emotion

set_emotion(emotion: dict) -> None

设置智能体的情绪状态(同步接口)。

Parameters:

Name Type Description Default
emotion dict

情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间

required
Source code in src\tongsim\entity\ability\impl\action.py
200
201
202
203
204
205
206
def set_emotion(self, emotion: dict) -> None:
    """
    设置智能体的情绪状态(同步接口)。

    Args:
        emotion (dict): 情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间
    """

async_set_emotion async

async_set_emotion(emotion: dict) -> None

设置智能体的情绪状态(异步接口)。

Parameters:

Name Type Description Default
emotion dict

情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间

required
Source code in src\tongsim\entity\ability\impl\action.py
208
209
210
211
212
213
214
async def async_set_emotion(self, emotion: dict) -> None:
    """
    设置智能体的情绪状态(异步接口)。

    Args:
        emotion (dict): 情绪状态的字典表示。支持的情绪类型["happy", "angry", "horror", "sad","disgust","surprise","worry"],范围在[0,1]之间
    """

set_enable_physics_body

set_enable_physics_body(is_enable: bool) -> bool

设定是否开启人物的物理碰撞(同步接口)。

Parameters:

Name Type Description Default
is_enable bool

是否开启。

required

Returns:

Type Description
bool

是否成功设置。

Source code in src\tongsim\entity\ability\impl\action.py
216
217
218
219
220
221
222
223
224
225
def set_enable_physics_body(self, is_enable: bool) -> bool:
    """
    设定是否开启人物的物理碰撞(同步接口)。

    Args:
        is_enable (bool): 是否开启。

    Returns:
        是否成功设置。
    """

async_set_enable_physics_body async

async_set_enable_physics_body(is_enable: bool) -> bool

设定是否开启人物的物理碰撞(异步接口)。

Parameters:

Name Type Description Default
is_enable bool

是否开启。

required

Returns:

Type Description
bool

是否成功设置。

Source code in src\tongsim\entity\ability\impl\action.py
227
228
229
230
231
232
233
234
235
236
async def async_set_enable_physics_body(self, is_enable: bool) -> bool:
    """
    设定是否开启人物的物理碰撞(异步接口)。

    Args:
        is_enable (bool): 是否开启。

    Returns:
        是否成功设置。
    """

set_move_ability

set_move_ability(
    walk_speed: float,
    run_speed: float,
    jump_z_velocity: float,
    crouch_speed: float,
    move_friction: float = 0.5,
) -> bool

设置运动参数(同步接口)只适用于InputAnimation动作的状态。

Parameters:

Name Type Description Default
walk_speed float

行走速度

required
run_speed float

奔跑速度

required
jump_z_velocity float

跳跃z轴初速度

required
crouch_speed float

蹲伏移动速度

required
move_friction float

撞到障碍物后的摩擦系数

0.5
Source code in src\tongsim\entity\ability\impl\action.py
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
def set_move_ability(
    self,
    walk_speed: float,
    run_speed: float,
    jump_z_velocity: float,
    crouch_speed: float,
    move_friction: float = 0.5,
) -> bool:
    """
    设置运动参数(同步接口)只适用于InputAnimation动作的状态。

    Args:
         walk_speed (float): 行走速度
         run_speed (float): 奔跑速度
         jump_z_velocity (float): 跳跃z轴初速度
         crouch_speed (float): 蹲伏移动速度
         move_friction (float): 撞到障碍物后的摩擦系数
    """

async_set_move_ability async

async_set_move_ability(
    walk_speed: float,
    run_speed: float,
    jump_z_velocity: float,
    crouch_speed: float,
    move_friction: float = 0.5,
) -> bool

设置运动参数(异步接口)只适用于InputAnimation动作的状态。

Parameters:

Name Type Description Default
walk_speed float

行走速度

required
run_speed float

奔跑速度

required
jump_z_velocity float

跳跃z轴初速度

required
crouch_speed float

蹲伏移动速度

required
move_friction float

撞到障碍物后的摩擦系数

0.5
Source code in src\tongsim\entity\ability\impl\action.py
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
async def async_set_move_ability(
    self,
    walk_speed: float,
    run_speed: float,
    jump_z_velocity: float,
    crouch_speed: float,
    move_friction: float = 0.5,
) -> bool:
    """
    设置运动参数(异步接口)只适用于InputAnimation动作的状态。

    Args:
         walk_speed (float): 行走速度
         run_speed (float): 奔跑速度
         jump_z_velocity (float): 跳跃z轴初速度
         crouch_speed (float): 蹲伏移动速度
         move_friction (float): 撞到障碍物后的摩擦系数
    """