equal
deleted
inserted
replaced
41 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
41 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
42 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt; |
42 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt; |
43 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; |
43 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; |
44 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; |
44 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; |
45 function ScriptExists(fname : shortstring) : boolean; |
45 function ScriptExists(fname : shortstring) : boolean; |
|
46 function ParseCommandOverride(key, value : shortstring) : shortstring; |
46 |
47 |
47 procedure initModule; |
48 procedure initModule; |
48 procedure freeModule; |
49 procedure freeModule; |
49 |
50 |
50 implementation |
51 implementation |
1586 lua_pop(luaState, 1) |
1587 lua_pop(luaState, 1) |
1587 end; |
1588 end; |
1588 GetGlobals; |
1589 GetGlobals; |
1589 end; |
1590 end; |
1590 |
1591 |
|
1592 function ParseCommandOverride(key, value : shortstring) : shortstring; |
|
1593 begin |
|
1594 ParseCommandOverride:= value; |
|
1595 if not ScriptExists('ParseCommandOverride') then exit; |
|
1596 lua_getglobal(luaState, Str2PChar('ParseCommandOverride')); |
|
1597 lua_pushstring(luaState, Str2PChar(key)); |
|
1598 lua_pushstring(luaState, Str2PChar(value)); |
|
1599 if lua_pcall(luaState, 2, 1, 0) <> 0 then |
|
1600 begin |
|
1601 LuaError('Lua: Error while calling ParseCommandOverride: ' + lua_tostring(luaState, -1)); |
|
1602 lua_pop(luaState, 1) |
|
1603 end |
|
1604 else |
|
1605 begin |
|
1606 ParseCommandOverride:= lua_tostring(luaState, -1); |
|
1607 lua_pop(luaState, 1) |
|
1608 end; |
|
1609 end; |
|
1610 |
1591 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
1611 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
1592 begin |
1612 begin |
1593 ScriptCall:= ScriptCall(fname, par1, 0, 0, 0) |
1613 ScriptCall:= ScriptCall(fname, par1, 0, 0, 0) |
1594 end; |
1614 end; |
1595 |
1615 |
1667 ScriptAmmoDelay[ord(ammo)]:= inttostr(delay)[1]; |
1687 ScriptAmmoDelay[ord(ammo)]:= inttostr(delay)[1]; |
1668 ScriptAmmoReinforcement[ord(ammo)]:= inttostr(reinforcement)[1]; |
1688 ScriptAmmoReinforcement[ord(ammo)]:= inttostr(reinforcement)[1]; |
1669 end; |
1689 end; |
1670 |
1690 |
1671 procedure ScriptApplyAmmoStore; |
1691 procedure ScriptApplyAmmoStore; |
1672 var i : LongInt; |
1692 var i, j : LongInt; |
1673 begin |
1693 begin |
1674 SetAmmoLoadout(ScriptAmmoLoadout); |
1694 SetAmmoLoadout(ScriptAmmoLoadout); |
1675 SetAmmoProbability(ScriptAmmoProbability); |
1695 SetAmmoProbability(ScriptAmmoProbability); |
1676 SetAmmoDelay(ScriptAmmoDelay); |
1696 SetAmmoDelay(ScriptAmmoDelay); |
1677 SetAmmoReinforcement(ScriptAmmoReinforcement); |
1697 SetAmmoReinforcement(ScriptAmmoReinforcement); |
1678 for i:= 0 to Pred(TeamsCount) do |
1698 |
1679 AddAmmoStore; |
1699 if (GameFlags and gfSharedAmmo) <> 0 then |
|
1700 for i:= 0 to Pred(ClansCount) do |
|
1701 AddAmmoStore |
|
1702 else if (GameFlags and gfPerHogAmmo) <> 0 then |
|
1703 for i:= 0 to Pred(TeamsCount) do |
|
1704 for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do |
|
1705 AddAmmoStore |
|
1706 else |
|
1707 for i:= 0 to Pred(TeamsCount) do |
|
1708 AddAmmoStore |
1680 end; |
1709 end; |
1681 |
1710 |
1682 procedure initModule; |
1711 procedure initModule; |
1683 var at : TGearType; |
1712 var at : TGearType; |
1684 vgt: TVisualGearType; |
1713 vgt: TVisualGearType; |