equal
deleted
inserted
replaced
54 uTypes, |
54 uTypes, |
55 uVariables, |
55 uVariables, |
56 uCommands, |
56 uCommands, |
57 uUtils, |
57 uUtils, |
58 uIO, |
58 uIO, |
|
59 uKeys, |
59 uCaptions; |
60 uCaptions; |
60 |
61 |
61 var luaState : Plua_State; |
62 var luaState : Plua_State; |
62 ScriptAmmoLoadout : shortstring; |
63 ScriptAmmoLoadout : shortstring; |
63 ScriptAmmoProbability : shortstring; |
64 ScriptAmmoProbability : shortstring; |
821 LuaError('Lua: Tried to pass 0 to GetRandom!'); |
822 LuaError('Lua: Tried to pass 0 to GetRandom!'); |
822 lua_pushnil(L); |
823 lua_pushnil(L); |
823 end |
824 end |
824 end; |
825 end; |
825 lc_getrandom:= 1 |
826 lc_getrandom:= 1 |
|
827 end; |
|
828 |
|
829 function lc_setwind(L : Plua_State) : LongInt; Cdecl; |
|
830 begin |
|
831 if lua_gettop(L) <> 1 then |
|
832 LuaError('Lua: Wrong number of parameters passed to SetWind!') |
|
833 else |
|
834 begin |
|
835 cWindSpeed:= int2hwfloat(lua_tointeger(L, 1)) / 100 * cMaxWindSpeed; |
|
836 cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue; |
|
837 if cWindSpeed.isNegative then |
|
838 CWindSpeedf := -cWindSpeedf; |
|
839 AddGear(0, 0, gtATSmoothWindCh, 0, _0, _0, 1)^.Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed); |
|
840 end; |
|
841 lc_setwind:= 0 |
826 end; |
842 end; |
827 /////////////////// |
843 /////////////////// |
828 |
844 |
829 procedure ScriptPrintStack; |
845 procedure ScriptPrintStack; |
830 var n, i : LongInt; |
846 var n, i : LongInt; |
1212 lua_register(luaState, 'CampaignLock', @lc_campaignlock); |
1228 lua_register(luaState, 'CampaignLock', @lc_campaignlock); |
1213 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); |
1229 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); |
1214 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage); |
1230 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage); |
1215 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage); |
1231 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage); |
1216 lua_register(luaState, 'GetRandom', @lc_getrandom); |
1232 lua_register(luaState, 'GetRandom', @lc_getrandom); |
|
1233 lua_register(luaState, 'SetWind', @lc_setwind); |
1217 |
1234 |
1218 |
1235 |
1219 ScriptClearStack; // just to be sure stack is empty |
1236 ScriptClearStack; // just to be sure stack is empty |
1220 ScriptLoaded:= false; |
1237 ScriptLoaded:= false; |
1221 end; |
1238 end; |