]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc
Survival: refactor survival status networking to avoid sending hunter statuses to...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / onslaught / cl_generator.qc
index a3374bf91e804f4db0ae4993eb107349d3c72411..d8d28488abff4064c58969bc126b4b6f01d107b9 100644 (file)
@@ -48,10 +48,10 @@ void generator_draw(entity this)
        if(time < this.move_time)
                return;
 
-       if(this.health > 0)
+       if(GetResource(this, RES_HEALTH) > 0)
        {
                // damaged fx (less probable the more damaged is the generator)
-               if(random() < 0.9 - this.health / this.max_health)
+               if(random() < 0.9 - GetResource(this, RES_HEALTH) / this.max_health)
                if(random() < 0.01)
                {
                        pointparticles(EFFECT_ELECTRO_BALLEXPLODE, this.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
@@ -157,10 +157,10 @@ void generator_construct(entity this, bool isnew)
 
        setorigin(this, this.origin);
        setmodel(this, MDL_ONS_GEN);
+       this.solid                      = SOLID_BBOX; // before setsize to ensure area grid linking
        setsize(this, GENERATOR_MIN, GENERATOR_MAX);
 
        set_movetype(this, MOVETYPE_NOCLIP);
-       this.solid                      = SOLID_BBOX;
        set_movetype(this, MOVETYPE_NOCLIP);
        this.move_time          = time;
        this.drawmask           = MASK_NORMAL;
@@ -195,7 +195,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
                this.origin = ReadVector();
                setorigin(this, this.origin);
 
-               this.health = ReadByte();
+               SetResourceExplicit(this, RES_HEALTH, ReadByte());
                this.max_health = ReadByte();
                this.count = ReadByte();
                this.team = ReadByte();
@@ -219,9 +219,9 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
 
                _tmp = ReadByte();
 
-               if(_tmp != this.health)
+               if(_tmp != GetResource(this, RES_HEALTH))
                        generator_damage(this, _tmp);
 
-               this.health = _tmp;
+               SetResourceExplicit(this, RES_HEALTH, _tmp);
        }
 }