Skip to content
Merged
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 changes: 1 addition & 1 deletion wurst.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
projectName: Wurst Standard Library 2
dependencies: []
wc3Patch: v2.0
wc3Patch: v3.0
24 changes: 24 additions & 0 deletions wurst/_handles/Camera.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,27 @@ public function unit.setCameraOrientController(vec2 offset)

public function unit.setCameraOrientControllerForPlayer(vec2 offset, player whichPlayer)
SetCameraOrientControllerForPlayerBJ(whichPlayer, this, offset.x, offset.y)

public function setCameraType(int cameraType)
BlzCameraSetCameraType(cameraType)

public function getCameraType() returns int
return BlzCameraGetCameraType()

public function camerasetup.setCameraType(int cameraType)
BlzCameraSetupSetCameraType(this, cameraType)

public function camerasetup.getCameraType() returns int
return BlzCameraSetupGetCameraType(this)

public function camerafield.setControlledByInput(boolean controlled)
SetCameraFieldControlledByInput(this, controlled)

public function camerafield.isControlledByInput() returns boolean
return GetCameraFieldControlledByInput(this)

public function rect.addCameraBlocker()
AddCameraBlocker(this)

public function rect.setCameraBlockerEnabled(boolean enabled)
EnableCameraBlocker(this, enabled)
81 changes: 80 additions & 1 deletion wurst/_handles/Destructable.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,83 @@ import NoWurst
import Vectors

public function createDestructable(int id, vec3 pos, angle direction, real scale, int variation) returns destructable
return createDestructable(id, pos.toVec2(), direction, scale, variation)
return CreateDestructableZ(id, pos.x, pos.y, pos.z, direction.degrees(), scale, variation)

public function createDestructable(int id, vec2 pos, angle direction, real scale, int variation) returns destructable
return CreateDestructable(id, pos.x, pos.y, direction.degrees(), scale, variation)

public function createDestructable(int id, vec2 pos, angle direction, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDestructableWithColor(id, pos.x, pos.y, direction.degrees(), scale, variation, whichColor)

public function createDestructable(int id, vec3 pos, angle direction, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDestructableZWithColor(id, pos.x, pos.y, pos.z, direction.degrees(), scale, variation, whichColor)

public function createDestructable(int id, vec2 pos, angle direction, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDestructableWithSkinColor(id, pos.x, pos.y, direction.degrees(), scale, variation, skinId, whichColor)

public function createDestructable(int id, vec3 pos, angle direction, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDestructableZWithSkinColor(id, pos.x, pos.y, pos.z, direction.degrees(), scale, variation, skinId, whichColor)

public function createDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation) returns destructable
return BlzCreateDestructablePitchRoll(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation)
Comment thread
Frotty marked this conversation as resolved.

public function createDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation) returns destructable
return BlzCreateDestructableZPitchRoll(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation)

public function createDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDestructablePitchRollWithColor(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, whichColor)

public function createDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDestructableZPitchRollWithColor(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, whichColor)

public function createDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId) returns destructable
return BlzCreateDestructableWithSkinPitchRoll(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId)

public function createDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId) returns destructable
return BlzCreateDestructableZWithSkinPitchRoll(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId)

public function createDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDestructableWithSkinPitchRollColor(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId, whichColor)

public function createDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDestructableZWithSkinPitchRollColor(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId, whichColor)

public function createDeadDestructable(int id, vec2 pos, angle direction, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableWithColor(id, pos.x, pos.y, direction.degrees(), scale, variation, whichColor)

public function createDeadDestructable(int id, vec3 pos, angle direction, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableZWithColor(id, pos.x, pos.y, pos.z, direction.degrees(), scale, variation, whichColor)

public function createDeadDestructable(int id, vec2 pos, angle direction, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableWithSkinColor(id, pos.x, pos.y, direction.degrees(), scale, variation, skinId, whichColor)

public function createDeadDestructable(int id, vec3 pos, angle direction, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableZWithSkinColor(id, pos.x, pos.y, pos.z, direction.degrees(), scale, variation, skinId, whichColor)

public function createDeadDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation) returns destructable
return BlzCreateDeadDestructablePitchRoll(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation)

public function createDeadDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation) returns destructable
return BlzCreateDeadDestructableZPitchRoll(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation)

public function createDeadDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDeadDestructablePitchRollWithColor(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, whichColor)

public function createDeadDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableZPitchRollWithColor(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, whichColor)

public function createDeadDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId) returns destructable
return BlzCreateDeadDestructableWithSkinPitchRoll(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId)

public function createDeadDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId) returns destructable
return BlzCreateDeadDestructableZWithSkinPitchRoll(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId)

public function createDeadDestructable(int id, vec2 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableWithSkinPitchRollColor(id, pos.x, pos.y, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId, whichColor)

public function createDeadDestructable(int id, vec3 pos, angle direction, angle roll, angle pitch, real scale, int variation, int skinId, playercolor whichColor) returns destructable
return BlzCreateDeadDestructableZWithSkinPitchRollColor(id, pos.x, pos.y, pos.z, direction.degrees(), roll.degrees(), pitch.degrees(), scale, variation, skinId, whichColor)

public function destructable.getPos() returns vec2
return vec2(this.getX(), this.getY())

Expand Down Expand Up @@ -149,3 +221,10 @@ public function elevator.setHeight(int height)
if newHeight != oldHeight
this.elevatable.queueAnimation(animationQueue)

public function destructable.setColor(playercolor whichColor)
SetDestructableColor(this, whichColor)

public function destructable.setVertexColor(int red, int green, int blue, int alpha)
SetDestructableVertexColor(this, red, green, blue, alpha)


42 changes: 42 additions & 0 deletions wurst/_handles/Doodad.wurst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package Doodad
import NoWurst
import Vectors

/** A placed map doodad addressed by its zero-based map index. */
public tuple doodad(int index)

public function getDoodadCount() returns int
return BlzGetNumDoodads()

public function getDoodad(int index) returns doodad
return doodad(index)

public function doodad.getTypeId() returns int
return BlzGetDoodadId(this.index)

public function doodad.getVariation() returns int
return BlzGetDoodadVariation(this.index)

public function doodad.getPos() returns vec3
return vec3(BlzGetDoodadX(this.index), BlzGetDoodadY(this.index), BlzGetDoodadZ(this.index))

public function doodad.getScale() returns vec3
return vec3(BlzGetDoodadScaleX(this.index), BlzGetDoodadScaleY(this.index), BlzGetDoodadScaleZ(this.index))

public function doodad.getYaw() returns angle
return BlzGetDoodadYaw(this.index).fromRad()

public function doodad.getPitch() returns angle
return BlzGetDoodadPitch(this.index).fromRad()

public function doodad.getRoll() returns angle
return BlzGetDoodadRoll(this.index).fromRad()

public function doodad.isUsingModelAxes() returns boolean
return BlzGetDoodadIsUsingModelAxes(this.index)

public function doodad.setAnimation(string animation, boolean randomize)
BlzSetSingleDoodadAnimation(this.index, animation, randomize)

public function doodad.setColor(playercolor whichColor)
BlzSetSingleDoodadColor(this.index, whichColor)
11 changes: 11 additions & 0 deletions wurst/_handles/Effect.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,14 @@ public function effect.setScale(vec3 scaleVector)
public function effect.resetScale()
BlzResetSpecialEffectMatrix(this)

/** Immediately selects an animation by model sequence name. */
public function effect.setAnimation(string animation)
BlzSetSpecialEffectAnimation(this, animation)

/** Adds an animation by model sequence name to the effect's queue. */
public function effect.queueAnimation(string animation)
BlzQueueSpecialEffectAnimation(this, animation)

public function effect.setAnimationBlendTime(real blendTime)
BlzSetSpecialEffectAnimationBlendTime(this, blendTime)

11 changes: 11 additions & 0 deletions wurst/_handles/Framehandle.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,14 @@ public function framehandle.getChildrenCount() returns int
public function framehandle.getChild(int index) returns framehandle
return BlzFrameGetChild(this, index)

public function framehandle.setTextAreaAutoScroll(boolean enabled)
BlzTextAreaFrameSetAutoScroll(this, enabled)

/** Converts frame coordinates to window pixels. */
public function vec2.frameToPixel() returns vec2
return vec2(I2R(BlzFrameToPixelX(this.x)), I2R(BlzFrameToPixelY(this.y)))

/** Converts window pixels to frame coordinates. */
public function vec2.pixelToFrame() returns vec2
return vec2(BlzPixelToFrameX(R2I(this.x)), BlzPixelToFrameY(R2I(this.y)))

63 changes: 63 additions & 0 deletions wurst/_handles/Item.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,66 @@ public function item.setItemDropID(integer unitId)
public function item.blzSetItemSkin(integer skinId)
BlzSetItemSkin(this, skinId)

public function item.setColor(playercolor whichColor)
SetItemColor(this, whichColor)

public function item.getEquipmentType() returns equipmentType
return GetItemEquipmentType(this)

public function item.getTag() returns itemTag
return GetItemTag(this)

public function item.isEquipped() returns boolean
return IsItemEquipped(this)

public function item.isInBag() returns boolean
return IsItemInBag(this)

public function unit.equipItem(item whichItem) returns boolean
return UnitEquipItem(this, whichItem)

public function unit.unequipItem(item whichItem)
UnitUnequipItem(this, whichItem)

public function unit.unequipItem(loadoutslot slot) returns item
return UnitUnequipItemFromSlot(this, slot)

public function unit.getExtendedInventorySize() returns int
return UnitExtendedInventorySize(this)

public function unit.getItemInBagSlot(int slot) returns item
return UnitItemInBagSlot(this, slot)

public function unit.getItemInEquipmentSlot(loadoutslot slot) returns item
return UnitItemInEquipmentSlot(this, slot)

public function unit.hasItemBagged(item whichItem) returns boolean
return UnitHasItemBagged(this, whichItem)

public function unit.hasItemEquipped(item whichItem) returns boolean
return UnitHasItemEquipped(this, whichItem)

public function unit.isLoadoutSlotEmpty(loadoutslot slot) returns boolean
return UnitHasLoadoutSlotEmpty(this, slot)

/** Correctly-spelled wrapper for the native UnitHasAnyItemEquiped. */
public function unit.hasAnyItemEquipped() returns boolean
return UnitHasAnyItemEquiped(this)

public function unit.hasEquipmentType(equipmentType whichType) returns boolean
return UnitHasItemEquipmentOfType(this, whichType)

public function unit.canEquipItemOfType(equipmentType whichType) returns boolean
return UnitCanEquipItemOfEquipmentType(this, whichType)

public function itemtype.chooseRandomItem(int level, equipmentType whichEquipmentType, itemTag whichTag) returns int
return ChooseRandomItemExWithFilter(this, level, whichEquipmentType, whichTag)

/** Event response for an item-equipment event. */
public function getEquippedItem() returns item
return GetEquippedItem()

/** Event response for an item-unequipment event. */
public function getUnequippedItem() returns item
return GetUnequippedItem()

3 changes: 3 additions & 0 deletions wurst/_handles/Player.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,7 @@ public function player.hasVisibility(unit target) returns bool
public function player.hasVisibility(vec2 pos) returns bool
return IsVisibleToPlayer(pos.x, pos.y, this)

public function player.setRaceSkin(racepreference raceSkin)
SetPlayerRaceSkin(this, raceSkin)


23 changes: 23 additions & 0 deletions wurst/_handles/Trigger.wurst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Trigger
import NoWurst
import Vectors

/**
Metakey is an integer based native parameter which is used as a bitfield.
Expand Down Expand Up @@ -177,3 +178,25 @@ public function trigger.registerUpgradeCommandEvent(integer whichUpgrade) return
public function trigger.blzTriggerRegisterPlayerSyncEvent(player whichPlayer, string prefix, boolean fromServer) returns event
return BlzTriggerRegisterPlayerSyncEvent(this, whichPlayer, prefix, fromServer)

public function trigger.isRunning() returns boolean
return BlzTriggerIsRunning(this)

public function trigger.interrupt()
BlzTriggerInterrupt(this)

/** Returns local input state. Never use it to drive synchronized game state. */
public function oskeytype.isPressed() returns boolean
return BlzIsKeyPressed(this)

/** Returns local input state. Never use it to drive synchronized game state. */
public function OSKEY_META.isPressed() returns boolean
return BlzIsMetaKeyPressed(this.toInt())

/** Returns local input state. Never use it to drive synchronized game state. */
public function mousebuttontype.isPressed() returns boolean
return BlzIsMouseButtonPressed(this)

/** Returns the local mouse position in window pixels. */
public function getMouseScreenPosition() returns vec2
return vec2(I2R(BlzGetMouseScreenPosX()), I2R(BlzGetMouseScreenPosY()))

36 changes: 36 additions & 0 deletions wurst/_handles/Unit.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -1079,3 +1079,39 @@ public function unit.clearOrders(boolean onlyQueued)
public function unit.forceStopOrder(boolean clearQueue)
BlzUnitForceStopOrder(this, clearQueue)

public function unit.setAbilityCooldownPercent(int abilityId, real percent)
BlzSetUnitAbilityCooldownPercent(this, abilityId, percent)

public function unit.adjustAbilityCooldownPercent(int abilityId, real percent)
BlzAdjustUnitAbilityCooldownPercent(this, abilityId, percent)

public function unit.getAbilityCooldownPercent(int abilityId) returns real
return BlzGetUnitAbilityCooldownPercent(this, abilityId)

public function unit.setAbilityCooldownRemaining(int abilityId, real duration)
BlzSetUnitAbilityCooldownRemaining(this, abilityId, duration)

public function unit.adjustAbilityCooldownRemaining(int abilityId, real duration)
BlzAdjustUnitAbilityCooldownRemaining(this, abilityId, duration)

public function unit.getAnimationDuration(string animation) returns real
return BlzGetUnitAnimationDuration(this, animation)

public function unit.getAnimationDuration(int animationIndex) returns real
return BlzGetUnitAnimationDurationByIndex(this, animationIndex)

public function unit.resetAttack(int weaponIndex)
BlzResetUnitAttack(this, weaponIndex)

public function unit.setAurasEnabled(boolean enabled, boolean affectsUI)
BlzUnitEnableAuras(this, enabled, affectsUI)

public function unit.setHeroGlowAllowed(boolean allowed)
if allowed
AllowHeroGlowOnUnit(this)
else
DisallowHeroGlowOnUnit(this)

public function unit.isHeroGlowAllowed() returns boolean
return HeroGlowIsAllowedOnUnit(this)

1 change: 1 addition & 0 deletions wurst/_handles/_Handles.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import public Boolexpr
import public Camera
import public CommonNativeExtensions
import public Destructable
import public Doodad
import public Effect
import public Fogmodifier
import public Force
Expand Down
12 changes: 12 additions & 0 deletions wurst/_wurst/TypeCasting.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,15 @@ public function booleanToIndex(boolean u) returns int
public function booleanFromIndex(int index) returns boolean
return index == 1

public function int.toFogStyle() returns fogstyle
return ConvertFogStyle(this)

public function int.toEquipmentType() returns equipmentType
return ConvertEquipmentType(this)

public function int.toItemTag() returns itemTag
return ConvertItemTag(this)

public function int.toLoadoutSlot() returns loadoutslot
return ConvertLoadoutSlot(this)

Loading