Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,120 changes: 2,047 additions & 73 deletions _data/stdlib_index.json

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions _doc/stdlib/ref/_handles/Unit.md
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,8 @@ public function unit.setPathing(boolean value)
public function unit.setPos(vec2 pos)
```

> 🔧 **Configurable.** Override it in your map's config package.

### unit.setPosFly

```wurst
Expand All @@ -1046,6 +1048,8 @@ public function unit.setPosReal(vec3 pos)
public function unit.setPos(real x, real y)
```

> 🔧 **Configurable.** Override it in your map's config package.

### unit.setPropWindow

```wurst
Expand Down Expand Up @@ -1129,12 +1133,16 @@ public function unit.setVertexColor(int r, int g, int b, int a)
public function unit.setX(real x)
```

> 🔧 **Configurable.** Override it in your map's config package.

### unit.setXY

```wurst
public function unit.setXY(vec2 pos)
```

> 🔧 **Configurable.** Override it in your map's config package.

Sets the coordinmates of the unit to the given position.
Uses the SetUnitX/Y natives

Expand All @@ -1144,6 +1152,8 @@ Sets the coordinmates of the unit to the given position.
public function unit.setXY(vec3 pos)
```

> 🔧 **Configurable.** Override it in your map's config package.

Sets the coordinmates of the unit to the given position.
Uses the SetUnitX/Y natives

Expand All @@ -1153,6 +1163,8 @@ Sets the coordinmates of the unit to the given position.
public function unit.setXYZ(vec3 pos)
```

> 🔧 **Configurable.** Override it in your map's config package.

Sets the coordinmates of the unit to the given position.
Z is being set as flyheight. Uses the SetUnitX/Y natives

Expand All @@ -1162,12 +1174,16 @@ Sets the coordinmates of the unit to the given position.
public function unit.setXYZReal(vec3 pos)
```

> 🔧 **Configurable.** Override it in your map's config package.

### unit.setY

```wurst
public function unit.setY(real y)
```

> 🔧 **Configurable.** Override it in your map's config package.

### unit.show

```wurst
Expand Down
11 changes: 11 additions & 0 deletions _doc/stdlib/ref/_wurst/Annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ generated: true
toc: sections
---

Marks a documented declaration whose calls are expanded by the compiler.

Unlike a normal fallback declaration, this does not suppress intrinsic lowering. The declaration
exists so intrinsic APIs remain visible to completion, navigation, and documentation tools.

**[Source on GitHub](https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/_wurst/Annotations.wurst)**

## Functions
Expand Down Expand Up @@ -55,6 +60,12 @@ public function compiletimenative()

Functions annotated with @compiletimenative are natives that are only available at compiletime, but not ingame.

### compilerintrinsic

```wurst
public function compilerintrinsic()
```

### configurable

```wurst
Expand Down
84 changes: 84 additions & 0 deletions _doc/stdlib/ref/_wurst/MagicFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,34 @@ The called functions must not take any parameters.

**[Source on GitHub](https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/_wurst/MagicFunctions.wurst)**

## Interfaces

### WurstFieldCallback

```wurst
public interface WurstFieldCallback
```

Tooling signature used by the field-iteration compiler intrinsics.
The compiler specializes `value` to the concrete type of each visited field.

**Members:**

- `apply(string fieldName, int value)`

### WurstFieldMapper

```wurst
public interface WurstFieldMapper
```

Tooling signature used by the field-mapping compiler intrinsic.
The compiler specializes both the parameter and result to each concrete field type.

**Members:**

- `apply(string fieldName, int value) returns int`

## Functions

### compileError
Expand Down Expand Up @@ -75,6 +103,62 @@ public function compiletime<T:>(T expr) returns T
This is a builtin magic function.
* It evaluates it's argument at compiletime and replaces the call with the result.

### wurstForFields

```wurst
public function wurstForFields(WurstFieldCallback _callback)
```

Emits the callback once for every accessible non-static field of the enclosing class.

The callback receives the source field name and its concrete value. This is compile-time code
generation: the generated Jass or Lua contains direct field accesses and no runtime reflection.
Use the explicit-target form `wurstForFields(target, callback)` for classes and tuples.

### wurstForFields

```wurst
public function wurstForFields<T:>(T _target, WurstFieldCallback _callback)
```

Emits the callback once for every accessible non-static field of `target`.

This overload supports class instances and tuple values. The target expression is evaluated
once, and the compiler specializes the callback value to each field's concrete type.

### wurstMapFields

```wurst
public function wurstMapFields(WurstFieldMapper _callback)
```

Maps every accessible mutable non-static field of the enclosing class.

Each callback result is assigned back to its field. Use the explicit-target form
`wurstMapFields(target, callback)` for classes and tuple variables.

### wurstMapFields

```wurst
public function wurstMapFields<T:>(T _target, WurstFieldMapper _callback)
```

Maps every accessible mutable non-static field of `target`.

This overload supports class instances and tuple variables. The target expression is evaluated
once, and each specialized callback result is assigned directly back to its field.

### wurstNewInstance

```wurst
public function wurstNewInstance<T:>() returns T
```

Constructs the concrete class `T` through its accessible zero-argument constructor.

This is an intrinsic rather than runtime reflection. Consequently `T` must be known concretely
at the call site and normal constructor visibility and abstract-class checks still apply.

## Constants

### compiletime
Expand Down
12 changes: 6 additions & 6 deletions _doc/stdlib/ref/closures/ClosureTimers.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ Execute an action periodically.

Example use:
```wurst
doPeriodically(0.5) cb ->
doPeriodically(0.5) (_) ->
if i > 10
destroy cb
destroy it
```

### doPeriodicallyCounted
Expand All @@ -157,7 +157,7 @@ execute an action periodically, with a limited amount of calls

Example use:
```wurst
doPeriodicallyCounted(0.5, 100) cb ->
doPeriodicallyCounted(0.5, 100) (_) ->
doSomething()
```

Expand Down Expand Up @@ -196,9 +196,9 @@ Execute an action periodically.

Example use:
```wurst
someTimer.doPeriodically(0.5) cb ->
someTimer.doPeriodically(0.5) (_) ->
if i > 10
destroy cb
destroy it
```

### timer.doPeriodicallyCounted
Expand All @@ -213,7 +213,7 @@ execute an action periodically, with a limited amount of calls

Example use:
```wurst
someTimer.doPeriodicallyCounted(0.5, 100) cb ->
someTimer.doPeriodicallyCounted(0.5, 100) (_) ->
doSomething()
```

Expand Down
27 changes: 27 additions & 0 deletions _doc/stdlib/ref/closures/SpatialIndexForDestructables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: SpatialIndexForDestructables
layout: stdlibref
category: closures
categoryLabel: Closures
tags:
- closures
source: 'https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/closures/SpatialIndexForDestructables.wurst'
generated: true
toc: sections
---

**[Source on GitHub](https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/closures/SpatialIndexForDestructables.wurst)**

## Functions

### destructablesInRect

```wurst
public function destructablesInRect(rect area) returns SparseSet<destructable>
```

### destructablesInRange

```wurst
public function destructablesInRange(vec2 center, real range) returns SparseSet<destructable>
```
11 changes: 10 additions & 1 deletion _doc/stdlib/ref/closures/SpatialIndexForUnits.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@ public function unitsInBox(vec2 boxMin, vec2 boxMax) returns SparseSet<unit>

Returns units whose origins are inside the axis-aligned box.

### unitsInRect

```wurst
public function unitsInRect(rect area) returns SparseSet<unit>
```

Returns units matching GroupEnumUnitsInRect semantics for the given rect.

### unitsOfPlayer

```wurst
public function unitsOfPlayer(player owner) returns SparseSet<unit>
```

Returns currently indexed units owned by owner.
Returns currently indexed units owned by owner. This is a linear registry scan; per-player
secondary sets are intentionally not maintained in this first iteration.
27 changes: 27 additions & 0 deletions _doc/stdlib/ref/data/IntMap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: IntMap
layout: stdlibref
category: data
categoryLabel: Data Structures
tags:
- data
source: 'https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/data/IntMap.wurst'
generated: true
toc: sections
---

O(1) integer-keyed map with compiler-specialized value storage.

JASS hashtables use integer child keys, so fixing the key type avoids an artificial generic
hash adapter while `V:` keeps strings, reals, booleans, handles, tuples, and class references
in typed arrays. Removal is unordered. The map does not own stored values.

**[Source on GitHub](https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/data/IntMap.wurst)**

## Classes

### IntMap

```wurst
public class IntMap<V:>
```
16 changes: 16 additions & 0 deletions _doc/stdlib/ref/data/SparseSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ IDs. That matches native groups: membership is not automatically removed
when a unit is deindexed. SparseSet validates the stored unit when a key is
reused, so a new unit cannot silently inherit stale membership.

### DestructableSparseSetKey

```wurst
public class DestructableSparseSetKey implements SparseSetKey<destructable>
```

Key provider for destructable sets.

## Interfaces

### SparseSetKey
Expand All @@ -65,3 +73,11 @@ public constant SparseSetKey<unit> UNIT_SPARSE_SET_KEY = new UnitSparseSetKey()
```

Reusable key provider for SparseSet<unit>.

### DESTRUCTABLE_SPARSE_SET_KEY

```wurst
public constant SparseSetKey<destructable> DESTRUCTABLE_SPARSE_SET_KEY = new DestructableSparseSetKey()
```

Reusable key provider for SparseSet<destructable>.
Loading