From: terencehill Date: Wed, 23 Jan 2019 20:41:00 +0000 (+0100) Subject: Send health / armor values to entcs entities only when the coded values are different... X-Git-Tag: xonotic-v0.8.5~1644 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1e78501bb30bacdf87f8824cd40dc4dfb3e9e4c1;p=xonotic%2Fxonotic-data.pk3dir.git Send health / armor values to entcs entities only when the coded values are different. It save some bandwidth especially when health / armor is rotting / regenerating --- diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 7b4c54f9f..ce5d3174a 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -40,7 +40,9 @@ STATIC_INIT(RegisterEntCSProps_renumber) { FOREACH(EntCSProps, true, it.m_id = i #ifdef SVQC #define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, svsend, clreceive) \ - bool id##_check(entity ent, entity player) { return (GetResourceAmount(ent, checkprop) != GetResourceAmount(player, checkprop)); } \ + bool id##_check(entity ent, entity player) { \ + return (floor(GetResourceAmount(ent, checkprop) / 10) != floor(GetResourceAmount(player, checkprop) / 10)); \ + } \ void id##_set(entity ent, entity player) { SetResourceAmountExplicit(ent, checkprop, GetResourceAmount(player, checkprop)); } \ void id##_send(int chan, entity ent) { LAMBDA(svsend); } \ REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \