Found a bug in lua syncedctrl cloaking

Found a bug in lua syncedctrl cloaking

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Found a bug in lua syncedctrl cloaking

Post by Forboding Angel »

This is current engine version.
Wiki wrote: Unit LOS

Spring.SetUnitCloak

( number unitID,
boolean cloaked | number scriptCloak,
[ number decloakDistance | boolean decloakAbs ] ) -> nil


If the 2nd argument is a number, the value works like this:
1:=normal cloak
2:=for free cloak (cost no E)
3:=for free + no decloaking (except the unit is stunned)
4>=ultimative cloak (no ecost, no decloaking, no stunned decloak)

The decloak distance is only changed if the 3th argument is a number or a boolean.
If the boolean is false it takes the default decloak distance for that unitdef,
if the boolean is true it takes the absolute value of it.
I am using cloak 2, and for whatever reason, if the unit has a cloak cost defined, that cost is deducted when this ctrl is initiated.

1 should do that, but not 2 3 or 4.

To reproduce, load up evo 1.6 on a map with trees, move an all terrain unit into the trees and you will be charged -2 energy for the entire time that that unit spends being cloaked.
Post Reply

Return to “Engine”