equal
deleted
inserted
replaced
64 === <tt>onGearDelete(gearUid)</tt> === |
64 === <tt>onGearDelete(gearUid)</tt> === |
65 |
65 |
66 <blockquote>This function is called when a new gear is deleted. Useful in |
66 <blockquote>This function is called when a new gear is deleted. Useful in |
67 combination with <tt>!GetGearType(gearUid)</tt>. |
67 combination with <tt>!GetGearType(gearUid)</tt>. |
68 </blockquote> |
68 </blockquote> |
69 === <tt>OnGearDamage(gearUid, damage)</tt> === |
69 === <tt>onGearDamage(gearUid, damage)</tt> === |
70 |
70 |
71 <blockquote>This function is called when a gear is damaged. |
71 <blockquote>This function is called when a gear is damaged. |
72 </blockquote> |
72 </blockquote> |
73 Notice: Lua is case-sensitive. The 'O' in 'OnGearDamage' needs to be capitalised, or Hedgewars won't pick up this function call. This unusual capitalisation will probably be fixed in 0.9.15. |
73 Notice: Lua is case-sensitive. The 'O' in 'OnGearDamage' needs to be capitalised, or Hedgewars won't pick up this function call. This unusual capitalisation will probably be fixed in 0.9.15. |
74 |
74 |
75 Example: |
75 Example: |
76 |
76 |
77 <code lang="lua"> function OnGearDamage(gear, damage) |
77 <code lang="lua"> function !OnGearDamage(gear, damage) |
78 if (!GetGearType(gear) == gtHedgehog) then |
78 if (!GetGearType(gear) == gtHedgehog) then |
79 -- adds a message saying, e.g. "Hoggy H took 25 points of damage" |
79 -- adds a message saying, e.g. "Hoggy H took 25 points of damage" |
80 !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage') |
80 !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage') |
81 end |
81 end |
82 end</code> |
82 end</code> |