# HG changeset patch # User Wuzzy # Date 1555507577 -3600 # Node ID be31df3b4e3d04174256aa3ebbccd74ede2b5488 # Parent 014d1a4a2133337bb8c040e99920fa6f74ef73c0 Sandbox: Update AddGear diff -r 014d1a4a2133 -r be31df3b4e3d Sandbox.wiki --- a/Sandbox.wiki Wed Apr 17 14:20:56 2019 +0100 +++ b/Sandbox.wiki Wed Apr 17 14:26:17 2019 +0100 @@ -13,13 +13,16 @@ === `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]). -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]. +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]. `timer` is the initial timer value of the gear. If a particular gear value does not matter, use `0`. + +Position, velocity, state and timer can be changed afterwards with the various setter functions. Note: If you want to create a hedgehog (`gtHedgehog`), you must call `AddHog` or `AddMissionHog` instead. If you want to spawn a crate (`gtCase`), you must call one of the several “Spawn*Crate” functions (e.g. `SpawnSupplyCrate`) below instead. Example: - local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + -- Spawn a target at (0,0) and place it randomly + local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) -- also use 0 for velocity. Also 0 for state and timer because they don't matter. FindPlace(gear, true, 0, LAND_WIDTH) === `AddVisualGear(x, y, visualGearType, state, critical [, layer])` ===