--- a/LuaAPI.wiki Sun Dec 14 00:48:36 2014 +0000
+++ b/LuaAPI.wiki Sun Dec 14 18:27:32 2014 +0000
@@ -58,28 +58,61 @@
c = 0x808080 -- gray (50%)</code>
-== Global available Constants ==
+== Globally available variables and constants ==
+The following variables are made available by Hedgewars in Lua and can be used to quickly query a value. Lua scripts schould normally *not* write to these variables, only read from them.
+
+=== General variables and constants ===
+Here are some unsorted variables or constants which are available in Lua. You shouldn’t write to most of them.
-<blockquote><tt>LAND_WIDTH</tt>, <tt>LAND_HEIGHT</tt>
-</blockquote>
-<blockquote><tt>!ScreenWidth</tt>, <tt>!ScreenHeight</tt>, <tt>!WaterLine</tt></blockquote>
+|| *Identifier* || *Description* ||
+|| `LAND_WIDTH` || The width of the landscape in pixels ||
+|| `LAND_HEIGHT` || The height of the landscape in pixels ||
+|| `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
+|| `ClansCount` || Number of clans in the game (teams with the same color belong to one clan) ||
+|| `TeamsCount` || Number of teams in the game ||
+|| `TurnTimeLeft` || Number of game ticks (milliseconds) left until the current turn ends. You can change this variable directly. ||
+|| `GameTime` || Number of total game ticks ||
+|| `TotalRounds` || Number of rounds that have passed ||
+|| `CurrentHedgehog` || The hedgehog gear that is currently in play ||
-Game flags:
-
-<blockquote><tt>gfForts, gfMultiWeapon, gfBorder, gfSolidLand, gfDivideTeams, gfLowGravity, gfLaserSight, gfInvulnerable, gfMines, gfVampiric, gfKarma, gfArtillery, gfOneClanMode, gfRandomOrder, gfKing, gfPlaceHog, gfSharedAmmo, gfDisableGirders, gfExplosives, gfDisableLandObjects, gfAISurvival, gfInfAttack, gfResetWeps, gfResetHealth, gfPerHogAmmo, gfDisableWind, gfMoreWind, gfTagTeam</tt></blockquote>
+=== !GameFlags ===
+The !GameFlags are used to store simple boolean settings of the game. All game flags are stored together in a bitmask. You don’t have to worry about this too much, the functions in [LuaAPI#GameFlags] do all the bitmask handling for you.
-*Note:* A few of these, e.g. gfResetHealth (and probably gfTagTeam) are not yet exposed to lua.
-
-More constants at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types]
-
-Additional global changing variables accessible:
+|| *Identifier* || *Description (active state)* ||
+|| `gfOneClanMode` || Used when only one clan is in the game. This game flag is primarily used for training missions. ||
+|| `gfMultiWeapon` || TODO (Used in training missions.) ||
+|| `gfForts` || Fort Mode ||
+|| `gfDivideTeams` || The teams will start at opposite sites of the terrain. Two clans maximum. ||
+|| `gfBorder` || An indestrctible border is active around the map. ||
+|| `gfBottomBorder` || There is an indestructable border at the bottom of the map. ||
+|| `gfShoppaBorder` || TODO ||
+|| `gfSolidLand` || The terrain is indestructible. ||
+|| `gfLowGravity` || The gravity is low. ||
+|| `gfLaserSight` || A laser sight is almost always active. ||
+|| `gfInvulnerable` || All hedgehogs are invulnerable. ||
+|| `gfVampiric` || All hedgehogs become vampires and get 80% of the damage they deal as health. ||
+|| `gfKarma` || Attackers share the damage they deal to enemies. ||
+|| `gfArtillery` || Hedgehogs can’t walk. ||
+|| `gfRandomOrder` || The game is played in random order. ||
+|| `gfPlaceHog` || Placement mode: At the beginning of the round, all hedgehogs are placed manually first. ||
+|| `gfKing` || King Mode: One hedgehog per team becomes their king, if the king dies, the team loses. ||
+|| `gfSharedAmmo` || Teams in the same clan share their ammo. ||
+|| `gfDisableGirders` || No girders will be created in random maps ||
+|| `gfDisableLandObjects` || No land objects will be created in random maps ||
+|| `gfAISurvival` || Computer-controlled hedgehogs will be revived after they die. ||
+|| `gfInfAttack` || Attacks don’t end the turn. ||
+|| `gfResetWeps` || The weapons will be reset to the initial state each turn. ||
+|| `gfPerHogAmmo` || Each hedgehog has its own weapon stash. ||
+|| `gfDisableWind` || There is no wind. ||
+|| `gfMoreWind` || There is always strong wind. ||
+|| `gfTagTeam` || Tag Team: Teams in the same clan share their turn time. ||
- * <tt>!ClansCount</tt> - number of clans in the game (teams with the same color belong to one clan)
- * <tt>!TeamsCount</tt> - number of teams in the game
- * <tt>!TurnTimeLeft</tt> - number of game ticks left until the current turn ends
- * <tt>!GameTime</tt> - number of total game ticks
- * <tt>!TotalRounds</tt> - number of round that has passed
- * <tt>!CurrentHedgehog</tt> - the hedgehog gear that is currently in play
+The following !GameFlag is not yet available to Lua:
+|| *Identifier* || *Description (active state)* ||
+|| `gfResetHealth` || The health of all living hedgehogs is reset at the end of each turn. ||
+
+=== More constants ===
+More constants are at at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types]
== Event Handlers ==