feat: 增强踢人逻辑与BOSS脚本支持
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
优化踢人超时处理和僵尸连接清理,支持BOSS动作脚本并增加测试,修复事件匹配与战斗循环中的并发问题。
This commit is contained in:
@@ -162,7 +162,8 @@ func (f *FightC) collectPlayerActions(expectedSlots map[actionSlotKey]struct{})
|
||||
|
||||
waitr := time.Duration(f.waittime)*time.Millisecond*10 + 30*time.Second
|
||||
|
||||
timeout := time.After(waitr)
|
||||
timeout := time.NewTimer(waitr)
|
||||
defer timeout.Stop()
|
||||
for len(actions) < len(expectedSlots) {
|
||||
|
||||
select {
|
||||
@@ -266,11 +267,12 @@ func (f *FightC) collectPlayerActions(expectedSlots map[actionSlotKey]struct{})
|
||||
actions[key] = paction
|
||||
//fmt.Println("玩家执行动作:", pid, paction.Priority())
|
||||
|
||||
case <-timeout:
|
||||
case <-timeout.C:
|
||||
r := f.handleTimeout(expectedSlots, actions)
|
||||
if r {
|
||||
return flattenActionMap(actions)
|
||||
}
|
||||
timeout.Reset(waitr)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -287,7 +289,7 @@ func (f *FightC) handleTimeout(expectedSlots map[actionSlotKey]struct{}, actions
|
||||
}
|
||||
player := f.getPlayerByID(key.PlayerID)
|
||||
if player != nil {
|
||||
go f.UseSkillAt(player, 0, key.ActorIndex, 0)
|
||||
f.UseSkillAt(player, 0, key.ActorIndex, 0)
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user