add asyncio
This commit is contained in:
@@ -60,8 +60,8 @@ class Avatar:
|
||||
在Avatar创建后自动初始化tile和AI
|
||||
"""
|
||||
self.tile = self.world.map.get_tile(self.pos_x, self.pos_y)
|
||||
# self.ai = LLMAI(self)
|
||||
self.ai = RuleAI(self)
|
||||
self.ai = LLMAI(self)
|
||||
# self.ai = RuleAI(self)
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""
|
||||
@@ -91,7 +91,7 @@ class Avatar:
|
||||
raise ValueError(f"未找到名为 '{action_name}' 的动作类")
|
||||
|
||||
|
||||
def act(self):
|
||||
async def act(self):
|
||||
"""
|
||||
角色执行动作。
|
||||
实际上分为两步:决定做什么(decide)和实际去做(do)
|
||||
@@ -101,7 +101,7 @@ class Avatar:
|
||||
|
||||
if self.cur_action_pair is None:
|
||||
# 决定动作时生成事件
|
||||
action_name, action_args, event = self.ai.decide(self.world)
|
||||
action_name, action_args, event = await self.ai.decide(self.world)
|
||||
action = self.create_action(action_name)
|
||||
self.cur_action_pair = (action, action_args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user