hedgewars/uScript.pas
changeset 3723 958eeaf84714
parent 3722 eadebe4c45c9
child 3724 b8678667e7dc
equal deleted inserted replaced
3722:eadebe4c45c9 3723:958eeaf84714
   361         LuaError('Lua: Wrong number of parameters passed to SetHealth!');
   361         LuaError('Lua: Wrong number of parameters passed to SetHealth!');
   362         end
   362         end
   363     else
   363     else
   364         begin
   364         begin
   365         gear:= GearByUID(lua_tointeger(L, 1));
   365         gear:= GearByUID(lua_tointeger(L, 1));
   366         if gear <> nil then gear^.Health:= lua_tointeger(L, 2)
   366         if gear <> nil then
       
   367             begin
       
   368             gear^.Health:= lua_tointeger(L, 2);
       
   369             SetAllToActive;
       
   370             end
   367         end;
   371         end;
   368     lc_sethealth:= 0
   372     lc_sethealth:= 0
   369 end;
   373 end;
   370 
   374 
   371 function lc_settimer(L : Plua_State) : LongInt; Cdecl;
   375 function lc_settimer(L : Plua_State) : LongInt; Cdecl;
   391         LuaError('Lua: Wrong number of parameters passed to SetState!');
   395         LuaError('Lua: Wrong number of parameters passed to SetState!');
   392         end
   396         end
   393     else
   397     else
   394         begin
   398         begin
   395         gear:= GearByUID(lua_tointeger(L, 1));
   399         gear:= GearByUID(lua_tointeger(L, 1));
   396         if gear <> nil then gear^.State:= lua_tointeger(L, 2)
   400         if gear <> nil then
       
   401             begin
       
   402             gear^.State:= lua_tointeger(L, 2);
       
   403             SetAllToActive;
       
   404             end
   397         end;
   405         end;
   398     lc_setstate:= 0
   406     lc_setstate:= 0
   399 end;
   407 end;
   400 
   408 
   401 function lc_getstate(L : Plua_State) : LongInt; Cdecl;
   409 function lc_getstate(L : Plua_State) : LongInt; Cdecl;
   424         LuaError('Lua: Wrong number of parameters passed to SetTag!');
   432         LuaError('Lua: Wrong number of parameters passed to SetTag!');
   425         end
   433         end
   426     else
   434     else
   427         begin
   435         begin
   428         gear:= GearByUID(lua_tointeger(L, 1));
   436         gear:= GearByUID(lua_tointeger(L, 1));
   429         if gear <> nil then gear^.Tag:= lua_tointeger(L, 2)
   437         if gear <> nil then
       
   438             begin
       
   439             gear^.Tag:= lua_tointeger(L, 2);
       
   440             SetAllToActive;
       
   441             end
   430         end;
   442         end;
   431     lc_settag:= 0
   443     lc_settag:= 0
   432 end;
   444 end;
   433 
   445 
   434 function lc_endgame(L : Plua_State) : LongInt; Cdecl;
   446 function lc_endgame(L : Plua_State) : LongInt; Cdecl;
   538             begin
   550             begin
   539             x:= lua_tointeger(L, 2);
   551             x:= lua_tointeger(L, 2);
   540             y:= lua_tointeger(L, 3);
   552             y:= lua_tointeger(L, 3);
   541             gear^.X:= int2hwfloat(x);
   553             gear^.X:= int2hwfloat(x);
   542             gear^.Y:= int2hwfloat(y);
   554             gear^.Y:= int2hwfloat(y);
       
   555             SetAllToActive;
   543             end
   556             end
   544         end;
   557         end;
   545     lc_setgearposition:= 0
   558     lc_setgearposition:= 0
   546 end;
   559 end;
   547 
   560