self.anim_forwardleft = '20 1 1';
self.anim_backright = '21 1 1';
self.anim_backleft = '22 1 1';
+ self.anim_melee = '23 1 1';
animparseerror = FALSE;
animfilename = strcat(self.model, ".animinfo");
animfile = fopen(animfilename, FILE_READ);
self.anim_forwardleft = animparseline(animfile);
self.anim_backright = animparseline(animfile);
self.anim_backleft = animparseline(animfile);
+ self.anim_melee = animparseline(animfile);
fclose(animfile);
// derived anims
frag_inflictor = inflictor;
frag_target = self;
MUTATOR_CALLHOOK(PlayerDies);
+ weapon_action(self.weapon, WR_PLAYERDEATH);
if(self.flagcarried)
{
if(sv_gentle > 0 || autocvar_ekg) {
// remove corpse
- PlayerCorpseDamage (inflictor, attacker, 100.0, deathtype, hitloc, force);
+ PlayerCorpseDamage (inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
}
// reset fields the weapons may use just in case
}
}
-void net_shownames(entity selected, float teammate)
+// 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 teammate_health, teammate_armor;
- if(teammate)
+ float the_health;
+ the_health = self.health;
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_SHOWNAMES);
+ WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+
+ sendflags = sendflags & 127;
+ if(teams_matter && self.owner.team == to.team)
+ sendflags |= 128;
+ else if(self.owner.health >= 1)
+ the_health = 1;
+
+ WriteByte(MSG_ENTITY, sendflags);
+ if(sendflags & 1)
{
- teammate_health = selected.health;
- teammate_armor = selected.armorvalue;
+ WriteByte(MSG_ENTITY, the_health);
}
-
- WRITESPECTATABLE_MSG_ONE({
- WriteByte(MSG_ONE, SVC_TEMPENTITY);
- WriteByte(MSG_ONE, TE_CSQC_SHOWNAMES);
- WriteString(MSG_ONE, playername(selected));
- WriteByte(MSG_ONE, teammate_health);
- WriteByte(MSG_ONE, teammate_armor);
- });
+ if(sendflags & 2)
+ {
+ WriteByte(MSG_ENTITY, self.armorvalue);
+ }
+ return TRUE;
}
-void UpdateSelectedPlayer()
+void shownames_think()
{
- entity selected;
- selected = world;
-
- if(!autocvar_sv_allow_shownames)
- return;
-
- if(clienttype(self) != CLIENTTYPE_REAL)
- return;
-
- if(self.cvar_cl_shownames == 0)
- return;
-
- makevectors(self.v_angle); // sets v_forward
-
- // cursor trace
- if(self.selected_player_display_timeout < time)
+ self.origin = self.owner.origin + '0 0 1' * 48;
+ if(self.health != max(0, ceil(self.owner.health/10)))
{
- WarpZone_crosshair_trace(self);
- if(trace_ent && trace_ent.classname == "player" && !trace_ent.deadflag)
- {
- selected = trace_ent;
- self.last_selected_player = selected;
- self.selected_player_display_timeout = time + 0.1; // update at 0.1s intervals
- }
+ self.health = max(0, ceil(self.owner.health/10));
+ self.SendFlags |= 1;
}
-
- if(selected)
- {
- msg_entity = self;
- if(teams_matter)
- if(self.team == selected.team)
- net_shownames(selected, 1);
- else
- net_shownames(selected, 0);
+ if(self.armorvalue != max(0, ceil(self.owner.armorvalue/10)))
+ {
+ self.armorvalue = max(0, ceil(self.owner.armorvalue/10));
+ self.SendFlags |= 2;
}
+ self.nextthink = time;
}
.float muted; // to be used by prvm_edictset server playernumber muted 1