# HG changeset patch # User sheepyluva@gmail.com # Date 1386171928 0 # Node ID 315e9db1f4587b7925a70a86a307284bf29f3ce9 # Parent 2fcb523f0cc4ce0ac8af3f298668ecddc151c21a no need to prevent linking of names in code blocks diff -r 2fcb523f0cc4 -r 315e9db1f458 LuaAPI.wiki --- a/LuaAPI.wiki Wed Dec 04 13:11:28 2013 +0000 +++ b/LuaAPI.wiki Wed Dec 04 15:45:28 2013 +0000 @@ -128,9 +128,9 @@ Example: function onGearDamage(gear, damage) - if (!GetGearType(gear) == gtHedgehog) then + if (GetGearType(gear) == gtHedgehog) then -- adds a message saying, e.g. "Hoggy H took 25 points of damage" - !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage') + AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage') end end === onGearResurrect(gearUid) === @@ -262,8 +262,8 @@ Example: - local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0) - !FindPlace(gear, true, 0, LAND_WIDTH) + local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + FindPlace(gear, true, 0, LAND_WIDTH) === !AddVisualGear(x, y, visualGearType, state, critical) === @@ -272,7 +272,7 @@ Example: -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. - vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) + vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) === !SpawnHealthCrate(x, y) === @@ -285,16 +285,16 @@ Example: - !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below - !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map + SetAmmo(amGrenade, 0, 0, 0, 1) -- see below + SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map === !SpawnUtilityCrate(x, y, ammoType) ===
Spawns an utility crate at specified position with content of ammoType.
Example: - !SetAmmo(amLaserSight, 0, 0, 0, 1) - !SpawnUtilityCrate(0, 0, amLaserSight) + SetAmmo(amLaserSight, 0, 0, 0, 1) + SpawnUtilityCrate(0, 0, amLaserSight) === !AddTeam(teamname, color, grave, fort, voicepack, flag) ===
Adds a new team. Note that this can only be done in onGameInit(), not at a later time. First argument is the team name followed by color, grave, fort, voicepack and flag settings. @@ -303,7 +303,7 @@ Example: - !AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars") + AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars") === !AddHog(hogname, botlevel, health, hat) ===
Adds a new hedgehog for current team (last created one), with botlevel and specified health also head. @@ -312,8 +312,8 @@ Example: - local player = !AddHog("HH 1", 0, 100, "!NoHat") -- botlevel 0 means human player - !SetGearPosition(player, 1500, 1000) + local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player + SetGearPosition(player, 1500, 1000) == Functions to get gear properties == === !GetGearType(gearUid) === @@ -406,7 +406,7 @@
Example: - !GetVisualGearValues(vgUid) -- return visual gear values + GetVisualGearValues(vgUid) -- return visual gear values == Functions to modify gears == @@ -416,33 +416,33 @@
Removes a hedgehog from the map. The hidden hedgehog can be restored with !RestoreHog(gearUid). The current hedgehog cannot be hidden!
Example: - gear = !AddGear(...) - !HideHog(gear) -- Hide the newly created gear. + gear = AddGear(...) + HideHog(gear) -- Hide the newly created gear. === !RestoreHog(gearUid) ===
Restores a previously hidden hedgehog.
Example: - gear = !AddGear(...) - !HideHog(gear) -- Hide the newly created gear. - !RestoreHog(gear) -- Restore the newly hidden gear. + gear = AddGear(...) + HideHog(gear) -- Hide the newly created gear. + RestoreHog(gear) -- Restore the newly hidden gear. === !DeleteGear(gearUid) ===
Deletes a Gear
Example: - gear = !AddGear(...) - !DeleteGear(gear) -- Delete the newly created gear. + gear = AddGear(...) + DeleteGear(gear) -- Delete the newly created gear. === !DeleteVisualGear(vgUid) ===
Deletes a Visual Gear. Note, most visual gears delete themselves.
Example: - vgear = !AddVisualGear(...) - !DeleteVisualGear(vgear) -- Delete the newly created visual gear. + vgear = AddVisualGear(...) + DeleteVisualGear(vgear) -- Delete the newly created visual gear. === !SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) === @@ -453,7 +453,7 @@ Example: -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. - !SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) + SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) === !FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16) === @@ -462,17 +462,17 @@
Example: - gear = !AddGear(...) - !FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH + gear = AddGear(...) + FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH === !HogSay(gearUid, text, manner) ===
Makes the specified gear say, think, or shout some text in a bubble.
Example: - !HogSay(!CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text - !HogSay(!CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text - !HogSay(!CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text + HogSay(CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text + HogSay(CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text + HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text === !HogTurnLeft(gearUid, boolean) === @@ -480,8 +480,8 @@ Example: - !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left - !HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right + HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left + HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right === !SetGearPosition(gearUid, x, y) ===
Places the specified gear exactly at the position (x,y). @@ -496,8 +496,8 @@
Example: - !SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players - !SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade + SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players + SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade === !AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) ===
Adds ammoType to the specified gear. The amount added is determined by the arguments passed via !SetAmmo() in the onAmmoStoreInit() event handler. In 0.9.16 ammo can be set directly via the optional third parameter, ammoCount. A value of 0 will remove the weapon, a value of 100 will give infinite ammo. @@ -518,14 +518,14 @@ * (And more!) function onGearAdd(gear) - if (!GetGearType(gear) == gtRCPlaane) then - !SetHealth(gear, 10) + if (GetGearType(gear) == gtRCPlaane) then + SetHealth(gear, 10) end - if (!GetGearType(gear) == gtJetpack) then - !SetHealth(gear, 1000) + if (GetGearType(gear) == gtJetpack) then + SetHealth(gear, 1000) end - if (!GetGearType(gear) == gtMine) then - !SetHealth(gear, 0) + if (GetGearType(gear) == gtMine) then + SetHealth(gear, 0) end end @@ -539,8 +539,8 @@ Example: (sets all bots poisoned) function onGearAdd(gear) - if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then - !SetEffect(gear, hePoisoned, true) + if (GetGearType(gear) == gtHedgehog) and (GetBotLevel(gear) > 0) then + SetEffect(gear, hePoisoned, true) end end