LuaAPI: Explode()
authorWuzzy
Thu, 22 Mar 2018 19:40:41 +0000
changeset 1270 2c4320387c2f
parent 1269 347b7c9acf0a
child 1271 006fe546bd26
LuaAPI: Explode()
LuaAPI.wiki
--- a/LuaAPI.wiki	Thu Mar 22 17:03:33 2018 +0000
+++ b/LuaAPI.wiki	Thu Mar 22 19:40:41 2018 +0000
@@ -990,6 +990,39 @@
 ==== <tt>!SetMaxBuildDistance(distInPx)</tt> ====
 Sets the maximum building distance for of girders and rubber bands in pixels to `distInPx`. If `distInPx` is `0`, the limit is disabled. If called without arguments, the distance will be reset to the default value.
 
+==== `Explode(x, y, radius[, options])` (0.9.24) ====
+Cause an explosion or erase land, push or damage gears.
+
+By default, causes an explosion at the coordinates `(x, y)` with the given `radius`. Explosions destroy land, and damage and push gears in its radius. Assuming 100% damage, the explosion damage at the center equals the explosion radius.
+
+`options` is a bitmask which can be used to tweak how the explosion behaves:
+
+|| *Flag* || *Meaning* ||
+|| `EXPLAutoSound` || Plays an appropriate sound ||
+|| `EXPLNoDamage` || Deal no damage to gears ||
+|| `EXPLDoNotTouchHH` || Do not push hedgehogs ||
+|| `EXPLDoNotTouchAny` || Do not push any gears ||
+|| `EXPLDontDraw` || Do not destroy land ||
+|| `EXPLNoGfx` || Do not show an explosion animation and do not shake the screen ||
+|| `EXPLPoisoned` || Poison all hedgehogs in explosion radius ||
+
+`options` is assumed to be `EXPLAutoSound` by default. Set `options` to 0 to disable all flags.
+
+Examples:
+<code language="lua">
+-- Simple explosion at (100, 50) with radius 50
+Explode(100, 50, 50)
+
+-- Simlpe explosion without sound
+Explode(100, 50, 50, 0)
+
+-- Fake explosion which only cause a push but deals no damage to gears an terrain
+Explode(500, 1000, 50, EXPLAutoSound + EXPLNoDamage + EXPLDontDraw)
+
+-- Erase land without side effects:
+Explode(500, 100, 100, EXPLNoDamage + EXPLDoNotTouchAny + EXPLNoGfx)
+</code>
+
 ==== `SkipTurn()` (0.9.24) ====
 Forces the current hedgehog to skip its turn.