LuaLibraryUtils.wiki
author Wuzzy
Tue, 01 Jan 2019 21:40:03 +0000
changeset 1694 d3bebda2cdfd
parent 1652 ff0512443f75
child 1826 24b348e89a57
permissions -rw-r--r--
LuaAPI: Add AddMissionTeam / AddMissionHog

#summary Lua library documentation of Utils; contains assorted helper functions
#labels !LuaLibrary
= Lua library: `Utils` =

This library includes miscellaneous functions to use, they are all independent of each other and can be used everywhere.

== `gearIsInBox(gear, x, y, w, h)` ==

Returns whether the gear is inside (centre point of the gear) a box with x and y as the top left corner and having the width and height of w and h respectively.


== `gearIsInCircle(gear, x, y, r, useRadius)` ==

Returns whether the gear is inside a circle with x and y being the centre point and r being the radius of the circle. The boolean useRadius determine whether only the centre point of the gear will be used or the radius of the gear will be checked too.

== `fillMap([flush])` ==
Completely fill the current map with land. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.

== `eraseMap([flush])` ==
Completely erase all land from current map. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.

== Standardized land tint colors ==
There are some “standard” tint colors for placed girders and other sprites which are defined to allow more consistency, if it is desired. These values are used in !TechRacer, !HedgeEditor and the basic movement training to colorize girders consistently:

 * `U_LAND_TINT_NORMAL`: Normal land
 * `U_LAND_TINT_ICE`: Icy land
 * `U_LAND_TINT_INDESTRUCTIBLE`: Indestructible land
 * `U_LAND_TINT_BOUNCY`: Bouncy land