/usr/share/games/colobot/ai/shield03.txt is in colobot-common 0.1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | extern void object::FollowPhazer()
{
object item; // info. about phazer
point dest; // position where to go
float dist; // distance to phazer
item = radar(PhazerShooter);
if ( item == null )
{
message("No phazer found");
return; // stop the program
}
shield(1, 25); // activate the shield
while ( true ) // repeat forever
{
item = radar(PhazerShooter);// look for phazer
if ( item == null ) break;
dist = distance(item.position, position);
if ( dist < 5 )
{ // if closer than 5 m:
wait(1); // wait
}
else // otherwise:
{ // Calculate a position 5 m before the phazer
dest.x = (item.position.x-position.x)*((dist-5)/dist)+position.x;
dest.y = (item.position.y-position.y)*((dist-5)/dist)+position.y;
dest.z = (item.position.z-position.z)*((dist-5)/dist)+position.z;
goto(dest, 0, 1, 1); // and go there
}
}
}
|