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: 444
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

New world weapon API

Post by Zehra » Tue Jun 19, 2018 12:56 am

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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 724
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: New world weapon API

Post by allejo » Wed Jun 20, 2018 1:40 am

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.
Here's my personal website and my open source projects are available on GitHub; I work on a lot of cool things.

Image

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5172
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: New world weapon API

Post by JeffM » Wed Jun 20, 2018 4:49 am

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.

User avatar
Zehra
Private First Class
Private First Class
Posts: 444
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: New world weapon API

Post by Zehra » Wed Jun 20, 2018 8:35 pm

Thank you JeffM and allejo.

Was able to get custom flags updated. :)

-Zehra
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests