hedgewars/uScript.pas
changeset 10289 c3a77ff02a23
parent 10288 7bf02127262c
child 10290 42efccba0711
equal deleted inserted replaced
10288:7bf02127262c 10289:c3a77ff02a23
   352 
   352 
   353         end;
   353         end;
   354     lc_parsecommand:= 0;
   354     lc_parsecommand:= 0;
   355 end;
   355 end;
   356 
   356 
       
   357 function lc_setweapon(L : Plua_State) : LongInt; Cdecl;
       
   358 var at: LongInt;
       
   359 const
       
   360     call = 'SetWeapon';
       
   361     params = 'ammoType';
       
   362 begin
       
   363     if CheckLuaParameterCount(L, 1, call, params) then
       
   364         begin
       
   365         at:= LuaToAmmoTypeOrd(L, 1, call, params);
       
   366         if at >= 0 then
       
   367             ParseCommand('setweap ' + char(at), true, true);
       
   368         end;
       
   369     lc_setweapon:= 0;
       
   370 end;
       
   371 
   357 function lc_showmission(L : Plua_State) : LongInt; Cdecl;
   372 function lc_showmission(L : Plua_State) : LongInt; Cdecl;
   358 begin
   373 begin
   359     if CheckLuaParameterCount(L, 5, 'ShowMission', 'caption, subcaption, text, icon, time') then
   374     if CheckLuaParameterCount(L, 5, 'ShowMission', 'caption, subcaption, text, icon, time') then
   360         ShowMission(lua_tostringA(L, 1), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tointeger(L, 4), lua_tointeger(L, 5));
   375         ShowMission(lua_tostringA(L, 1), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tointeger(L, 4), lua_tointeger(L, 5));
   361     lc_showmission:= 0;
   376     lc_showmission:= 0;
  1124                if (vgear^.FrameTicks < 1) or (vgear^.FrameTicks > 3) then
  1139                if (vgear^.FrameTicks < 1) or (vgear^.FrameTicks > 3) then
  1125                    vgear^.FrameTicks:= 1;
  1140                    vgear^.FrameTicks:= 1;
  1126                lua_pushinteger(L, vgear^.Uid);
  1141                lua_pushinteger(L, vgear^.Uid);
  1127                end
  1142                end
  1128             end
  1143             end
  1129             else
  1144         else
  1130                 lua_pushnil(L)
  1145             lua_pushnil(L)
  1131         end
  1146         end
  1132     else
  1147     else
  1133         lua_pushnil(L);
  1148         lua_pushnil(L);
  1134     lc_hogsay:= 1
  1149     lc_hogsay:= 1
  1135 end;
  1150 end;
  2588 
  2603 
  2589 for spr:= Low(TSprite) to High(TSprite) do
  2604 for spr:= Low(TSprite) to High(TSprite) do
  2590     ScriptSetInteger(EnumToStr(spr), ord(spr));
  2605     ScriptSetInteger(EnumToStr(spr), ord(spr));
  2591 
  2606 
  2592 
  2607 
  2593 ScriptSetInteger('gstDrowning'       ,$00000001);
  2608 ScriptSetInteger('gstDrowning'      , gstDrowning);
  2594 ScriptSetInteger('gstHHDriven'       ,$00000002);
  2609 ScriptSetInteger('gstHHDriven'      , gstHHDriven);
  2595 ScriptSetInteger('gstMoving'         ,$00000004);
  2610 ScriptSetInteger('gstMoving'        , gstMoving);
  2596 ScriptSetInteger('gstAttacked'       ,$00000008);
  2611 ScriptSetInteger('gstAttacked'      , gstAttacked);
  2597 ScriptSetInteger('gstAttacking'      ,$00000010);
  2612 ScriptSetInteger('gstAttacking'     , gstAttacking);
  2598 ScriptSetInteger('gstCollision'      ,$00000020);
  2613 ScriptSetInteger('gstCollision'     , gstCollision);
  2599 ScriptSetInteger('gstHHChooseTarget' ,$00000040);
  2614 ScriptSetInteger('gstHHChooseTarget', gstHHChooseTarget);
  2600 ScriptSetInteger('gstHHJumping'      ,$00000100);
  2615 ScriptSetInteger('gstHHJumping'     , gstHHJumping);
  2601 ScriptSetInteger('gsttmpFlag'        ,$00000200);
  2616 ScriptSetInteger('gsttmpFlag'       , gsttmpFlag);
  2602 ScriptSetInteger('gstHHThinking'     ,$00000800);
  2617 ScriptSetInteger('gstHHThinking'    , gstHHThinking);
  2603 ScriptSetInteger('gstNoDamage'       ,$00001000);
  2618 ScriptSetInteger('gstNoDamage'      , gstNoDamage);
  2604 ScriptSetInteger('gstHHHJump'        ,$00002000);
  2619 ScriptSetInteger('gstHHHJump'       , gstHHHJump);
  2605 ScriptSetInteger('gstAnimation'      ,$00004000);
  2620 ScriptSetInteger('gstAnimation'     , gstAnimation);
  2606 ScriptSetInteger('gstHHDeath'        ,$00008000);
  2621 ScriptSetInteger('gstHHDeath'       , gstHHDeath);
  2607 ScriptSetInteger('gstWinner'         ,$00010000);
  2622 ScriptSetInteger('gstWinner'        , gstWinner);
  2608 ScriptSetInteger('gstWait'           ,$00020000);
  2623 ScriptSetInteger('gstWait'          , gstWait);
  2609 ScriptSetInteger('gstNotKickable'    ,$00040000);
  2624 ScriptSetInteger('gstNotKickable'   , gstNotKickable);
  2610 ScriptSetInteger('gstLoser'          ,$00080000);
  2625 ScriptSetInteger('gstLoser'         , gstLoser);
  2611 ScriptSetInteger('gstHHGone'         ,$00100000);
  2626 ScriptSetInteger('gstHHGone'        , gstHHGone);
  2612 ScriptSetInteger('gstInvisible'      ,$00200000);
  2627 ScriptSetInteger('gstInvisible'     , gstInvisible);
  2613 
  2628 
  2614 // ai hints
  2629 // ai hints
  2615 ScriptSetInteger('aihUsualProcessing' ,$00000000);
  2630 ScriptSetInteger('aihUsualProcessing', aihUsualProcessing);
  2616 ScriptSetInteger('aihDoesntMatter'    ,$00000001);
  2631 ScriptSetInteger('aihDoesntMatter'   , aihDoesntMatter);
  2617 
  2632 
  2618 // land flags
  2633 // land flags
  2619 ScriptSetInteger('lfIndestructible', lfIndestructible);
  2634 ScriptSetInteger('lfIndestructible', lfIndestructible);
  2620 ScriptSetInteger('lfIce',            lfIce);
  2635 ScriptSetInteger('lfIce',            lfIce);
  2621 ScriptSetInteger('lfBouncy',         lfBouncy);
  2636 ScriptSetInteger('lfBouncy',         lfBouncy);
  2722 lua_register(luaState, _P'GetCurAmmoType', @lc_getcurammotype);
  2737 lua_register(luaState, _P'GetCurAmmoType', @lc_getcurammotype);
  2723 lua_register(luaState, _P'TestRectForObstacle', @lc_testrectforobstacle);
  2738 lua_register(luaState, _P'TestRectForObstacle', @lc_testrectforobstacle);
  2724 lua_register(luaState, _P'GetGravity', @lc_getgravity);
  2739 lua_register(luaState, _P'GetGravity', @lc_getgravity);
  2725 lua_register(luaState, _P'SetGravity', @lc_setgravity);
  2740 lua_register(luaState, _P'SetGravity', @lc_setgravity);
  2726 lua_register(luaState, _P'SetWaterLine', @lc_setwaterline);
  2741 lua_register(luaState, _P'SetWaterLine', @lc_setwaterline);
       
  2742 lua_register(luaState, _P'SetWeapon', @lc_setweapon);
  2727 
  2743 
  2728 lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear);
  2744 lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear);
  2729 lua_register(luaState, _P'HedgewarsScriptLoad', @lc_hedgewarsscriptload);
  2745 lua_register(luaState, _P'HedgewarsScriptLoad', @lc_hedgewarsscriptload);
  2730 lua_register(luaState, _P'DeclareAchievement', @lc_declareachievement);
  2746 lua_register(luaState, _P'DeclareAchievement', @lc_declareachievement);
  2731 
  2747