LuaAPI: EnableSwitchHog()
authorWuzzy
Fri, 04 May 2018 14:16:09 +0100
changeset 1411 7c5c8c620a9f
parent 1410 6d356877f1d2
child 1412 225635def24e
LuaAPI: EnableSwitchHog()
LuaAPI.wiki
--- a/LuaAPI.wiki	Thu May 03 22:19:00 2018 +0100
+++ b/LuaAPI.wiki	Fri May 04 14:16:09 2018 +0100
@@ -1250,6 +1250,13 @@
 ==== `SetLaserSight(bool)` (0.9.24) ====
 Toggles laser sight for this turn. Set `bool` to `true` to enable (same effect as if the hedgehog has used Laser Sight), `false` to disable.
 
+==== `EnableSwitchHog()` (0.9.25) ====
+Enable hog switching mode for the current hedgehog. This function should be called while the hedgehog is standing on solid ground (`GetFlightTime` returns 0).
+
+Internally, this tries to spawn a `gtSwitcher` gear which, as long it exists, handles the hog switching. You can delete this gear to stop the hog switching prematurely. If there already is a `gtSwitcher` gear, no additional gear is spawned.
+
+On success, returns the `gtSwitcher` gear being spawned or, if hog switching mode is already active, returns the exsting gear. On failure, returns `nil`.
+
 === Randomness ===
 ==== <tt>!GetRandom(number)</tt> ====
 Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use `GetRandom` for anything that could impact the engine state. For example, a visual gear could simply use Lua’s `math.random`, but adding a regular gear should use `GetRandom`.