X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fonslaught%2Fcl_generator.qc;h=9d12c5548e6d4eafd4abdb336b6aa7208274bda3;hp=a3374bf91e804f4db0ae4993eb107349d3c72411;hb=f8fe0e4aa8dad544f243ae997dfeb9cdccd55ee2;hpb=86c4f57358c37c4165945b1c99840aa447b50000 diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index a3374bf91..9d12c5548 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -48,10 +48,10 @@ void generator_draw(entity this) if(time < this.move_time) return; - if(this.health > 0) + if(GetResourceAmount(this, RESOURCE_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 - GetResourceAmount(this, RESOURCE_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); @@ -195,7 +195,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew) this.origin = ReadVector(); setorigin(this, this.origin); - this.health = ReadByte(); + SetResourceAmountExplicit(this, RESOURCE_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 != GetResourceAmount(this, RESOURCE_HEALTH)) generator_damage(this, _tmp); - this.health = _tmp; + SetResourceAmountExplicit(this, RESOURCE_HEALTH, _tmp); } }