# HG changeset patch # User Wuzzy # Date 1555506870 -3600 # Node ID ac1adfc740c77f2adc1e3d247e9175afa5411ec6 # Parent 006999425a5cfce93c4198a69dbef1094d4ba2a1 Sandbox: Edited via web interface diff -r 006999425a5c -r ac1adfc740c7 Sandbox.wiki --- a/Sandbox.wiki Wed Apr 17 14:10:20 2019 +0100 +++ b/Sandbox.wiki Wed Apr 17 14:14:30 2019 +0100 @@ -1,39 +1,3 @@ -#summary Sandbox page for testing the wiki syntax - -= Sandbox = -This is a sandbox page to test the wiki syntax. - -== Header 2 == - -== Header 2 == - -== Header 2 == - -== Header 3 == - -== Header 4 == - -== Header 5 == - -== Links == - - * [Sandbox#Header_2 Link to Header 2 (first one)] - * [Sandbox#Header_2__2 Link to Header 2 (second one)] - * [Sandbox#Header_2__3 Link to Header 2 (third one)] - - -== Bullets == - - * Bullet1 - * Bullet1 - * Bullet 2 - * Bullet 2 - * Bullet 3 - * Bullet 3 - * Bullet 2 - ---- - #summary List of gear-related functions in the Lua API = Lua API: Gear functions = @@ -41,7 +5,7 @@ -== Functions for creating gears == +== Creation == === `AddGear(x, y, gearType, state, dx, dy, timer)` === 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. @@ -151,7 +115,37 @@ === `SpawnFakeUtilityCrate(x, y, explode, poison) ` === Same as `SpawnFakeAmmoCrate`, except the crate will look like an utility crate. -== Functions to get and set gear properties == +== Position and velocity == +=== `GetGearPosition(gearUid)` === +Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`. + +=== `GetX(gearUid)` === +Returns x coordinate of the gear. + +=== `GetY(gearUid)` === +Returns y coordinate of the gear. + +=== `SetGearPosition(gearUid, x, y)` === +Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`. + +=== `GetGearVelocity(gearUid)` === +Returns a tuple of dx,dy values for the specified gear. + +=== `SetGearVelocity(gearUid, dx, dy)` === +Gives the specified gear the velocity of `dx`, `dy`. + +=== `CopyPV(gearUid, gearUid)` === +This sets the position and velocity of the second gear to the first one. + +=== `FindPlace(gearUid, fall, left, right[, tryHarder])` === +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. + +Example: + + gear = AddGear(...) + FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH + +== General gear properties == === `GetGearType(gearUid)` === This function returns the [GearTypes gear type] for the specified gear, if it exists. If it doesn't exist, `nil` is returned. @@ -468,37 +462,7 @@ SetGearAIHints(uselessHog, aihDoesntMatter) -- This makes AI hogs stop caring about attacking uselessHog -== Position and velocity == -=== `GetGearPosition(gearUid)` === -Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`. - -=== `GetX(gearUid)` === -Returns x coordinate of the gear. - -=== `GetY(gearUid)` === -Returns y coordinate of the gear. - -=== `SetGearPosition(gearUid, x, y)` === -Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`. - -=== `GetGearVelocity(gearUid)` === -Returns a tuple of dx,dy values for the specified gear. - -=== `SetGearVelocity(gearUid, dx, dy)` === -Gives the specified gear the velocity of `dx`, `dy`. - -=== `CopyPV(gearUid, gearUid)` === -This sets the position and velocity of the second gear to the first one. - -=== `FindPlace(gearUid, fall, left, right[, tryHarder])` === -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. - -Example: - - gear = AddGear(...) - FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH - -== Hedgehog-specific functions == +== Hedgehog-specific gear properties == === `GetHogName(gearUid)` === Returns the name of the specified hedgehog gear. @@ -645,7 +609,7 @@ HogSay(CurrentHedgehog, "I'm hungry.", SAY_SAY) -- speech bubble with text “I’m hungry.” HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text “I smell CAKE!” -== Functions to delete gears == +== Deletion == === `DeleteGear(gearUid)` === Deletes a gear. If the specified gear did not exist, nothing happens.