Sandbox.wiki
changeset 1787 ac1adfc740c7
parent 1786 006999425a5c
child 1788 b562c672140b
equal deleted inserted replaced
1786:006999425a5c 1787:ac1adfc740c7
     1 #summary Sandbox page for testing the wiki syntax
       
     2 
       
     3 = Sandbox =
       
     4 This is a sandbox page to test the wiki syntax.
       
     5 
       
     6 == Header 2 ==
       
     7 
       
     8 == Header 2 ==
       
     9 
       
    10 == Header 2 ==
       
    11 
       
    12 == Header 3 ==
       
    13 
       
    14 == Header 4 ==
       
    15 
       
    16 == Header 5 ==
       
    17 
       
    18 == Links ==
       
    19 
       
    20  * [Sandbox#Header_2 Link to Header 2 (first one)]
       
    21  * [Sandbox#Header_2__2 Link to Header 2 (second one)]
       
    22  * [Sandbox#Header_2__3 Link to Header 2 (third one)]
       
    23 
       
    24 
       
    25 == Bullets ==
       
    26 
       
    27  * Bullet1
       
    28  * Bullet1
       
    29   * Bullet 2
       
    30   * Bullet 2
       
    31    * Bullet 3
       
    32    * Bullet 3
       
    33   * Bullet 2
       
    34 
       
    35 ---
       
    36 
       
    37 #summary List of gear-related functions in the Lua API
     1 #summary List of gear-related functions in the Lua API
    38 
     2 
    39 = Lua API: Gear functions =
     3 = Lua API: Gear functions =
    40 This is a list of all functions in the [LuaAPI Lua API] that are related to gears and visual gears. Refer to [LuaGuide] for an introduction into gears.
     4 This is a list of all functions in the [LuaAPI Lua API] that are related to gears and visual gears. Refer to [LuaGuide] for an introduction into gears.
    41 
     5 
    42 <wiki:toc max_depth="3"/>
     6 <wiki:toc max_depth="3"/>
    43 
     7 
    44 == Functions for creating gears ==
     8 == Creation ==
    45 
     9 
    46 === `AddGear(x, y, gearType, state, dx, dy, timer)` ===
    10 === `AddGear(x, y, gearType, state, dx, dy, timer)` ===
    47 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]).  Gears are dynamic objects or events in the world that affect the gameplay, including hedgehogs, projectiles, weapons, land objects, active utilities and a few more esoteric things.
    11 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]).  Gears are dynamic objects or events in the world that affect the gameplay, including hedgehogs, projectiles, weapons, land objects, active utilities and a few more esoteric things.
    48 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].
    12 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].
    49 
    13 
   149 Same as `SpawnFakeAmmoCrate`, except the crate will look like a health crate.
   113 Same as `SpawnFakeAmmoCrate`, except the crate will look like a health crate.
   150 
   114 
   151 === `SpawnFakeUtilityCrate(x, y, explode, poison) ` ===
   115 === `SpawnFakeUtilityCrate(x, y, explode, poison) ` ===
   152 Same as `SpawnFakeAmmoCrate`, except the crate will look like an utility crate.
   116 Same as `SpawnFakeAmmoCrate`, except the crate will look like an utility crate.
   153 
   117 
   154 == Functions to get and set gear properties ==
   118 == Position and velocity ==
       
   119 === `GetGearPosition(gearUid)` ===
       
   120 Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`.
       
   121 
       
   122 === `GetX(gearUid)` ===
       
   123 Returns x coordinate of the gear.
       
   124 
       
   125 === `GetY(gearUid)` ===
       
   126 Returns y coordinate of the gear.
       
   127 
       
   128 === `SetGearPosition(gearUid, x, y)` ===
       
   129 Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`.
       
   130 
       
   131 === `GetGearVelocity(gearUid)` ===
       
   132 Returns a tuple of dx,dy values for the specified gear.
       
   133 
       
   134 === `SetGearVelocity(gearUid, dx, dy)` ===
       
   135 Gives the specified gear the velocity of `dx`, `dy`.
       
   136 
       
   137 === `CopyPV(gearUid, gearUid)` ===
       
   138 This sets the position and velocity of the second gear to the first one.
       
   139 
       
   140 === `FindPlace(gearUid, fall, left, right[, tryHarder])` ===
       
   141 Finds a place for the specified gear between x=`left` and x=`right` and places it there. `tryHarder` is optional, setting it to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
       
   142 
       
   143 Example:
       
   144 
       
   145 <code language="lua">    gear = AddGear(...)
       
   146     FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
       
   147 
       
   148 == General gear properties ==
   155 
   149 
   156 === `GetGearType(gearUid)` ===
   150 === `GetGearType(gearUid)` ===
   157 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   151 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   158 
   152 
   159 === `GetVisualGearType(vgUid)` (0.9.23) ===
   153 === `GetVisualGearType(vgUid)` (0.9.23) ===
   466 
   460 
   467 <code language="lua">
   461 <code language="lua">
   468 SetGearAIHints(uselessHog, aihDoesntMatter)
   462 SetGearAIHints(uselessHog, aihDoesntMatter)
   469 -- This makes AI hogs stop caring about attacking uselessHog</code>
   463 -- This makes AI hogs stop caring about attacking uselessHog</code>
   470 
   464 
   471 == Position and velocity ==
   465 == Hedgehog-specific gear properties ==
   472 === `GetGearPosition(gearUid)` ===
       
   473 Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`.
       
   474 
       
   475 === `GetX(gearUid)` ===
       
   476 Returns x coordinate of the gear.
       
   477 
       
   478 === `GetY(gearUid)` ===
       
   479 Returns y coordinate of the gear.
       
   480 
       
   481 === `SetGearPosition(gearUid, x, y)` ===
       
   482 Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`.
       
   483 
       
   484 === `GetGearVelocity(gearUid)` ===
       
   485 Returns a tuple of dx,dy values for the specified gear.
       
   486 
       
   487 === `SetGearVelocity(gearUid, dx, dy)` ===
       
   488 Gives the specified gear the velocity of `dx`, `dy`.
       
   489 
       
   490 === `CopyPV(gearUid, gearUid)` ===
       
   491 This sets the position and velocity of the second gear to the first one.
       
   492 
       
   493 === `FindPlace(gearUid, fall, left, right[, tryHarder])` ===
       
   494 Finds a place for the specified gear between x=`left` and x=`right` and places it there. `tryHarder` is optional, setting it to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
       
   495 
       
   496 Example:
       
   497 
       
   498 <code language="lua">    gear = AddGear(...)
       
   499     FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
       
   500 
       
   501 == Hedgehog-specific functions ==
       
   502 === `GetHogName(gearUid)` ===
   466 === `GetHogName(gearUid)` ===
   503 Returns the name of the specified hedgehog gear.
   467 Returns the name of the specified hedgehog gear.
   504 
   468 
   505 === `SetHogName(gearUid, name)` ===
   469 === `SetHogName(gearUid, name)` ===
   506 Sets the name of the specified hedgehog gear.
   470 Sets the name of the specified hedgehog gear.
   643 
   607 
   644 <code language="lua">HogSay(CurrentHedgehog, "I wonder what to do …", SAY_THINK) -- thought bubble with text “I wonder what to do …”</code>
   608 <code language="lua">HogSay(CurrentHedgehog, "I wonder what to do …", SAY_THINK) -- thought bubble with text “I wonder what to do …”</code>
   645 <code language="lua">HogSay(CurrentHedgehog, "I'm hungry.", SAY_SAY) -- speech bubble with text “I’m hungry.”</code>
   609 <code language="lua">HogSay(CurrentHedgehog, "I'm hungry.", SAY_SAY) -- speech bubble with text “I’m hungry.”</code>
   646 <code language="lua">HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text “I smell CAKE!”</code>
   610 <code language="lua">HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text “I smell CAKE!”</code>
   647 
   611 
   648 == Functions to delete gears ==
   612 == Deletion ==
   649 === `DeleteGear(gearUid)` ===
   613 === `DeleteGear(gearUid)` ===
   650 Deletes a gear.  If the specified gear did not exist, nothing happens.
   614 Deletes a gear.  If the specified gear did not exist, nothing happens.
   651 
   615 
   652 Example:
   616 Example:
   653 
   617