As the new patch has hit earlier in April, we have implemented the necessary changes to support it in our toolchain, while still keeping backwards compatibility alive.
WurstExportedObjects
again, for easier transfer to generated objectsor
in Wursts Jass parsing is now correctStandard Library
Wurst now supports a limited variant of variable argument functions. Variable arguments can only be iterated over and not directly accessed, neither the amount.
Declaration:
function sum(vararg int ints)
var result = 0
for i in ints
result += i
print(result.toString())
Usage:
sum(1,2,3,4)
sum(14,22)
sum(23,52,5234,5,5)
Several functions in the standard library are now implemented via varargs, and as such, offer variable argument functionality, for example id-lists for object editing and groups:
@compiletime function genBuilder()
new UnitObjDefinition('buil', 'hfoo')
..setNormalAbilities(asList(ID_FIREBALL, ID_FIRE_NOVA))
..setStructuresBuilt(asList(ID_GUARD_TOWER, ID_CANNON_TOWER))
init
CreateGroup().addUnit(u1, u2, u3)
Additionally asList
is now available to inline create LinkedLists of elements
asList("This", "will", "be", "a", "list")
asList(75., 125., 175.).add(250., 375.)
asList(players[0], players[1], players[2], players[3])
Want to be most efficient with wurst? Under the ‘Protip’ slogan we will regularly feature ways or products to improve your workflow:
vec2
and vec3
vector tuples which, unlike classes, don’t have an identity and therefore are translated with zero overhead. This means you get the speed of using coordinates directly, but the comfort of class-like syntax and functionality.Some common uses:
// Event response
getSpellTargetPos() // instead of GetSpellTargetX/Y
getOrderPos() // instead of GetOrderPointX/Y
getOrderTargetPos() // instead of GetWidgetX(GetOrderTarget()) etc.
// As class member, e.g. position, velocity
class A
vec2 position
// Angle between points & Polar projection
function onEvent()
let casterPos = GetTriggerUnit().getPos()
let angl = casterPos.angleTo(getSpellTargetPos())
flashEffect(Objects.impaleTargetDust, casterPos.polarOffset(angl, 256.))
You will notice that many extension functions also expect vector tuples as arguments, making them even more seamless to use.
Cheers Frotty