}
.float waypointsprite_pingtime;
+.float waypointsprite_helpmetime;
void WaypointSprite_Ping(entity e)
{
// anti spam
e.SendFlags |= 32;
}
+float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime;
+
+void WaypointSprite_HelpMePing(entity e)
+{
+ WaypointSprite_Ping(e);
+ e.waypointsprite_helpmetime = time + waypointsprite_deployed_lifetime;
+ e.SendFlags |= 32;
+}
+
void WaypointSprite_FadeOutIn(entity e, float t)
{
if(!e.fade_time)
e.SendFlags |= 16;
}
-float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime;
void WaypointSprite_Init()
{
- waypointsprite_limitedrange = autocvar_g_waypointsprite_limitedrange;
- waypointsprite_deployed_lifetime = autocvar_g_waypointsprite_deployed_lifetime;
- waypointsprite_deadlifetime = autocvar_g_waypointsprite_deadlifetime;
+ waypointsprite_limitedrange = autocvar_sv_waypointsprite_limitedrange;
+ waypointsprite_deployed_lifetime = autocvar_sv_waypointsprite_deployed_lifetime;
+ waypointsprite_deadlifetime = autocvar_sv_waypointsprite_deadlifetime;
}
void WaypointSprite_InitClient(entity e)
{
{
// personal waypoints
if(self.enemy)
- if(self.enemy != other)
+ if(self.enemy != e)
return FALSE;
// team waypoints
if(self.team && self.rule == SPRITERULE_DEFAULT)
{
- if(self.team != other.team)
+ if(self.team != e.team)
return FALSE;
- if(other.classname != "player")
+ if(e.classname != "player")
return FALSE;
}
return TRUE;
}
+entity WaypointSprite_getviewentity(entity e)
+{
+ if(e.classname == "spectator")
+ e = e.enemy;
+ /* TODO idea (check this breaks nothing)
+ else if(e.classname == "observer")
+ e = world;
+ */
+ return e;
+}
+
+float WaypointSprite_isteammate(entity e, entity e2)
+{
+ if(teamplay)
+ {
+ if(e2.team != e.team)
+ return FALSE;
+ }
+ else
+ {
+ if(e2 != e)
+ return FALSE;
+ }
+ return TRUE;
+}
+
float WaypointSprite_Customize()
{
// this is not in SendEntity because it shall run every frame, not just every update
// make spectators see what the player would see
entity e;
- e = other;
- if(e.classname == "spectator")
- e = e.enemy;
+ e = WaypointSprite_getviewentity(other);
+
+ // as a GENERAL rule:
+ // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
+ // but only apply this to real players, not to spectators
+ if(g_minstagib && (self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+ {
+ if(!WaypointSprite_isteammate(self.owner, e))
+ return FALSE;
+ }
return self.waypointsprite_visible_for_player(e);
}
WriteByte(MSG_ENTITY, self.colormod_x * 255.0);
WriteByte(MSG_ENTITY, self.colormod_y * 255.0);
WriteByte(MSG_ENTITY, self.colormod_z * 255.0);
+
+ if(WaypointSprite_isteammate(self.owner, WaypointSprite_getviewentity(to)))
+ {
+ dt = (self.waypointsprite_helpmetime - time) / 0.1;
+ if(dt < 0)
+ dt = 0;
+ if(dt > 255)
+ dt = 255;
+ WriteByte(MSG_ENTITY, dt);
+ }
+ else
+ WriteByte(MSG_ENTITY, 0);
}
return TRUE;