FTE/SERVER: Fix traceweapons not penetrating multiple enemies

This commit is contained in:
cypress 2023-07-18 12:05:49 -04:00
parent b416568c7c
commit b4f8a15cc3
2 changed files with 72 additions and 15 deletions

View file

@ -783,3 +783,57 @@ void() Do_Zombie_AI = {
self = oself;
lastzombie = z;
}
#ifdef FTE
void() AI_SetAllEnemiesBBOX =
{
entity list;
// First target zombies
list = find(world, classname, "ai_zombie");
while (list != world) {
list.solid = SOLID_BBOX;
if (list.head) list.head.solid = SOLID_BBOX;
if (list.larm) list.larm.solid = SOLID_BBOX;
if (list.rarm) list.rarm.solid = SOLID_BBOX;
list = find(list, classname, "ai_zombie");
}
// Now Dogs
list = find(world, classname, "ai_dog");
while (list != world) {
list.solid = SOLID_BBOX;
list = find(list, classname, "ai_dog");
}
}
void() AI_SetAllEnemiesCorpse =
{
entity list;
// First target zombies
list = find(world, classname, "ai_zombie");
while (list != world) {
list.solid = SOLID_CORPSE;
if (list.head) list.head.solid = SOLID_CORPSE;
if (list.larm) list.larm.solid = SOLID_CORPSE;
if (list.rarm) list.rarm.solid = SOLID_CORPSE;
list = find(list, classname, "ai_zombie");
}
// Now Dogs
list = find(world, classname, "ai_dog");
while (list != world) {
list.solid = SOLID_CORPSE;
list = find(list, classname, "ai_dog");
}
}
#endif // FTE

View file

@ -30,6 +30,10 @@ void() W_PutOut;
void(float side) W_Reload;
void() GrenadeExplode;
void() W_SprintStart;
#ifdef FTE
void() AI_SetAllEnemiesBBOX;
void() AI_SetAllEnemiesCorpse;
#endif // FTE
void() ReturnWeaponModel =
{
@ -991,21 +995,20 @@ void (float shotcount, float sprd, float Damage, float side) FireTrace =
hitent = world;
while (!do_break && random() < getWeaponPenetration(self.weapon, penetration_times))
{
while (1)
{
traceline (trace_start_org, trace_start_org + dir, MOVE_HITMODEL, trace_ent);
if (hitent == world)
break;
/*if (hitent.larm == trace_ent || hitent.rarm == trace_ent || hitent.head == trace_ent)
{
hitent = trace_ent;
trace_start_org = trace_endpos + normalize(dir)*10;
//break;
}*/
else
break;
}
#ifdef FTE
AI_SetAllEnemiesBBOX();
#endif // FTE
traceline (trace_start_org, trace_start_org + dir, MOVE_HITMODEL, trace_ent);
#ifdef FTE
AI_SetAllEnemiesCorpse();
#endif // FTE
if (trace_fraction != 1.0)
TraceAttack (Damage, dir, trace_endpos, trace_plane_normal, trace_ent, side);