Add fix for player-limb collisions

This commit is contained in:
blubs 2023-01-15 10:10:25 -08:00
parent 76213de449
commit 5d8af19ecc
4 changed files with 25 additions and 1 deletions

View File

@ -1537,6 +1537,12 @@ void(entity szombie) SetUpHitBoxes =
szombie.rarm.classname = "ai_zombie_rarm";
szombie.rarm.takedamage = DAMAGE_YES;
#ifdef PC
szombie.head.dimension_solid = HITBOX_DIM_LIMBS;
szombie.larm.dimension_solid = HITBOX_DIM_LIMBS;
szombie.rarm.dimension_solid = HITBOX_DIM_LIMBS;
#endif // PC
local entity oldself = self;
self = szombie;
SetZombieHitBox(BASE_BBOX);
@ -1645,7 +1651,10 @@ void(entity where) spawn_a_zombieB =
#endif
szombie.solid = szombie.head.solid = SOLID_CORPSE;
szombie.solid = SOLID_CORPSE;
#ifdef PC
szombie.dimension_solid = HITBOX_DIM_ZOMBIES;
#endif // PC
szombie.movetype = MOVETYPE_WALK;
setmodel(szombie, "models/ai/zb#.mdl");
szombie.hop_step = 0;

View File

@ -258,6 +258,11 @@ float crawler_num;
#define WIDLEBOX 16
//========================
// Definitions for the `.dimension_hit` and `.dimension_solid` fields
// Used to let limbs be non-solid to player bbox but still be hit by player tracelines
#define HITBOX_DIM_LIMBS 1
#define HITBOX_DIM_ZOMBIES 2
//we're using usedent for who is currently hopping the window
//Used for windows to keep track of what zombies are at windows
.entity box1owner, box2owner, box3owner;

View File

@ -517,6 +517,10 @@ void() PlayerSpawn =
self.isspec = FALSE;
self.classname = "player";
self.solid = SOLID_BBOX;
// We can only collide with zombies (and not their limbs)
#ifdef PC
self.dimension_hit = HITBOX_DIM_ZOMBIES;
#endif // PC
setmodel(self, "models/player.mdl");
self.movetype = MOVETYPE_WALK;
self.max_health = self.health = 100;

View File

@ -1547,7 +1547,13 @@ void(float side) W_Fire =
// Weapon Projectile/Trace Logic.
if (Util_WeaponFiresTraceshot(self.weapon)) {
#ifdef PC
self.dimension_hit = HITBOX_DIM_LIMBS | HITBOX_DIM_ZOMBIES;
#endif // PC
FireTrace(shotcount, spread, damage, side);
#ifdef PC
self.dimension_hit = HITBOX_DIM_ZOMBIES;
#endif // PC
}
switch(firetype) {