SAIL - Connect (podłączanie zdalnie sterowanych pojazdów)

Wszelkie pytania na temat SAIL'a i modowania OW.
Post Reply
User avatar
Serpent
Soldier level 10
Soldier level 10
Estonia
Posts: 4175
Joined: Tue Jul 07, 2009 9:13 pm
Location: Polska - EuroStan ZSRE
Contact:

SAIL - Connect (podłączanie zdalnie sterowanych pojazdów)

Post by Serpent »

Funkcja podłączająca zadany parametrem zdalnie sterowany pojazd do możliwe jak najlepszego mechanika. Pod uwagę brana jest ilość już podłączonych pojazdów oraz poziom mechanika. Działa zarówno dla statycznych jak i mobilnych wież kontrolnych.

Code: Select all

Export Function Connect(vehicle);
var i, t, mech, tmp, j;
begin
if not vehicle or not GetControl(vehicle) = control_remote then
   exit;

tmp := FilterAllUnits([[f_side, GetSide(vehicle)], [f_or, [f_btype, b_control_tower], [f_weapon, ar_control_tower]]]);

if not tmp then
   exit;

result := [];

for i in tmp do
    begin
    t := UnitsInside(i);

    if t then
       for j in t do
           result := Insert(result, result+1, j);
    end;

if not result then
   exit;

mech := result[1];

if result > 1 then
   for i = 2 to result do
       begin
       t := GetSkill(result[i], 3) - UnitsLinked(result[i]);

       if t >= (GetSkill(mech, 3) - UnitsLinked(mech)) then
          mech := result[i];
       end;

ComLinkTo(vehicle, mech);
End;
Epickie teksty:
Marek1906: jak zrobic aby sail był zielony?
Kvantovy: Wszystko normalne, wszystko w koło było dziwne
Kvantovy:: To jest fajne, że to nie jest takie głupie
Kvantovy:: remove sos from kanapeczka
Kvantovy:: zdarzają się rzezy które sie filozofom nie śniły
Cenwen: problemem jest gejostwo
"Taki z niego fizyk jak ze mnie baletnica" - Profesor Scholtze o Kvantovym.
JAKBYŁ BYM CZECHEM TO BYM ROZŁOŻYŁ NAMIOT ~Kvanciak
Post Reply