LuaGears.wiki
changeset 1780 1b7b2e1ea829
parent 1759 6725a497c482
child 1781 2d057448d499
equal deleted inserted replaced
1779:9cb32a3519ee 1780:1b7b2e1ea829
   326 Example: 
   326 Example: 
   327 
   327 
   328 <code language="lua">    gear = AddGear(...)
   328 <code language="lua">    gear = AddGear(...)
   329      HideHog(gear) -- Hide the newly created gear.
   329      HideHog(gear) -- Hide the newly created gear.
   330      RestoreHog(gear) -- Restore the newly hidden gear.</code>
   330      RestoreHog(gear) -- Restore the newly hidden gear.</code>
   331 
       
   332 === <tt>!DeleteGear(gearUid)</tt> ===
       
   333 Deletes a gear.  If the specified gear did not exist, nothing happens.
       
   334 
       
   335 Example:
       
   336 
       
   337 <code language="lua">    gear = AddGear(...)
       
   338     DeleteGear(gear) -- Delete the newly created gear.</code>
       
   339 
       
   340 === <tt>!DeleteVisualGear(vgUid)</tt> ===
       
   341 Deletes a visual gear.  If it does not exist, nothing happens. 
       
   342 
       
   343 Note, most visual gears delete themselves after a while.
       
   344 
       
   345 
       
   346 
       
   347 Example:
       
   348 
       
   349 <code language="lua">    vgear = AddVisualGear(...)
       
   350     DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
       
   351 
       
   352 === <tt>!SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom)</tt> ===
       
   353 Sets various gear value for the specified gear (`gearUid`). The meaining of each value often depends on the gear type. See the documentation on !GetGearValues for a brief description of the gear values. If `gearUid` is invalid or the gear does not exist, nothing happens.
       
   354 
       
   355 Set `nil` for each value you do not want to change.
       
   356 
       
   357 Example:
       
   358 <code language="lua">
       
   359 -- Paints all RC planes into a white color
       
   360 function onGearAdd(gear)
       
   361     if GetGearType(gear) == gtRCPlane then
       
   362          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
       
   363     end
       
   364 end
       
   365 </code>
       
   366 
   331 
   367 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale)</tt> ===
   332 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale)</tt> ===
   368 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   333 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   369 
   334 
   370 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   335 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   623 -- This makes AI hogs stop caring about attacking uselessHog</code>
   588 -- This makes AI hogs stop caring about attacking uselessHog</code>
   624 
   589 
   625 === <tt>!SetGearPos(gearUid, value)</tt> ===
   590 === <tt>!SetGearPos(gearUid, value)</tt> ===
   626 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information.
   591 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information.
   627 
   592 
       
   593 == Functions to delete gears ==
       
   594 === <tt>!DeleteGear(gearUid)</tt> ===
       
   595 Deletes a gear.  If the specified gear did not exist, nothing happens.
       
   596 
       
   597 Example:
       
   598 
       
   599 <code language="lua">    gear = AddGear(...)
       
   600     DeleteGear(gear) -- Delete the newly created gear.</code>
       
   601 
       
   602 === <tt>!DeleteVisualGear(vgUid)</tt> ===
       
   603 Deletes a visual gear.  If it does not exist, nothing happens. 
       
   604 
       
   605 Note, most visual gears delete themselves after a while.
       
   606 
       
   607 
       
   608 
       
   609 Example:
       
   610 
       
   611 <code language="lua">    vgear = AddVisualGear(...)
       
   612     DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
       
   613 
       
   614 === <tt>!SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom)</tt> ===
       
   615 Sets various gear value for the specified gear (`gearUid`). The meaining of each value often depends on the gear type. See the documentation on !GetGearValues for a brief description of the gear values. If `gearUid` is invalid or the gear does not exist, nothing happens.
       
   616 
       
   617 Set `nil` for each value you do not want to change.
       
   618 
       
   619 Example:
       
   620 <code language="lua">
       
   621 -- Paints all RC planes into a white color
       
   622 function onGearAdd(gear)
       
   623     if GetGearType(gear) == gtRCPlane then
       
   624          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
       
   625     end
       
   626 end
       
   627 </code>
       
   628