# HG changeset patch # User Wuzzy # Date 1480221437 0 # Node ID 8c4a529edddb8cb3cfdfb3a36da26c5809f76168 # Parent 39ed0b23ef49fdf28663d3cc8fe3f8cfdc3d31d8 LuaAPI: PlaceRubber diff -r 39ed0b23ef49 -r 8c4a529edddb LuaAPI.wiki --- a/LuaAPI.wiki Sun Nov 27 00:35:54 2016 +0000 +++ b/LuaAPI.wiki Sun Nov 27 04:37:17 2016 +0000 @@ -355,31 +355,12 @@ === onGirderPlacement(frameIdx, centerX, centerY) (0.9.21) === This function is called when a girder has been placed. -`frameIdx` is an integer and declares the length and orientation of the girder: -|| *`frameIdx`* || *Length* || *Orientation* || -|| 0 || short || horizontal || -|| 1 || short || decreasing right || -|| 2 || short || vertical || -|| 3 || short || increasing right || -|| 4 || long || horizontal || -|| 5 || long || decreasing right || -|| 6 || long || vertical || -|| 7 || long || increasing right || - -`centerX` and `centerY` are the coordinates of the girder’s center. +`frameIdx` is used for the length and orientation of the girder. The possible values are explained in `PlaceGirder`. `centerX` and `centerY` are the coordinates of the girder’s center. === onRubberPlacement(frameIdx, centerX, centerY) (0.9.21) === This function is called when a rubber has been placed. -`frameIdx` is an integer which stands for the orientation of the rubber. - -|| *`frameIdx`* || *Orientation* || -|| 0 || horizontal || -|| 1 || decreasing right || -|| 2 || vertical || -|| 3 || increasing right || - -`centerX` and `centerY` are the coordinates of the rubber’s center. +`frameIdx` is used for the rubber orientation. The possible values are explained in `PlaceRubber`. `centerX` and `centerY` are the coordinates of the rubber’s center. == Functions for creating gears == @@ -991,12 +972,12 @@ ==== !TestRectForObstacle(x1, y1, x2, y2, landOnly) (0.9.16) ==== Checks the rectangle between the given coordinates for possible collisions. Set `landOnly` to `true` if you don’t want to check for collisions with gears (hedgehogs, etc.). -==== !PlaceGirder(x, y, state) (0.9.16) ==== -Attempts to place girder with centre points `x`, `y` and a certain length and orientation, specified by `state`. The girder can only be placed in open space and must not collide with anything so this function may fail. It will return `true` on successful placement and `false` on failure. +==== !PlaceGirder(x, y, frameIdx) (0.9.16) ==== +Attempts to place a girder with centre points `x`, `y` and a certain length and orientation, specified by `frameIdx`. The girder can only be placed in open space and must not collide with anything so this function may fail. It will return `true` on successful placement and `false` on failure. -These are the accepted states: +These are the accepted values for `frameIdx`: -|| *`state`* || *Length* || *Orientation* || +|| *`frameIdx`* || *Length* || *Orientation* || || 0 || short || horizontal || || 1 || short || decreasing right || || 2 || short || vertical || @@ -1006,6 +987,17 @@ || 6 || long || vertical || || 7 || long || increasing right || +==== !PlaceRubber(x, y, frameIdx) (0.9.23) ==== +Attempts to place a rubber with centre points `x`, `y` and a certain orientation, specified by `frameIdx`. The rubber can only be placed in open space and must not collide with anything so this function may fail. It will return `true` on successful placement and `false` on failure. + +These are the accepted values for `frameIdx`: + +|| *`frameIdx`* || *Orientation* || +|| 0 || horizontal || +|| 1 || decreasing right || +|| 2 || vertical || +|| 3 || increasing right || + ==== !PlaceSprite(x, y, sprite, frameIdx, tint, behind, flipHoriz, flipVert, [, landFlag, ...]) ==== Places a [Sprites sprite] at the specified position (`x`, `y`) on the map, it behaves like terrain then. Unlike `PlaceGirder`, this function does not check for collisions, so the sprite can be placed anywhere within map boundaries. The function returns `true` if the placement was successful, `false` otherwise. `frameIdx` is the frame index starting by 0. `frameIdx` is used if the sprite consists of several sub-images. Only a subset of the sprites is currently supported by this function: