X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fwaypointsprites.qc;h=d58985312200f4754fefc2bf0d984cea063ed8dc;hb=55c5e5f476604b1e99df20f8974d561f99d0f405;hp=836a853570bef941b74612a13d03d84e2d774cfc;hpb=8b3142364603ea77d9514d20be020370102da9fc;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index 836a85357..d58985312 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -127,9 +127,9 @@ void WaypointSprite_FadeOutIn(entity e, float t) 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) { @@ -189,30 +189,57 @@ float WaypointSprite_visible_for_player(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 not(IS_PLAYER(e)) return FALSE; } return TRUE; } +entity WaypointSprite_getviewentity(entity e) +{ + if(IS_SPEC(e)) + 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); + + if(MUTATOR_CALLHOOK(CustomizeWaypoint)) + return FALSE; return self.waypointsprite_visible_for_player(e); } @@ -290,12 +317,17 @@ float WaypointSprite_SendEntity(entity to, float sendflags) WriteByte(MSG_ENTITY, self.colormod_y * 255.0); WriteByte(MSG_ENTITY, self.colormod_z * 255.0); - dt = (self.waypointsprite_helpmetime - time) / 0.1; - if(dt < 0) - dt = 0; - if(dt > 255) - dt = 255; - WriteByte(MSG_ENTITY, dt); + 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;