X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fsteerlib.qc;h=92c918f00ca2281d360282312cfc3b3b9e1fc5df;hb=57f6fd4b4bbd3fbe8180a1cf80c4e81ecaff2e61;hp=0a4dd6095ee915f4c846b4d46162792b49849a19;hpb=76de60deecae125795551ba1a4576a265d7ae7de;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 0a4dd6095..92c918f00 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -29,11 +29,8 @@ vector steerlib_push(entity this, vector point) **/ vector steerlib_arrive(entity this, vector point, float maximal_distance) { - float distance; - vector direction; - - distance = bound(0.001,vlen(this.origin - point),maximal_distance); - direction = normalize(point - this.origin); + float distance = bound(0.001,vlen(this.origin - point),maximal_distance); + vector direction = normalize(point - this.origin); return direction * (distance / maximal_distance); } @@ -42,25 +39,18 @@ vector steerlib_arrive(entity this, vector point, float maximal_distance) **/ vector steerlib_attract(entity this, vector point, float maximal_distance) { - float distance; - vector direction; - - distance = bound(0.001,vlen(this.origin - point),maximal_distance); - direction = normalize(point - this.origin); + float distance = bound(0.001,vlen(this.origin - point),maximal_distance); + vector direction = normalize(point - this.origin); return direction * (1-(distance / maximal_distance)); } vector steerlib_attract2(entity this, vector point, float min_influense,float max_distance,float max_influense) { - float distance; - vector direction; - float influense; - - distance = bound(0.00001,vlen(this.origin - point),max_distance); - direction = normalize(point - this.origin); + float distance = bound(0.00001,vlen(this.origin - point),max_distance); + vector direction = normalize(point - this.origin); - influense = 1 - (distance / max_distance); + float influense = 1 - (distance / max_distance); influense = min_influense + (influense * (max_influense - min_influense)); return direction * influense;