Преглед на файлове

Clean up redundant semicolons in sample Lua scripts.
[ci skip]

Yao Wei Tjong 姚伟忠 преди 7 години
родител
ревизия
0631979496

+ 1 - 1
bin/Data/LuaScripts/02_HelloGUI.lua

@@ -71,7 +71,7 @@ function InitWindow()
     ui.root:AddChild(window)
 
     -- Set Window size and layout settings
-    window.minWidth = 384;
+    window.minWidth = 384
     window:SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6))
     window:SetAlignment(HA_CENTER, VA_CENTER)
     window:SetName("Window")

+ 2 - 2
bin/Data/LuaScripts/15_Navigation.lua

@@ -312,9 +312,9 @@ function ToggleStreaming(enabled)
         local maxTiles = (2 * streamingDistance + 1) * (2 * streamingDistance + 1)
         local boundingBox = BoundingBox(navMesh.boundingBox)
         SaveNavigationData()
-        navMesh:Allocate(boundingBox, maxTiles);
+        navMesh:Allocate(boundingBox, maxTiles)
     else
-        navMesh:Build();
+        navMesh:Build()
     end
 end
 

+ 1 - 1
bin/Data/LuaScripts/17_SceneReplication.lua

@@ -168,7 +168,7 @@ function SubscribeToEvents()
     -- This is a custom event, sent from the server to the client. It tells the node ID of the object the client should control
     SubscribeToEvent("ClientObjectID", "HandleClientObjectID")
     -- Events sent between client & server (remote events) must be explicitly registered or else they are not allowed to be received
-    network:RegisterRemoteEvent("ClientObjectID");
+    network:RegisterRemoteEvent("ClientObjectID")
 end
 
 function CreateButton(text, width)

+ 1 - 1
bin/Data/LuaScripts/19_VehicleDemo.lua

@@ -220,7 +220,7 @@ function HandlePostUpdate(eventType, eventData)
     -- Raycast camera against static objects (physics collision mask 2)
     -- and move it closer to the vehicle if something in between
     local cameraRay = Ray(cameraStartPos, (cameraTargetPos - cameraStartPos):Normalized())
-    local cameraRayLength = (cameraTargetPos - cameraStartPos):Length();
+    local cameraRayLength = (cameraTargetPos - cameraStartPos):Length()
     local physicsWorld = scene_:GetComponent("PhysicsWorld")
     local result = physicsWorld:RaycastSingle(cameraRay, cameraRayLength, 2)
     if result.body ~= nil then

+ 2 - 2
bin/Data/LuaScripts/23_Water.lua

@@ -53,9 +53,9 @@ function CreateScene()
     light.castShadows = true
     light.shadowBias = BiasParameters(0.00025, 0.5)
     light.shadowCascade = CascadeParameters(10.0, 50.0, 200.0, 0.0, 0.8)
-    light.specularIntensity = 0.5;
+    light.specularIntensity = 0.5
     -- Apply slightly overbright lighting to match the skybox
-    light.color = Color(1.2, 1.2, 1.2);
+    light.color = Color(1.2, 1.2, 1.2)
 
     -- Create skybox. The Skybox component is used like StaticModel, but it will be always located at the camera, giving the
     -- illusion of the box planes being far away. Use just the ordinary Box model and a suitable material, whose shader will

+ 1 - 1
bin/Data/LuaScripts/31_MaterialAnimation.lua

@@ -64,7 +64,7 @@ function CreateScene()
     specColorAnimation:SetKeyFrame(2.0, Variant(Color(1.0, 1.0, 0.0, 2.0)))
     specColorAnimation:SetKeyFrame(3.0, Variant(Color(0.1, 0.1, 0.1, 16.0)))
     -- Optionally associate material with scene to make sure shader parameter animation respects scene time scale
-    mushroomMat.scene = scene_;
+    mushroomMat.scene = scene_
     mushroomMat:SetShaderParameterAnimation("MatSpecColor", specColorAnimation)
 
     local NUM_OBJECTS = 200

+ 2 - 2
bin/Data/LuaScripts/34_DynamicGeometry.lua

@@ -10,7 +10,7 @@ local boxNodes = {}
 local animate = false
 local useGroups = false
 
-local animate = true;
+local animate = true
 local animTime = 0.0
 local originalVertexData = VectorBuffer()
 local animatingBuffers = {}
@@ -287,7 +287,7 @@ function MoveCamera(timeStep)
 end
 
 function AnimateObjects(timeStep)
-    animTime = animTime + timeStep * 100.0;
+    animTime = animTime + timeStep * 100.0
 
     -- Repeat for each of the cloned vertex buffers
     for i = 1, table.getn(animatingBuffers) do

+ 5 - 5
bin/Data/LuaScripts/37_UIDrag.lua

@@ -58,14 +58,14 @@ function CreateGUI()
         b:SetPosition(IntVector2(50*i, 50*i))
 
         -- Enable the bring-to-front flag and set the initial priority
-        b.bringToFront = true;
-        b.priority = i;
+        b.bringToFront = true
+        b.priority = i
 
         -- Set the layout mode to make the child text elements aligned vertically
-        b:SetLayout(LM_VERTICAL, 20, IntRect(40, 40, 40, 40));
-        local dragInfos = {"Num Touch", "Text", "Event Touch"};
+        b:SetLayout(LM_VERTICAL, 20, IntRect(40, 40, 40, 40))
+        local dragInfos = {"Num Touch", "Text", "Event Touch"}
         for j=1, table.getn(dragInfos) do
-            b:CreateChild("Text", dragInfos[j]):SetStyleAuto();
+            b:CreateChild("Text", dragInfos[j]):SetStyleAuto()
         end
 
         if i % 2 == 0 then

+ 2 - 2
bin/Data/LuaScripts/39_CrowdNavigation.lua

@@ -399,9 +399,9 @@ function ToggleStreaming(enabled)
         local maxTiles = (2 * streamingDistance + 1) * (2 * streamingDistance + 1)
         local boundingBox = BoundingBox(navMesh.boundingBox)
         SaveNavigationData()
-        navMesh:Allocate(boundingBox, maxTiles);
+        navMesh:Allocate(boundingBox, maxTiles)
     else
-        navMesh:Build();
+        navMesh:Build()
     end
 end
 

+ 1 - 1
bin/Data/LuaScripts/40_Localization.lua

@@ -164,7 +164,7 @@ end
 
 -- You can manually change texts, sprites and other aspects of the game when language is changed
 function HandleChangeLanguage(eventType, eventData)
-    local windowTitle = ui.root:GetChild("WindowTitle", true);
+    local windowTitle = ui.root:GetChild("WindowTitle", true)
     windowTitle.text = localization:Get("title") .. " (" ..
                            localization.languageIndex .. " " ..
                            localization.language .. ")"

+ 4 - 4
bin/Data/LuaScripts/42_PBRMaterials.lua

@@ -59,8 +59,8 @@ function CreateScene()
     local staticModel = sphereWithDynamicMatNode:GetComponent("StaticModel")
     dynamicMaterial = staticModel:GetMaterial(0)
 
-    local zoneNode = scene_:GetChild("Zone");
-    zone = zoneNode:GetComponent("Zone");
+    local zoneNode = scene_:GetChild("Zone")
+    zone = zoneNode:GetComponent("Zone")
 
     -- Create the camera (not included in the scene file)
     cameraNode = scene_:CreateChild("Camera")
@@ -145,7 +145,7 @@ function HandleAmbientSliderChanged(eventType, eventData)
 end
 
 function SetupViewport()
-    renderer.hdrRendering = true;
+    renderer.hdrRendering = true
 
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
@@ -158,7 +158,7 @@ function SetupViewport()
     effectRenderPath:Append(cache:GetResource("XMLFile", "PostProcess/Tonemap.xml"))
     effectRenderPath:Append(cache:GetResource("XMLFile", "PostProcess/AutoExposure.xml"))
 
-    viewport.renderPath = effectRenderPath;
+    viewport.renderPath = effectRenderPath
 end
 
 function SubscribeToEvents()

+ 3 - 3
bin/Data/LuaScripts/46_RaycastVehicleDemo.lua

@@ -226,7 +226,7 @@ function HandlePostUpdate(eventType, eventData)
     -- Raycast camera against static objects (physics collision mask 2)
     -- and move it closer to the vehicle if something in between
     local cameraRay = Ray(cameraStartPos, (cameraTargetPos - cameraStartPos):Normalized())
-    local cameraRayLength = (cameraTargetPos - cameraStartPos):Length();
+    local cameraRayLength = (cameraTargetPos - cameraStartPos):Length()
     local physicsWorld = scene_:GetComponent("PhysicsWorld")
     local result = physicsWorld:RaycastSingle(cameraRay, cameraRayLength, 2)
     if result.body ~= nil then
@@ -361,8 +361,8 @@ function Vehicle:PostInit()
     local node = self.node
     local raycastVehicle = node:GetComponent("RaycastVehicle")
     self.hullBody = node:GetComponent("RigidBody")
-    self:CreateEmitters();
-    raycastVehicle:ResetWheels();
+    self:CreateEmitters()
+    raycastVehicle:ResetWheels()
 end
 
 function Vehicle:FixedUpdate(timeStep)

+ 1 - 1
bin/Data/LuaScripts/47_Typography.lua

@@ -146,7 +146,7 @@ function CreateMenu(label, items, handler)
         list:AddItem(t)
         t.text = item
         t:SetStyleAuto()
-        t:SetMinWidth(t:GetRowWidth(0) + 10);
+        t:SetMinWidth(t:GetRowWidth(0) + 10)
         t:AddTag(TEXT_TAG) 
     end
 

+ 2 - 2
bin/Data/LuaScripts/50_Urho2DPlatformer.lua

@@ -384,7 +384,7 @@ function Character2D:HandleWoundedState(timeStep)
 
     -- Play "hit" animation in loop
     if animatedSprite.animation ~= "hit" then
-        animatedSprite:SetAnimation("hit", LM_FORCE_LOOPED);
+        animatedSprite:SetAnimation("hit", LM_FORCE_LOOPED)
     end
 
     -- Update timer
@@ -450,4 +450,4 @@ function Character2D:HandleDeath()
     if animatedSprite.animation ~= "dead2" then
         animatedSprite:SetAnimation("dead2")
     end
-end
+end

+ 2 - 2
bin/Data/LuaScripts/51_Urho2DStretchableSprite.lua

@@ -129,7 +129,7 @@ function TranslateSprites(timeStep)
     local down = input:GetKeyDown(KEY_S)
 
     if left or right or up or down then
-        local quantum = timeStep * speed;
+        local quantum = timeStep * speed
         local translate = Vector2((left and -quantum or 0) + (right and quantum or 0),
                                   (down and -quantum or 0) + (up and quantum or 0))
 
@@ -195,5 +195,5 @@ function GetScreenJoystickPatchString()
         "            <attribute name=\"Text\" value=\"LCTRL\" />" ..
         "        </element>" ..
         "    </add>" ..
-        "</patch>";
+        "</patch>"
 end

+ 4 - 4
bin/Data/LuaScripts/Utilities/2D/Sample2D.lua

@@ -293,7 +293,7 @@ function CreateUIContent(demoTitle)
     coinsUI:SetSize(50, 50)
     coinsUI.imageRect = IntRect(0, 64, 60, 128)
     coinsUI:SetAlignment(HA_LEFT, VA_TOP)
-    coinsUI:SetPosition(5, 5);
+    coinsUI:SetPosition(5, 5)
     local coinsText = coinsUI:CreateChild("Text", "CoinsText")
     coinsText:SetAlignment(HA_CENTER, VA_CENTER)
     coinsText:SetFont(font, 24)
@@ -305,7 +305,7 @@ function CreateUIContent(demoTitle)
     lifeUI.texture = cache:GetResource("Texture2D", "Urho2D/imp/imp_all.png")
     lifeUI:SetSize(70, 80)
     lifeUI:SetAlignment(HA_RIGHT, VA_TOP)
-    lifeUI:SetPosition(-5, 5);
+    lifeUI:SetPosition(-5, 5)
     local lifeText = lifeUI:CreateChild("Text", "LifeText")
     lifeText:SetAlignment(HA_CENTER, VA_CENTER)
     lifeText:SetFont(font, 24)
@@ -415,7 +415,7 @@ function ReloadScene(reInit)
     scene_:LoadXML(fileSystem:GetProgramDir().."Data/Scenes/" .. filename .. ".xml")
     -- After loading we have to reacquire the character scene node, as it has been recreated
     -- Simply find by name as there's only one of them
-    character2DNode = scene_:GetChild("Imp", true);
+    character2DNode = scene_:GetChild("Imp", true)
     if character2DNode == nil then
         return
     end
@@ -494,4 +494,4 @@ function GetScreenJoystickPatchString()
         "       </element>" ..
         "   </add>" ..
         "</patch>"
-end
+end

+ 5 - 5
bin/Data/LuaScripts/Utilities/Sample.lua

@@ -113,7 +113,7 @@ function CreateLogo()
     logoSprite.hotSpot = IntVector2(textureWidth, textureHeight)
 
     -- Set logo sprite alignment
-    logoSprite:SetAlignment(HA_RIGHT, VA_BOTTOM);
+    logoSprite:SetAlignment(HA_RIGHT, VA_BOTTOM)
 
     -- Make logo not fully opaque to show the scene underneath
     logoSprite.opacity = 0.9
@@ -153,12 +153,12 @@ function HandleKeyUp(eventType, eventData)
             console:SetVisible(false)
         else
             if GetPlatform() == "Web" then
-                input.mouseVisible = true;
+                input.mouseVisible = true
                 if (useMouseMode_ ~= MM_ABSOLUTE) then
-                    input.mouseMode = MM_FREE;
+                    input.mouseMode = MM_FREE
                 end
             else
-                engine:Exit();
+                engine:Exit()
             end
         end
     end
@@ -303,7 +303,7 @@ end
 -- If the user clicks the canvas, attempt to switch to relative mouse mode on web platform
 function HandleMouseModeChange(eventType, eventData)
     mouseLocked = eventData["MouseLocked"]:GetBool()
-    input.mouseVisible = not mouseLocked;
+    input.mouseVisible = not mouseLocked
 end
 
 -- Create empty XML patch instructions for screen joystick layout if none defined