hedgewars/uScript.pas
branch0.9.24
changeset 13687 f60b3998ba56
parent 13398 ae5d6448c5be
child 13688 6c0cf6b9eff8
--- a/hedgewars/uScript.pas	Mon Aug 06 21:41:06 2018 +0200
+++ b/hedgewars/uScript.pas	Tue Aug 21 15:11:28 2018 -0400
@@ -835,7 +835,7 @@
     params = 'x, y, visualGearType, state, critical [, layer]';
 begin
     uid:= 0;
-    if CheckAndFetchParamCount(L, 5, 6, call, params, n) then
+    if not(cOnlyStats) and CheckAndFetchParamCount(L, 5, 6, call, params, n) then
         begin
         s:= LuaToVisualGearTypeOrd(L, 3, call, params);
         if s >= 0 then
@@ -904,7 +904,7 @@
 function lc_getvisualgearvalues(L : Plua_State) : LongInt; Cdecl;
 var vg: PVisualGear;
 begin
-    if CheckLuaParamCount(L, 1, 'GetVisualGearValues', 'vgUid') then
+    if not(cOnlyStats) and CheckLuaParamCount(L, 1, 'GetVisualGearValues', 'vgUid') then
         begin
         vg:= VisualGearByUID(Trunc(lua_tonumber(L, 1)));
         if vg <> nil then
@@ -937,6 +937,8 @@
 function lc_setvisualgearvalues(L : Plua_State) : LongInt; Cdecl;
 var vg : PVisualGear;
 begin
+    lc_setvisualgearvalues:= 0;
+	if cOnlyStats then exit;
 // Param count can be 1-11 at present
 //    if CheckLuaParamCount(L, 11, 'SetVisualGearValues', 'vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint') then
 //        begin
@@ -963,11 +965,10 @@
                 vg^.Timer:= Trunc(lua_tonumber(L, 10));
             if not lua_isnoneornil(L, 11) then
                 vg^.Tint:= Trunc(lua_tonumber(L, 11))
-            end;
+            end
 //        end
 //    else
 //        lua_pushnil(L); // return value on stack (nil)
-    lc_setvisualgearvalues:= 0
 end;
 
 // so. going to use this to get/set some of the more obscure gear values which were not already exposed elsewhere