New world weapon API

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
Zehra
Private First Class
Private First Class
Posts: 915
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

New world weapon API

Post by Zehra »

The world weapon API has changed a lot.

bz_fireWorldGM ( int targetPlayerID, float lifetime, float *pos, float tilt, float direction, float dt , bz_eTeamType shotTeam = eRogueTeam );
Parameters

Code: Select all

name 	                type 	       value description
targetPlayerID 	          int 	       Player to fire the GM at.
lifetime 	         float 	       How long the world weapon will "live".
*pos 	                 float 	       Position the world weapon will fire from.
tilt 	                 float 	       The tilt of the weapon in radians.
direction 	         float 	       The direction of which to fire the world weapon in radians. (rotation)
dt 	                 float 	       Delay time. How many seconds the weapon waits before firing.
shotTeam 	         bz_eTeamType 	Team color of the weapon. (Rogue by default) 
fireWorldWep ( const char* flagType, float lifetime, int fromPlayer, float *pos, float tilt, float direction, int *shotID , float dt , bz_eTeamType shotTeam = eRogueTeam );
Parameters

Code: Select all

name 	            type 	                value description
flagType 	    const char* 	        Flag type the world weapon will fire with
lifetime 	    float 	                How long the world weapon will "live".
fromPlayer          int 	                Player ID that fired the shot, or BZ_SERVER.
*pos 	            float                  	Position the world weapon will fire from.
tilt 	            float 	                The tilt of the weapon in radians.
direction 	    float 	                The direction of which to fire the world weapon in radians. (rotation)
shotID 	            int                         Shot ID of the world weapon.
dt 	            float 	                Delay time. How many seconds the weapon waits before firing.
shotTeam 	    bz_eTeamType 	     Team color of the weapon. (Rogue by default) 
The newer version uses this:
bz_fireServerShot(const char* shotType, float origin[3], float vector[3], bz_eTeamType color = eRogueTeam, int targetPlayerId = -1);

How would I convert both versions to the newer version of the API?
(I would like to be able to update these two custom flag plug-ins SnakeShots and CustomFlags.)

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: New world weapon API

Post by allejo »

Take a look at how core BZFlag plugins were updated to the new API and an overview of how to use the new API.

Narrow down your question to something more specific.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: New world weapon API

Post by JeffM »

The new function mostly ignores some arguments and takes a vector instead of 2 angles.

The utility function
bz_vectorFromRotations(const float tilt, const float rotation, float outVec[3])

Is provided for developers who don’t know basic trigonometry.
ImageJeffM
User avatar
Zehra
Private First Class
Private First Class
Posts: 915
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: New world weapon API

Post by Zehra »

Thank you JeffM and allejo.

Was able to get custom flags updated. :)

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
Post Reply