colobot-data/help/programs/E/3_Recharge2.txt

28 lines
1.2 KiB
Plaintext

\b;Programs dispatched by Houston
We have improved the recharge program. When it arrives at the \l;power station\u object\station;, the bot does not wait exactly 5 seconds, but only until the \l;power cell\u object\power; is fully charged. After the bot is back at the initial position, it displays a message on the screen.
\c;
\s;extern void object::Recharge2()
\s;{
\s; \l;point\u cbot\type; start; // variable for initial pos.
\s; \l;object\u cbot\type; item; // info. about power station
\s;
\s; start = position; // store initial position
\s;
\s; item = \l;radar\u cbot\radar;(\l;PowerStation\u cbot\category;); // look for station
\s; \l;goto\u cbot\goto;(item.position); // go to the power station
\s;
\s; \l;while\u cbot\while; ( \l;energyCell.energyLevel\u cbot\object; < 1 )
\s; {
\s; \l;wait\u cbot\wait;(1); // wait until recharged
\s; }
\s;
\s; \l;goto\u cbot\goto;(start); // go back to initial pos.
\s; \l;message\u cbot\message;("Recharge completed");
\s;}
\n;
\b;Archives
Index of the programs dispatched in former missions:
o \c;\l;SwitchCell1\u programs/1_SwitchCell1;\n;
o \c;\l;Recharge1\u programs/2_Recharge1;\n;