| 386 | } |
| 387 | |
| 388 | void zNPCMsg_AreaPlayerStun(F32 stuntime, F32 radius, xVec3* pos) |
| 389 | { |
| 390 | st_XORDEREDARRAY* npclist = zNPCMgr_GetNPCList(); |
| 391 | xVec3 from; |
| 392 | |
| 393 | if (pos != NULL) |
| 394 | { |
| 395 | xVec3Copy(&from, pos); |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | xVec3Copy(&from, xEntGetPos(&globals.player.ent)); |
| 400 | } |
| 401 | |
| 402 | F32 ds2_discard = SQ(radius); |
| 403 | |
| 404 | for (S32 i = 0; i < npclist->cnt; i++) |
| 405 | { |
| 406 | zNPCCommon* npc = (zNPCCommon*)npclist->list[i]; |
| 407 | |
| 408 | if (((npc->baseFlags & 0x40) == 0) && |
| 409 | (npc->model == NULL || (npc->model->Flags & 0x400) == 0) && |
| 410 | (npc->flg_vuln & 0x10000000)) |
| 411 | { |
| 412 | U32 ntyp = npc->SelfType(); |
| 413 | |
| 414 | if ((ntyp & 0xFFFFFF00) == 'NTR\0') |
| 415 | { |
| 416 | zNPCRobot* robo = (zNPCRobot*)npc; |
| 417 | if (robo->IsDying()) |
| 418 | { |
| 419 | continue; |
| 420 | } |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | if (!npc->IsAlive()) |
| 425 | { |
| 426 | continue; |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | xVec3 diff; |
| 431 | npc->XYZVecToPos(&diff, &from); |
| 432 | |
| 433 | if (FABS(diff.y) > radius) |
| 434 | { |
| 435 | continue; |
| 436 | } |
| 437 | diff.y = 0.0f; |
| 438 | if (xVec3Length2(&diff) > ds2_discard) |
| 439 | { |
| 440 | continue; |
| 441 | } |
| 442 | npc->Stun(stuntime); |
| 443 | } |
| 444 | } |
| 445 | } |
nothing calls this directly
no test coverage detected