Players bump into each other, a knife hits, and explosions reach a player.
python3 scripts/contact_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--listen]
Like scripts/hit_location_test.py, whose minimal client it uses, it writes a dm
gametype that spawns a target and, in front of it, a player that a minimal
client drives. The test picks each phase with rcon (contact_phase), which the
mod polls:
- walk: the second player walks straight at the target for a few seconds; the
two must collide, so the distance between them never falls under a body's
width. Player against player clipping goes through the world's sectors.
- trigger: it walks at the target again, through a trigger_radius on its
way, which must fire; the trigger finds the player through the world's
sectors.
- melee: it stands next to the target and presses the melee button; the target
must take MOD_MELEE hits.
- grenade: it stands farther, aims down and throws a frag grenade, whose
splash must hit the target; the grenade flies and bounces on the world's
collision.
- kill: with its health down, an explosion kills the target, whose body the
mod clones, and which spawns again two seconds later.
- radius: the mod calls radiusDamage next to the target, spawned again,
which must take a MOD_EXPLOSIVE hit; the explosion finds it through the
world's sectors too.
The target is another minimal client on the dedicated server, or with --listen
the client that hosts the game (with a CD key in ~/.cod2/preferences; skipped
without one). Exits with 0 when every phase holds and nothing crashed.