Posted by salimiles
As of SVN 3782:
Picking a target:
According to map/freedroid.droid_archtypes, the 139 has an attack range of 10 (squares), and uses the "Droid 139 Plasma Trash Vaporiser" (UK spelling?).
According to enemy.c aggression distance (a) is compared to as follows:
a\u00b2 = x\u00b2 + y\u00b2
So basically the droid will ignore everything outside of a circle >10 squares from it.
Weapon Firing:
According to map/freedroid.item_archtypes, the "Droid 139 Plasma Trash Vaporiser" fires bullets that last for 2.0, and travel at a speed (s) of 12.
The file enemy.c describes the shot firing. Line 1656 says the range is the time*speed (so 24). And line 1658 checks to make certain the Tux is within range before firing.
In bullet.c, lines 69 & 70 seem to divide this distance in half. Still this means a range of 12 , which means that the above (enemy.c, 1656) has a problem. So reopening.
Additionally, the function set_bullet_speed_to_target_direction() (line 2044) sets a speed of s in one direction, and up to s in the other direction. This means at certain angles the speed is \u221a(s*s + s*s) or s\u221a(2) rather than s. Since this is larger, this isn't a problem for us here.
So the range for the weapon actually is:
12-12\u221a(2)
all of which is >10.
So this shouldn't be a problem for the 139, however there is a bug in line 1656 of enemy.c .
|