OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
hit_location_test Namespace Reference

Classes

class  Shooter

Functions

 game_log (home)
 server_id (port)
 join (port, protocol, name)
 main ()

Variables

 ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
dict DEFAULT_BINARY
str RCON = 'hitpw'
 BUTTON_MELEE
 BUTTON_FRAG
 PREFERENCES = os.path.expanduser('~/.cod2/preferences')
str WEAPON = 'g43_mp'
int DISTANCE = 120
dict HEAD = {'head', 'helmet', 'neck', 'torso_upper'}
tuple AIMS
str GAMETYPE

Detailed Description

A player shoots another and the game reports where each bullet hit.

    python3 scripts/hit_location_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--listen]

Writes a mod in a temporary home folder whose dm gametype spawns the first
player to join as the target, with a body model and a lot of health, and the
second one a few steps in front of it, facing it, held in place, with a
semi-automatic rifle. The second player is a minimal client (cod2client) that
presses and releases the attack button, first aiming level, at the target's
head, then 15 degrees down, at its legs; each hit makes the mod log the hit
location the game passes to Callback_PlayerDamage. So real shots go through
the server's weapon fire, its locational trace, and the target's DObj and
skeleton, which must put the head and the legs where they are.

Last it fires level again at the target looking up, whose torso and head the
player controllers turn. The target is another minimal client, on the
dedicated server or with --listen in a game a client hosts (its local server
is CoD2rev-Plus's, on the engine's collision and xanim; the host stands
aside); --listen needs a CD key in ~/.cod2/preferences and is skipped
without one. Exits with 0 when both aims hit the target, each
hit is a rifle bullet in the body parts of its aim, and nothing crashed.

Function Documentation

◆ game_log()

hit_location_test.game_log ( home)

◆ join()

hit_location_test.join ( port,
protocol,
name )
A minimal client in the game, or the reason it is not.

◆ main()

hit_location_test.main ( )

◆ server_id()

hit_location_test.server_id ( port)

Variable Documentation

◆ AIMS

tuple hit_location_test.AIMS
Initial value:
1= (('level', 0.0, 0.0, HEAD),
2 ('down', 15.0, 0.0, {'torso_lower', 'right_leg_upper', 'left_leg_upper', 'right_leg_lower', 'left_leg_lower'}),
3 ('level at a target looking up', 0.0, -60.0, HEAD))

◆ BUTTON_FRAG

hit_location_test.BUTTON_FRAG

◆ BUTTON_MELEE

hit_location_test.BUTTON_MELEE

◆ DEFAULT_BINARY

dict hit_location_test.DEFAULT_BINARY
Initial value:
1= {
2 (115, False): 'build/check-linux-10/cod2_lnxded', (118, False): 'build/check-linux/cod2_lnxded',
3 (115, True): 'build/check-linux-10/cod2_linux', (118, True): 'build/check-linux/cod2_linux',
4}

◆ DISTANCE

int hit_location_test.DISTANCE = 120

◆ GAMETYPE

str hit_location_test.GAMETYPE

◆ HEAD

dict hit_location_test.HEAD = {'head', 'helmet', 'neck', 'torso_upper'}

◆ PREFERENCES

hit_location_test.PREFERENCES = os.path.expanduser('~/.cod2/preferences')

◆ RCON

str hit_location_test.RCON = 'hitpw'

◆ ROOT

hit_location_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

◆ WEAPON

str hit_location_test.WEAPON = 'g43_mp'