hedgewars/uScript.pas
changeset 6746 e13058484d72
parent 6743 864bf0f52a8c
child 6752 11d898afe582
equal deleted inserted replaced
6745:9dce541ca16f 6746:e13058484d72
  1779     uAmmos.freeModule;
  1779     uAmmos.freeModule;
  1780     uAmmos.initModule;
  1780     uAmmos.initModule;
  1781     if ScriptExists('onAmmoStoreInit') then
  1781     if ScriptExists('onAmmoStoreInit') then
  1782         begin
  1782         begin
  1783         ScriptCall('onAmmoStoreInit');
  1783         ScriptCall('onAmmoStoreInit');
  1784         ScriptPrepareAmmoStore
  1784         ScriptPrepareAmmoStore;
       
  1785         SetAmmoLoadout(ScriptAmmoLoadout);
       
  1786         SetAmmoProbability(ScriptAmmoProbability);
       
  1787         SetAmmoDelay(ScriptAmmoDelay);
       
  1788         SetAmmoReinforcement(ScriptAmmoReinforcement)
  1785         end;
  1789         end;
  1786     ScriptApplyAmmoStore
  1790     ScriptApplyAmmoStore
  1787     end;
  1791     end;
  1788 
  1792 
  1789 ScriptSetInteger('ClansCount', ClansCount);
  1793 ScriptSetInteger('ClansCount', ClansCount);
  1956 end;
  1960 end;
  1957 
  1961 
  1958 procedure ScriptApplyAmmoStore;
  1962 procedure ScriptApplyAmmoStore;
  1959 var i, j, k : LongInt;
  1963 var i, j, k : LongInt;
  1960 begin
  1964 begin
  1961 SetAmmoLoadout(ScriptAmmoLoadout);
       
  1962 SetAmmoProbability(ScriptAmmoProbability);
       
  1963 SetAmmoDelay(ScriptAmmoDelay);
       
  1964 SetAmmoReinforcement(ScriptAmmoReinforcement);
       
  1965 
       
  1966 if (GameFlags and gfSharedAmmo) <> 0 then
  1965 if (GameFlags and gfSharedAmmo) <> 0 then
  1967     for i:= 0 to Pred(ClansCount) do
  1966     for i:= 0 to Pred(ClansCount) do
  1968         begin
  1967         begin
  1969         if ScriptExists('onNewAmmoStore') then
  1968         if ScriptExists('onNewAmmoStore') then
  1970             begin
  1969             begin
  1971             ScriptPrepareAmmoStore;
  1970             ScriptPrepareAmmoStore;
  1972             ScriptCall('onNewAmmoStore',i,-1)
  1971             ScriptCall('onNewAmmoStore',i,-1);
       
  1972             SetAmmoLoadout(ScriptAmmoLoadout);
       
  1973             SetAmmoProbability(ScriptAmmoProbability);
       
  1974             SetAmmoDelay(ScriptAmmoDelay);
       
  1975             SetAmmoReinforcement(ScriptAmmoReinforcement)
  1973             end;
  1976             end;
  1974         AddAmmoStore;
  1977         AddAmmoStore;
  1975         for j:= 0 to Pred(ClansArray[i]^.TeamsNumber) do
  1978         for j:= 0 to Pred(ClansArray[i]^.TeamsNumber) do
  1976             for k:= 0 to Pred(ClansArray[i]^.Teams[j]^.HedgehogsNumber) do
  1979             for k:= 0 to Pred(ClansArray[i]^.Teams[j]^.HedgehogsNumber) do
  1977                 ClansArray[i]^.Teams[j]^.Hedgehogs[k].AmmoStore:= StoreCnt - 1
  1980                 ClansArray[i]^.Teams[j]^.Hedgehogs[k].AmmoStore:= StoreCnt - 1
  1981         for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do
  1984         for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do
  1982             begin
  1985             begin
  1983             if ScriptExists('onNewAmmoStore') then
  1986             if ScriptExists('onNewAmmoStore') then
  1984                 begin
  1987                 begin
  1985                 ScriptPrepareAmmoStore;
  1988                 ScriptPrepareAmmoStore;
  1986                 ScriptCall('onNewAmmoStore',i,j)
  1989                 ScriptCall('onNewAmmoStore',i,j);
       
  1990                 SetAmmoLoadout(ScriptAmmoLoadout);
       
  1991                 SetAmmoProbability(ScriptAmmoProbability);
       
  1992                 SetAmmoDelay(ScriptAmmoDelay);
       
  1993                 SetAmmoReinforcement(ScriptAmmoReinforcement)
  1987                 end;
  1994                 end;
  1988             AddAmmoStore;
  1995             AddAmmoStore;
  1989             TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1
  1996             TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1
  1990             end
  1997             end
  1991 else 
  1998 else 
  1992     for i:= 0 to Pred(TeamsCount) do
  1999     for i:= 0 to Pred(TeamsCount) do
  1993         begin
  2000         begin
  1994         if ScriptExists('onNewAmmoStore') then
  2001         if ScriptExists('onNewAmmoStore') then
  1995             begin
  2002             begin
  1996             ScriptPrepareAmmoStore;
  2003             ScriptPrepareAmmoStore;
  1997             ScriptCall('onNewAmmoStore',i,-1)
  2004             ScriptCall('onNewAmmoStore',i,-1);
       
  2005             SetAmmoLoadout(ScriptAmmoLoadout);
       
  2006             SetAmmoProbability(ScriptAmmoProbability);
       
  2007             SetAmmoDelay(ScriptAmmoDelay);
       
  2008             SetAmmoReinforcement(ScriptAmmoReinforcement)
  1998             end;
  2009             end;
  1999         AddAmmoStore;
  2010         AddAmmoStore;
  2000         for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do
  2011         for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do
  2001             TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1
  2012             TeamsArray[i]^.Hedgehogs[j].AmmoStore:= StoreCnt - 1
  2002         end
  2013         end