2940 end |
2940 end |
2941 end; |
2941 end; |
2942 lc_restorehog := 0; |
2942 lc_restorehog := 0; |
2943 end; |
2943 end; |
2944 |
2944 |
|
2945 function lc_ishoghidden(L: Plua_State): LongInt; Cdecl; |
|
2946 var i, h: LongInt; |
|
2947 uid: LongWord; |
|
2948 gear: PGear; |
|
2949 begin |
|
2950 if CheckLuaParamCount(L, 1, 'IsHogHidden', 'gearUid') then |
|
2951 begin |
|
2952 uid:= LongWord(Trunc(lua_tonumber(L, 1))); |
|
2953 gear:= GearByUID(uid); |
|
2954 if (gear <> nil) and (gear^.hedgehog <> nil) then |
|
2955 begin |
|
2956 lua_pushboolean(L, false); |
|
2957 lc_ishoghidden:= 1; |
|
2958 exit; |
|
2959 end |
|
2960 else |
|
2961 if TeamsCount > 0 then |
|
2962 for i:= 0 to Pred(TeamsCount) do |
|
2963 for h:= 0 to cMaxHHIndex do |
|
2964 if (TeamsArray[i]^.Hedgehogs[h].GearHidden <> nil) and (TeamsArray[i]^.Hedgehogs[h].GearHidden^.uid = uid) then |
|
2965 begin |
|
2966 lua_pushboolean(L, true); |
|
2967 lc_ishoghidden:= 1; |
|
2968 exit; |
|
2969 end |
|
2970 end; |
|
2971 lua_pushnil(L); |
|
2972 lc_ishoghidden:= 1; |
|
2973 end; |
|
2974 |
2945 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
2975 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
2946 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
2976 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
2947 var rtn: Boolean; |
2977 var rtn: Boolean; |
2948 begin |
2978 begin |
2949 if CheckLuaParamCount(L, 5, 'TestRectForObstacle', 'x1, y1, x2, y2, landOnly') then |
2979 if CheckLuaParamCount(L, 5, 'TestRectForObstacle', 'x1, y1, x2, y2, landOnly') then |
3953 ScriptSetInteger('EXPLDoNotTouchAny', EXPLDoNotTouchAny); |
3983 ScriptSetInteger('EXPLDoNotTouchAny', EXPLDoNotTouchAny); |
3954 |
3984 |
3955 // register functions |
3985 // register functions |
3956 lua_register(luaState, _P'HideHog', @lc_hidehog); |
3986 lua_register(luaState, _P'HideHog', @lc_hidehog); |
3957 lua_register(luaState, _P'RestoreHog', @lc_restorehog); |
3987 lua_register(luaState, _P'RestoreHog', @lc_restorehog); |
|
3988 lua_register(luaState, _P'IsHogHidden', @lc_ishoghidden); |
3958 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar); |
3989 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar); |
3959 lua_register(luaState, _P'GetCampaignVar', @lc_getcampaignvar); |
3990 lua_register(luaState, _P'GetCampaignVar', @lc_getcampaignvar); |
3960 lua_register(luaState, _P'band', @lc_band); |
3991 lua_register(luaState, _P'band', @lc_band); |
3961 lua_register(luaState, _P'bor', @lc_bor); |
3992 lua_register(luaState, _P'bor', @lc_bor); |
3962 lua_register(luaState, _P'bnot', @lc_bnot); |
3993 lua_register(luaState, _P'bnot', @lc_bnot); |