GearTypes.wiki
changeset 879 b82b228bd0f1
parent 857 ca7261b5c679
child 880 edb64d05684e
--- a/GearTypes.wiki	Sat Apr 23 23:59:24 2016 +0100
+++ b/GearTypes.wiki	Wed Apr 27 00:17:03 2016 +0100
@@ -108,11 +108,31 @@
 ==== `gtCase` ====
 An ammo, utility or health crate.
 
- * `Pos`: Crate type: 1=ammo crate, 2=health crate, 4=utility crate
+If the crate has just been collected, the gear state flag `gmDestroy` will be set before `onGearDelete` is called.
+
+ * `Pos`: Crate type: 1=ammo crate, 2=health crate, 4=utility crate (also see below)
  * `Tag`: Used for the appear animation
  * `Health`: Amount of health contained in a health crate
  * `Boom`: Explosion size and damage (default: 25)
 
+We recommend you to use `SpawnAmmoCrate` and the like to crate crate gears instead of `AddGear`. Also note that `SpawnAmmoCrate` and `SpawnUtilityCrate` are the only way to set a crate's ammo in Lua, it can not be changed or read afterwards.
+
+Advanced crate types: If you just care about normal crates, the values 1, 2 and 4 mentioned above are all you need to know. Hedgewars supports a few crate variants which can be spawned with `SpawnFakeAmmoCrate` and the like. The `Pos` parameter is in reality a sum of several flags which need to be added up for the final type.
+|| *Pos flag* || *Meaning* ||
+|| `0x1` || Ammo crate ||
+|| `0x2` || Health crate ||
+|| `0x4` || Utility crate ||
+|| `0x8` || Fake crate, looks like a normal crate but does not actually contain health or ammo ||
+|| `0x10` || Cate has a booby trap, when the player collects this crate it will explode ||
+|| `0x20` || Poison trap: When the player collects this crate the player will be poisoned ||
+
+All crates *must* have exactly one of the flags `0x1`, `0x2` or `0x4` set. Everything else can be combined at will.
+
+Examples:
+* Pos = 0x1: Ammo crate
+* Pos = 0x9: Fake ammo crate (0x1 + 0x8)
+* Pos = 0x2A: Fake health crate with poison trap (0x2 + 0x8 + 0x20)
+
 ==== `gtExplosives` ====
 An explosive barrel. It has its own invisible health, like a hedgehog. On low health levels smoke comes out of the barrel.
 
@@ -200,12 +220,14 @@
 
  * `X` and `Y`: Position of the nearest “bending point” of the rope (nearest to the rope gun), or the rope hook if rope does not touch anything
  * `dX`: sine of rope angle, number between -1000000 and 1000000 (correspond to -180° to 180°)
- * `dY`: negative cosine of rope angle, expressed as number between 0 and 10000000
+ * `dY`: negative cosine of rope angle, expressed as number between 0 and 1000000
  * `Elasticity`: If the hog is attached to a rope, or is busy firing one, the elasticity of the rope will be non-rezo. A non-zero number holds the current retracted length of the rope from the nearest “bending point” or the hook, times 10000
  * `Friction`: Holds the maximum remaning length of the rope measured from the nearest “bending point” or the hook, times 10000. Set this after rope creation to manually set the rope length individually. Note you can set `RopePercent` in `onGameInit` to set the rope length for all ropes at once
  * `Tag` Rope style: `0`=classic white segments (default), `1`=simple line which can be colored with `Tint`.
  * `Tint`: Rope color as RGBA. This only works if `Tag` equals `1`
 
+Note: `dX` and `dY` are returned by the `GetGearVelocity` function.
+
 ==== `gtSwitcher` ====
 Switch hedgehog.