hedgewars/uScript.pas
changeset 13270 969aacfa229c
parent 13216 95311e220eb6
child 13272 5984e8c6cbeb
equal deleted inserted replaced
13269:a772b6c9387f 13270:969aacfa229c
  2951     if CheckLuaParamCount(L, 1, 'SetLaserSight', 'bool') then
  2951     if CheckLuaParamCount(L, 1, 'SetLaserSight', 'bool') then
  2952         cLaserSighting:= lua_toboolean(L, 1);
  2952         cLaserSighting:= lua_toboolean(L, 1);
  2953     lc_setlasersight:= 0;
  2953     lc_setlasersight:= 0;
  2954 end;
  2954 end;
  2955 
  2955 
       
  2956 function lc_explode(L : Plua_state) : LongInt; Cdecl;
       
  2957 var mask: LongWord;
       
  2958     n: LongInt;
       
  2959 begin
       
  2960     if CheckAndFetchParamCount(L, 3, 4, 'Explode', 'x, y, radius[, options]', n) then
       
  2961         if CurrentHedgehog <> nil then
       
  2962             begin
       
  2963             mask:= EXPLAutoSound;
       
  2964             if (n = 4) then
       
  2965                 mask:= Trunc(lua_tonumber(L, 4));
       
  2966             doMakeExplosion(Trunc(lua_tonumber(L, 1)), Trunc(lua_tonumber(L, 2)), Trunc(lua_tonumber(L, 3)), CurrentHedgehog, mask);
       
  2967             lua_pushboolean(L, true);
       
  2968             end
       
  2969         else
       
  2970             lua_pushboolean(L, false)
       
  2971     else
       
  2972         lua_pushboolean(L, false);
       
  2973     lc_explode:= 1;
       
  2974 end;
       
  2975 
  2956 function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl;
  2976 function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl;
  2957 begin
  2977 begin
  2958     if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then
  2978     if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then
  2959         startGhostPoints(Trunc(lua_tonumber(L, 1)));
  2979         startGhostPoints(Trunc(lua_tonumber(L, 1)));
  2960     lc_startghostpoints:= 0
  2980     lc_startghostpoints:= 0
  3761 ScriptSetInteger('lfLandMask'      , lfLandMask);
  3781 ScriptSetInteger('lfLandMask'      , lfLandMask);
  3762 ScriptSetInteger('lfCurrentHog'    , lfCurrentHog);
  3782 ScriptSetInteger('lfCurrentHog'    , lfCurrentHog);
  3763 ScriptSetInteger('lfHHMask'        , lfHHMask);
  3783 ScriptSetInteger('lfHHMask'        , lfHHMask);
  3764 ScriptSetInteger('lfNotHHObjMask'  , lfNotHHObjMask);
  3784 ScriptSetInteger('lfNotHHObjMask'  , lfNotHHObjMask);
  3765 ScriptSetInteger('lfAllObjMask'    , lfAllObjMask);
  3785 ScriptSetInteger('lfAllObjMask'    , lfAllObjMask);
       
  3786 
       
  3787 // explosion constants
       
  3788 ScriptSetInteger('EXPLAutoSound'    , EXPLAutoSound);
       
  3789 ScriptSetInteger('EXPLNoDamage'     , EXPLNoDamage);
       
  3790 ScriptSetInteger('EXPLDoNotTouchHH' , EXPLDoNotTouchHH);
       
  3791 ScriptSetInteger('EXPLDontDraw'     , EXPLDontDraw);
       
  3792 ScriptSetInteger('EXPLNoGfx'        , EXPLNoGfx);
       
  3793 ScriptSetInteger('EXPLPoisoned'     , EXPLPoisoned);
       
  3794 ScriptSetInteger('EXPLDoNotTouchAny', EXPLDoNotTouchAny);
  3766 
  3795 
  3767 // register functions
  3796 // register functions
  3768 lua_register(luaState, _P'HideHog', @lc_hidehog);
  3797 lua_register(luaState, _P'HideHog', @lc_hidehog);
  3769 lua_register(luaState, _P'RestoreHog', @lc_restorehog);
  3798 lua_register(luaState, _P'RestoreHog', @lc_restorehog);
  3770 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar);
  3799 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar);
  3901 lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode);
  3930 lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode);
  3902 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
  3931 lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance);
  3903 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
  3932 lua_register(luaState, _P'GetAmmoName', @lc_getammoname);
  3904 lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
  3933 lua_register(luaState, _P'SetVampiric', @lc_setvampiric);
  3905 lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
  3934 lua_register(luaState, _P'SetLaserSight', @lc_setlasersight);
       
  3935 lua_register(luaState, _P'Explode', @lc_explode);
  3906 // drawn map functions
  3936 // drawn map functions
  3907 lua_register(luaState, _P'AddPoint', @lc_addPoint);
  3937 lua_register(luaState, _P'AddPoint', @lc_addPoint);
  3908 lua_register(luaState, _P'FlushPoints', @lc_flushPoints);
  3938 lua_register(luaState, _P'FlushPoints', @lc_flushPoints);
  3909 
  3939 
  3910 lua_register(luaState, _P'SetGearAIHints', @lc_setgearaihints);
  3940 lua_register(luaState, _P'SetGearAIHints', @lc_setgearaihints);