# HG changeset patch # User Wuzzy # Date 1555504386 -3600 # Node ID 1b7b2e1ea82919104254920e450e96b743b25114 # Parent 9cb32a3519ee19e37611be76f1df6644c64d71a2 LuaGears: Add deletion section diff -r 9cb32a3519ee -r 1b7b2e1ea829 LuaGears.wiki --- a/LuaGears.wiki Wed Apr 17 13:29:48 2019 +0100 +++ b/LuaGears.wiki Wed Apr 17 13:33:06 2019 +0100 @@ -329,41 +329,6 @@ HideHog(gear) -- Hide the newly created gear. RestoreHog(gear) -- Restore the newly hidden gear. -=== !DeleteGear(gearUid) === -Deletes a gear. If the specified gear did not exist, nothing happens. - -Example: - - gear = AddGear(...) - DeleteGear(gear) -- Delete the newly created gear. - -=== !DeleteVisualGear(vgUid) === -Deletes a visual gear. If it does not exist, nothing happens. - -Note, most visual gears delete themselves after a while. - - - -Example: - - vgear = AddVisualGear(...) - DeleteVisualGear(vgear) -- Delete the newly created visual gear. - -=== !SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom) === -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. - -Set `nil` for each value you do not want to change. - -Example: - --- Paints all RC planes into a white color -function onGearAdd(gear) - if GetGearType(gear) == gtRCPlane then - SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) - end -end - - === !SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale) === 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. @@ -625,3 +590,39 @@ === !SetGearPos(gearUid, value) === Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information. +== Functions to delete gears == +=== !DeleteGear(gearUid) === +Deletes a gear. If the specified gear did not exist, nothing happens. + +Example: + + gear = AddGear(...) + DeleteGear(gear) -- Delete the newly created gear. + +=== !DeleteVisualGear(vgUid) === +Deletes a visual gear. If it does not exist, nothing happens. + +Note, most visual gears delete themselves after a while. + + + +Example: + + vgear = AddVisualGear(...) + DeleteVisualGear(vgear) -- Delete the newly created visual gear. + +=== !SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom) === +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. + +Set `nil` for each value you do not want to change. + +Example: + +-- Paints all RC planes into a white color +function onGearAdd(gear) + if GetGearType(gear) == gtRCPlane then + SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) + end +end + +