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> === |
|
70 |
|
71 <blockquote>This function is called when a gear is damaged. |
|
72 </blockquote> |
|
73 Notice: Lua is case-sensitive. The 'O' in 'OnGearDamage' needs to be big, or Hedgewars won't pick up this function call. This unusual capitalisation will probably be fixed in 0.9.15. |
|
74 |
|
75 Example: |
|
76 |
|
77 <code lang="lua"> function onGearDamage(gear, damage) |
|
78 if (!GetGearType(gear) == gtHedgehog) then |
|
79 -- adds a message saying, e.g. "Hoggy H took 25 points of damage" |
|
80 !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage') |
|
81 end |
|
82 end</code> |
69 === <tt>onGearResurrect(gearUid)</tt> === |
83 === <tt>onGearResurrect(gearUid)</tt> === |
70 |
84 |
71 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect. |
85 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect. |
72 </blockquote> |
86 </blockquote> |
73 === <tt>onAmmoStoreInit()</tt> === |
87 === <tt>onAmmoStoreInit()</tt> === |