X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fent_cs.qc;h=52b15b0953fabc047fcefb668db5c6143bb6221f;hb=978c038caba30540d7fc6e540c051801ad55ce77;hp=e1b0efb67324212eeac280f5795731d1ab2202a5;hpb=8dd1357708438bd75c9d13d59e1fa6242d3dbd56;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/ent_cs.qc b/qcsrc/server/ent_cs.qc index e1b0efb67..52b15b095 100644 --- a/qcsrc/server/ent_cs.qc +++ b/qcsrc/server/ent_cs.qc @@ -1,3 +1,8 @@ +#include "_all.qh" + +#include "defs.qh" +#include "mutators/mutators_include.qh" + /** * The point of these entities is to avoid the problems * with clientprediction. @@ -18,27 +23,26 @@ void entcs_init() { print("Initializing ClientSide information entities\n"); -}; +} float entcs_customize() { entity o; o = self.owner; - //if(o.deadflag != DEAD_NO) // allow sending entcs for dead players, for damage effects to work. To be decided! - // return FALSE; - if(o.classname != "player") - return FALSE; - //if(other == o) // allow sending entcs for self, for damage effects to work. To be decided! - // return FALSE; - if(other.classname == "player") + if(o.deadflag != DEAD_NO) + return false; + if (!IS_PLAYER(o)) + return false; + if(other == o) + return false; + if((IS_PLAYER(other)) || other.caplayer) if(!teamplay || o.team != other.team) - //if not (radar_showennemies) - if not (checkpvs(other.origin + other.view_ofs, o)) // allow sending entcs for enemies in view, for damage effects to work. To be decided! - return FALSE; - return TRUE; + if (!radar_showennemies) + return false; + return true; } -float entcs_send(entity to, float sf) +float entcs_send(entity to, int sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS); WriteByte(MSG_ENTITY, sf); @@ -46,18 +50,18 @@ float entcs_send(entity to, float sf) WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1); if(sf & 2) { - WriteShort(MSG_ENTITY, self.origin_x); - WriteShort(MSG_ENTITY, self.origin_y); - WriteShort(MSG_ENTITY, self.origin_z); + WriteShort(MSG_ENTITY, self.origin.x); + WriteShort(MSG_ENTITY, self.origin.y); + WriteShort(MSG_ENTITY, self.origin.z); } if(sf & 4) - WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360); + WriteByte(MSG_ENTITY, self.angles.y * 256.0 / 360); if(sf & 8) WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale? if(sf & 16) WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale? - return TRUE; -}; + return true; +} void entcs_think() { @@ -71,7 +75,7 @@ void entcs_think() setorigin(self, o.origin); self.SendFlags |= 2; } - if(o.angles_y != self.angles_y) + if(o.angles.y != self.angles.y) { self.angles = o.angles; self.SendFlags |= 4; @@ -86,11 +90,11 @@ void entcs_think() self.armorvalue = o.armorvalue; self.SendFlags |= 16; } -}; +} entity attach_entcs() { - local entity ent; + entity ent; ent = spawn(); ent.classname = "entcs_sender_v2"; @@ -98,16 +102,16 @@ entity attach_entcs() ent.think = entcs_think; ent.nextthink = time; - Net_LinkEntity(ent, FALSE, 0, entcs_send); + Net_LinkEntity(ent, false, 0, entcs_send); ent.customizeentityforclient = entcs_customize; self.entcs = ent; return ent; -}; +} void detach_entcs() { remove(self.entcs); self.entcs = world; -}; +}