Fix bug where we don't stop attacking NPCs when they escape.

This commit is contained in:
Condorra 2023-09-11 22:29:34 +10:00
parent d5641a97f7
commit daa847b448

View File

@ -529,19 +529,17 @@ async fn attempt_move_immediate(
Some(attackers) => {
let mut attacker_names = Vec::new();
let mut attacker_items = Vec::new();
if let Some((_, session_dat)) = session.as_ref() {
for attacker in &attackers[..] {
if let Some((atype, acode)) = attacker.split_once("/") {
if let Some(aitem) =
ctx.trans.find_item_by_type_code(atype, acode).await?
{
for attacker in &attackers[..] {
if let Some((atype, acode)) = attacker.split_once("/") {
if let Some(aitem) = ctx.trans.find_item_by_type_code(atype, acode).await? {
if let Some((_, session_dat)) = session.as_ref() {
attacker_names.push(aitem.display_for_session(session_dat));
// We don't push the actual attacker Item, because another attacker
// might re-target this attacker when we escape, causing the structure
// to be out of date. Instead, we push the type, code pair and look it
// up when we need it.
attacker_items.push((atype, acode));
}
// We don't push the actual attacker Item, because another attacker
// might re-target this attacker when we escape, causing the structure
// to be out of date. Instead, we push the type, code pair and look it
// up when we need it.
attacker_items.push((atype, acode));
}
}
}