LuaAPI.wiki
changeset 1225 64b95a681971
parent 1224 90c14fae29f2
child 1226 971427650f1f
equal deleted inserted replaced
1224:90c14fae29f2 1225:64b95a681971
   382 This is used while a special hand-drawn map is loaded. The engine is building these hand-drawn maps by reading points from the map definition. Optionally, some of these points may be “special”. These are not actually drawn on the map, but are used to store additional information for a position on the map. Special points currently need to be added manually in the map, the in-game editor is not able to add those yet (as of 0.9.23).
   382 This is used while a special hand-drawn map is loaded. The engine is building these hand-drawn maps by reading points from the map definition. Optionally, some of these points may be “special”. These are not actually drawn on the map, but are used to store additional information for a position on the map. Special points currently need to be added manually in the map, the in-game editor is not able to add those yet (as of 0.9.23).
   383 Now, when such a special point at the coordinates `x` and `y` with an assigned value of `flags` is added, this function is called. `flags` is a whole number between `0` and `255` inclusive.
   383 Now, when such a special point at the coordinates `x` and `y` with an assigned value of `flags` is added, this function is called. `flags` is a whole number between `0` and `255` inclusive.
   384 
   384 
   385 This function is used in Racer and !TechRacer to define waypoints.
   385 This function is used in Racer and !TechRacer to define waypoints.
   386 
   386 
       
   387 === `onAchievementsDeclaration()` ===
       
   388 This function is called after the stats have been built. You are supposed to call `DeclareAchivement` here.
       
   389 
   387 == Functions for creating gears ==
   390 == Functions for creating gears ==
   388 
   391 
   389 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
   392 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
   390 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]). The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States].
   393 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]). The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States].
   391 
   394 
  1425 Converts the whole numbers `x` and `y` to strings and writes them to `Logs/game0.log`, one line each.
  1428 Converts the whole numbers `x` and `y` to strings and writes them to `Logs/game0.log`, one line each.
  1426 
  1429 
  1427 === `StartGhostPoints(count)` ===
  1430 === `StartGhostPoints(count)` ===
  1428 Just prints out “GHOST_POINTS” and the argument on the console. This function might change in later versions.
  1431 Just prints out “GHOST_POINTS” and the argument on the console. This function might change in later versions.
  1429 
  1432 
       
  1433 === `DeclareAchivement(id, teamname, location, value)` ===
       
  1434 Declares an achievement with the identifier `id` achieved by the team `teamname` on the map `location` with an achievement value (e.g. score) of `value`. `value` must be an integer. You are supposed to call this function inside an `onAchievementsDeclaration` callback.
       
  1435 
       
  1436 Currently, this actually just triggers a console output, but it might be changed later. The idea is to track multiplayer records.
       
  1437 
       
  1438 Example:
       
  1439 
       
  1440 ```
       
  1441 DeclareAchievement("height reached", teamname, "ClimbHome", -score)
       
  1442 ```
       
  1443 Records a team's best height in !ClimbHome.
       
  1444 
  1430 === <tt>!ParseCommand(string)</tt> ===
  1445 === <tt>!ParseCommand(string)</tt> ===
  1431 Makes the game client parse and execute the specified internal game engine command.
  1446 Makes the game client parse and execute the specified internal game engine command.
  1432 
  1447 
  1433 The available commands depend on the current engine protocol version. The *engine protocol can (and will) change* between releases.
  1448 The available commands depend on the current engine protocol version. The *engine protocol can (and will) change* between releases.
  1434 
  1449