API_DOCS: Player State Changes

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

API_DOCS: Player State Changes

Post by JeffM »

for the 2.1.x API I have made some changes and cleanups with regards to how plugins get the state for a player.

A new structure has been added for dealing with player tank states.

Code: Select all

typedef enum
{
	eDead,		// not alive, not paused, etc.
	eAlive,				// player is alive
	ePaused,			// player is paused
	eExploding,			// currently blowing up
	eTeleporting,		// teleported recently
	eInBuilding			// has OO and is in a building
}bz_ePlayerStatus;

typedef struct bz_PlayerUpdateState
{
	bz_ePlayerStatus	status;			// special states
	bool				falling;		// not driving on the ground or an obstacle
	bool				crossingWall;	// crossing an obstacle wall
	bool				inPhantomZone;	// zoned
	float				pos[3];			// position of tank
	float				velocity[3];	// velocity of tank
	float				rotation;		// orientation of tank
	float				angVel;			// angular velocity of tank
	int					phydrv;			// physics driver
}bz_PlayerUpdateState;
This structure contains all the needed info about where a tank is and what is doing.

The bz_PlayerUpdateEventData_V1 now contains this structure as the state member and contains the state data from the player update.

bz_BasePlayerRecord contains 2 state structs, lastKnownState, for the state of the last update, and currentState for the currently interpolated state. lastUpdateTime has also been added to mark the time of the last known state.

last but not least;

Code: Select all

BZF_API bool bz_getPlayerCurrentState ( int playerID, bz_PlayerUpdateState &state );
Returns the current state of the specified player, as interpolated by the server.

bz_PlayerUpdateState is also used by the bz_ServerSidePlayerHandler class for server side players (bots).

***NOTE***
these changes are only for 2.1, they do not affect 2.0.x an any existing plug-ins.
ImageJeffM
Post Reply