I wonder because create_damageind has normally only 4 parameters...
But I'll try to explain how to send an event only to one team.
In the function "void GAMECONTEXT::create_damageind(vec2 p, float angle, int amount)", file "src/game/server/gamecontext.cpp", line 38, the Damage indicator is really created in line 47:
[...]
NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)events....create(NETEVENTTYPE_DAMAGEIND,
sizeof(NETEVENT_DAMAGEIND));
[...]
events.create has an additional parameter named "mask". It specifies to which players the event should be send.
Here's the modified function "void GAMECONTEXT::create_damageind(vec2 p, float angle, int amount, int team:
void GAMECONTEXT::create_damageind_team(vec2 p, float angle, int amount, int team)
{
float a = 3 * 3.14159f / 2 + angle;
//float a = get_angle(dir);
float s = a-pi/3;
float e = a+pi/3;
int mask = 0;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(players[i] && players[i].team == team)
{
mask = mask | cmask_one(players[i].client_id);
}
}
for(int i = 0; i < amount; i++)
{
float f = mix(s, e, float(i+1)/float(amount+2));
NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)events.create(NETEVENTTYPE_DAMAGEIND, sizeof(NETEVENT_DAMAGEIND), mask);
if(ev)
{
ev->x = (int)p.x;
ev->y = (int)p.y;
ev->angle = (int)(f*256.0f);
}
}
}
Insert this code in "src/game/server/gamecontext.cpp",
and insert this code in declaration of the class "GAMECONTEXT" in "src/game/server/gamecontext.hpp":
void GAMECONTEXT::create_damageind_team(vec2 p, float angle, int amount, int team)
By the way, the function to get a mask for the events.create(..) function from a client id is "cmask_one(int cid)", which is a member function of the GAMECONTEXT class.
It takes a client id as input, and outputs the fitting mask.
If you still have got unanswered questions, just ask.