sv_jumpstep 1 // step up stairs while jumping, makes it easier to reach ledges
set ekg 0 "Throw huge amounts of gibs"
-seta sv_shownames 1 "enable sending name tag information to clients (WARNING: possible bandwidth hog until we have CSQC players)"
seta sv_shownames_cull_distance 2500 "distance after which to not send origin/health/armor of another player"
-seta sv_shownames_delay 0.2 "delay between shownames updates"
cl_movement 1
cl_movement_track_canjump 0
seta hud_shownames_maxdistance 2500 "alpha/size is 0 at this distance"
seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"
seta hud_shownames_antioverlap_distance 125 "2d distance to other tag after which to fade out"
+seta hud_shownames_offset 48 "offset (along z-axis) tag from player origin by this many units"
// scoreboard
seta scoreboard_columns default
// entity init, TODO can this be done only once somehow?
self.the_entnum = ReadByte(); // TODO: fixme to only send once somehow
self.draw2d = Draw_ShowNames;
- InterpolateOrigin_Undo();
//self.movetype = MOVETYPE_FLY; // movetype needed so we can traceline?
- self.mins = '-20 -20 -24';
- self.maxs = '20 20 45';
+ //self.mins = '-20 -20 -24';
+ //self.maxs = '20 20 45';
self.classname = "shownames_tag";
sf = ReadByte();
if(sf & 1)
- {
- self.origin_x = ReadShort();
- self.origin_y = ReadShort();
- self.origin_z = ReadShort();
- }
- if(sf & 2)
{
self.healthvalue = ReadByte();
}
- if(sf & 4)
+ if(sf & 2)
{
self.armorvalue = ReadByte();
}
self.sameteam = TRUE;
else
self.sameteam = FALSE;
- InterpolateOrigin_Note();
}
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
float autocvar_hud_shownames_maxdistance;
float autocvar_hud_shownames_antioverlap;
float autocvar_hud_shownames_antioverlap_distance;
+float autocvar_hud_shownames_offset;
string autocvar_hud_skin;
float autocvar_loddebug;
float autocvar_menu_mouse_speed;
if(self.sameteam || (!self.sameteam && autocvar_hud_shownames_enemies))
{
- InterpolateOrigin_Do();
+ string temporigin;
+ temporigin = getplayerkey(self.the_entnum-1, "TEMPHACK_origin");
+ if(temporigin == "")
+ return;
+ self.origin = stov(temporigin);
+ self.origin_z += autocvar_hud_shownames_offset;
if(!self.sameteam)
{
- traceline(self.origin, view_origin, 1, self);
-
/* WIP, why does trace_ent != self not work as intended here?
if(autocvar_hud_shownames_enemies != 2) // player has to point at enemy if so
{
if(trace_ent != self)
return;
}*/
+
+ traceline(self.origin, view_origin, 1, self);
}
vector o, eo;
float autocvar_welcome_message_time;
float autocvar_sv_gameplayfix_gravityunaffectedbyticrate;
float autocvar_g_trueaim_minrange;
-float autocvar_sv_shownames;
float autocvar_sv_shownames_cull_distance;
-float autocvar_sv_shownames_delay;
PlayerStats_AddPlayer(self);
- if(autocvar_sv_shownames)
- {
- self.shownames = spawn();
- self.shownames.owner = self;
- self.shownames.think = shownames_think;
- self.shownames.nextthink = time;
- self.shownames.customizeentityforclient = shownames_customize;
- Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
- }
+ self.shownames = spawn();
+ self.shownames.owner = self;
+ self.shownames.think = shownames_think;
+ self.shownames.nextthink = time;
+ self.shownames.customizeentityforclient = shownames_customize;
+ Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
}
/*
}
}
-// sendflags use: 1 = origin, 2 = health (0 or 1 for dead/alive on enemies), 4 = armor, 0x80 = same team (includes health)
+// sendflags use: 1 = health (value is 0 or 1 for dead/alive on enemies), 2 = armor, 0x80 = same team (includes health)
float SendEntity_ShowNames(entity to, float sendflags)
{
float the_health;
WriteByte(MSG_ENTITY, sendflags);
if(sendflags & 1)
- {
- WriteShort(MSG_ENTITY, rint(self.origin_x));
- WriteShort(MSG_ENTITY, rint(self.origin_y));
- WriteShort(MSG_ENTITY, rint(self.origin_z));
- }
- if(sendflags & 2)
{
WriteByte(MSG_ENTITY, the_health);
}
- if(sendflags & 4)
+ if(sendflags & 2)
{
WriteByte(MSG_ENTITY, self.armorvalue);
}
return TRUE;
}
-const vector SHOWNAMES_ORIGIN_OFFSET = '0 0 48';
void shownames_think()
{
- if(self.origin - SHOWNAMES_ORIGIN_OFFSET != self.owner.origin)
- {
- setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET);
- self.SendFlags |= 1;
- }
+ self.origin = self.owner.origin + '0 0 1' * 48;
if(self.health != max(0, floor(self.owner.health)) || self.armorvalue != max(0, floor(self.owner.armorvalue)))
{
self.health = max(0, floor(self.owner.health));
self.armorvalue = max(0, floor(self.owner.armorvalue));
- self.SendFlags |= 2;
+ self.SendFlags |= 1;
}
if(self.armorvalue != max(0, floor(self.owner.armorvalue)))
{
self.armorvalue = max(0, floor(self.owner.armorvalue));
- self.SendFlags |= 4;
+ self.SendFlags |= 2;
}
- self.nextthink = time + autocvar_sv_shownames_delay;
+ self.nextthink = time;
}
float shownames_customize()
{
if(self.owner.classname == "player") // only send players, no spectators!
- if(self.owner != other) // no need to spam own coordinates
+ if(self.owner != other) // no need to spam own info
if(vlen(other.origin - self.origin) < autocvar_sv_shownames_cull_distance) // distance cull
- if(self.owner.team == other.team || (self.owner.team != other.team && checkpvs(self.origin, other)))
+ if((teams_matter && self.owner.team == other.team) || checkpvs(self.origin, other))
return TRUE;
return FALSE;