Enabled AI to use unarmed attack when switching weapons

Added build folders to gitignore.
This commit is contained in:
NovaRain
2021-05-08 23:11:37 +08:00
parent 183b74a8fa
commit f3f8321415
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -55,8 +55,10 @@ nb-configuration.xml
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Dd]evXP
[Rr]elease/
[Rr]eleases/
[Rr]eleaseXP/
x64/
x86/
build/
+7
View File
@@ -280,7 +280,14 @@ static long __fastcall ai_try_attack_switch_fix(fo::GameObject* target, long &hi
}
return 1; // all good, execute vanilla behavior of ai_switch_weapons_ function
}
// no other weapon in inventory
if (weapon) {
if (fo::func::item_w_range(source, fo::AttackType::ATKTYPE_PUNCH) >= fo::func::obj_dist(source, target)) {
hitMode = fo::AttackType::ATKTYPE_PUNCH;
return 0; // change hit mode, continue attack cycle
}
}
return (weapon) ? -1 // exit, NPC has a weapon in hand slot, so we don't look for another weapon on the map
: 1; // no weapon in inventory or hand slot, continue to search weapons on the map (call ai_switch_weapons_)
}