Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
authorWuzzy <Wuzzy2@mail.ru>
Thu, 17 Jan 2019 01:35:43 +0100
changeset 14630 835072bcbfb6
parent 14629 2759c5e28c7d
child 14631 ab6be7d200b0
Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
ChangeLog.txt
share/hedgewars/Data/Scripts/Animate.lua
--- a/ChangeLog.txt	Thu Jan 17 01:24:34 2019 +0100
+++ b/ChangeLog.txt	Thu Jan 17 01:35:43 2019 +0100
@@ -86,6 +86,7 @@
  + SpeedShoppa/TargetPractice libraries: Remove custom hog and team info settings
  + Params explode, poison in the SpawnFake*Crate functions now optional and default to false
  + New global: InitHealth: Initial hog health value from game scheme (read-only)
+ + Animate library: AnimOutOfNowhere: destX and destY are now optional (default: current position)
  * Fix SetAmmoDelay not working properly when called after onGameStart
  * Fix DismissTeam not clearing team properly
 
--- a/share/hedgewars/Data/Scripts/Animate.lua	Thu Jan 17 01:24:34 2019 +0100
+++ b/share/hedgewars/Data/Scripts/Animate.lua	Thu Jan 17 01:35:43 2019 +0100
@@ -235,6 +235,10 @@
 end
 
 function AnimOutOfNowhere(gear, destX, destY)
+  if (not destX) or (not destY) then
+    destX = GetX(gear)
+    destY = GetY(gear)
+  end
   AnimSetGearPosition(gear, destX, destY)
   AddVisualGear(destX, destY, vgtBigExplosion, 0, false)
   PlaySound(sndExplosion)