Bars
1.0.0.2
1.0.0.2
By Sevion
4+ Builders in Construction Mode is broken atm.
Uses StringColors and T32xs.
Update 1.0.0.3 will add more security to the construction detection.
Docs
- What Bars does:
Bars creates an easy method to create custom bars for almost ANY purpose! - How Bars was made:
Basically, I got bored. And with StringColors created, I wanted to do something using that system.
- Creating a Bar at a Location:
[ljass]local Bar myBar = Bar.createOnLocation(loc, TRACK_TYPE_CUSTOM1, Color.create(200,50,50), Color.create(10,10,10), 100)[/ljass]
- Creating a Bar on a Unit:
[ljass]local Bar myBar = Bar.createOnUnit(Unit, TRACK_TYPE_HEALTH, Color.create(0,255,0), Color.create(10,10,10), 0)[/ljass]
- Creating a Bar on an Item:
[ljass]local Bar myBar = Bar.createOnItem(Item, TRACK_TYPE_CUSTOM1, Color.create(200,50,50), Color.create(10,10,10), 100)[/ljass]
- Creating a Bar on a Destructable:
[ljass]local Bar myBar = Bar.createOnDestructable(Destructable, TRACK_TYPE_HEALTH, Color.create(0,255,0), Color.create(10,10,10), 0)[/ljass]
- Setting the maximum for a Custom Bar:
[ljass]set myBar.maximum = 100[/ljass]
JASS:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~ Bars ~~ By Sevion ~~ Version 1.0.0.2 ~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// What is Bars?
// -An easy way to create floating status bars for almost anything
// without removing any advanced features and power.
//
// Configurables:
//! textmacro Bar__CONFIGURABLE_GLOBALS
private constant string BAR_CHAR = "039;"
private constant integer NUM_CHARS = 30
private constant integer NUM_CHARS_CONSTRUCTION = 80
private constant real BAR_SIZE = 11.00
private constant real X_OFFSET = -35.00
private constant real Y_OFFSET = -40.00
private constant real Y_OFFSET_MANA = -14.00
private constant real X_OFFSET_CONSTRUCTION = -65.00
private constant real Y_OFFSET_CONSTRUCTION = -40.00
private constant real X_OFFSET_CUSTOM1 = -35.00
private constant real Y_OFFSET_CUSTOM1 = -40.00
private constant real X_OFFSET_CUSTOM2 = -35.00
private constant real Y_OFFSET_CUSTOM2 = -40.00
private constant real X_OFFSET_CUSTOM3 = -35.00
private constant real Y_OFFSET_CUSTOM3 = -40.00
private constant integer BACKGROUND_RED = 10
private constant integer BACKGROUND_GREEN = 10
private constant integer BACKGROUND_BLUE = 10
//! endtextmacro
//! textmacro Bar__GetCustomData1
set i = GetUnitUserData(this.unit)
//! endtextmacro
//! textmacro Bar__Custom1EndCondition
set b = this.max - 1 < T32_PERIOD
//! endtextmacro
//! textmacro Bar__GetCustomData2
set i = GetUnitUserData(this.unit)
//! endtextmacro
//! textmacro Bar__Custom2EndCondition
set b = this.max - 1 < T32_PERIOD
//! endtextmacro
//! textmacro Bar__GetCustomData3
set i = GetUnitUserData(this.unit)
//! endtextmacro
//! textmacro Bar__Custom3EndCondition
set b = this.max - 1 < T32_PERIOD
//! endtextmacro
//
// API:
// -globals
// -constant integer TRACK_TYPE_HEALTH = 0
// TrackType to pass for health tracking.
//
// -constant integer TRACK_TYPE_MANA = 1
// TrackType to pass for mana tracking.
//
// -constant integer TRACK_TYPE_CONSTRUCTION = 2
// TrackType to pass for construction tracking.
//
// -constant integer TRACK_TYPE_CUSTOM1 = 3
// TrackType to pass for custom 1 tracking.
//
// -constant integer TRACK_TYPE_CUSTOM2 = 4
// TrackType to pass for custom 2tracking.
//
// -constant integer TRACK_TYPE_CUSTOM3 = 5
// TrackType to pass for custom 3 tracking.
//
// -struct Bar extends array
// -location location
// Location of the bar (in location mode).
//
// -unit unit
// Unit of the bar (in unit mode).
//
// -item item
// Item of the bar (in item mode).
//
// -destructable destructable
// Destructable of the bar (in destructable mode).
//
// -integer maximum
// Maximum value of the bar (in custom mode).
//
// -static method createOnLocation takes location whichLocation, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
// Creates a bar at a location with a tracktype, colors, and a maximum (in the case of custom).
//
// -static method createOnUnit takes unit whichUnit, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
// Creates a bar on a unit with a tracktype, colors, and a maximum (in the case of custom).
//
// -static method createOnItem takes item whichItem, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
// Creates a bar on an item with a tracktype, colors, and a maximum (only custom tracking).
//
// -static method createOnDestructable takes destructable whichDestructable, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
// Creates a bar on a destructable with a tracktype, colors, and a maximum (in the case of custom).
//
// -method destroy takes nothing returns nothing
// Destroys the bar and cleans out leaks. Note: This does not autodestroy colors!
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
native GetUnitBuildTime takes integer unitid returns integer
native UnitAlive takes unit unitid returns boolean
library Bars uses StringColors, T32
globals
constant integer TRACK_TYPE_HEALTH = 0
constant integer TRACK_TYPE_MANA = 1
constant integer TRACK_TYPE_CONSTRUCTION = 2
constant integer TRACK_TYPE_CUSTOM1 = 3
constant integer TRACK_TYPE_CUSTOM2 = 4
constant integer TRACK_TYPE_CUSTOM3 = 5
//! runtextmacro Bar__CONFIGURABLE_GLOBALS()
private string array Text
endglobals
private struct ValueType extends array
public static constant integer HEALTH = 0
public static constant integer MANA = 1
public static constant integer CONSTRUCTION = 2
public static constant integer CUSTOM1 = 3
public static constant integer CUSTOM2 = 4
public static constant integer CUSTOM3 = 5
endstruct
private struct DataType extends array
public static constant integer LOCATION = 0
public static constant integer UNIT = 1
public static constant integer ITEM = 2
public static constant integer DESTRUCTABLE = 3
endstruct
struct Bar extends array
private static integer instanceCount = 0
private static integer array recycle
private static integer recycleCount = 0
private static hashtable hash
private static Color background
private Color Mixed
private integer max
private DataType type
private texttag tag
private string string
private ValueType track
private integer tracked
private Color Color1
private Color Color2
private boolean autoDestroy
public location location
public unit unit
public item item
public destructable destructable
private method periodic takes nothing returns nothing
local integer id = GetHandleId(this.unit)
local real tick
local integer count
local integer i = 0
local integer m = 0
local boolean b
local real ratio = 0
if ( this.type == DataType.LOCATION ) then
call SetTextTagVisibility(this.tag, IsLocationVisibleToPlayer(this.location, GetLocalPlayer()))
call SetTextTagPos(this.tag, GetLocationX(this.location) + X_OFFSET, GetLocationY(this.location) + Y_OFFSET, 200)
elseif ( this.type == DataType.UNIT ) then
call SetTextTagVisibility(this.tag, IsUnitVisible(this.unit, GetLocalPlayer()))
if ( this.track == ValueType.HEALTH or this.track == ValueType.CUSTOM1 or this.track == ValueType.CUSTOM2 or this.track == ValueType.CUSTOM3 ) then
call SetTextTagPos(this.tag, GetUnitX(this.unit) + X_OFFSET, GetUnitY(this.unit) + Y_OFFSET, 200)
elseif ( this.track == ValueType.MANA ) then
call SetTextTagPos(this.tag, GetUnitX(this.unit) + X_OFFSET, GetUnitY(this.unit) + Y_OFFSET + Y_OFFSET_MANA, 200)
elseif ( this.track == ValueType.CONSTRUCTION ) then
call SetTextTagPos(this.tag, GetUnitX(this.unit) + X_OFFSET + X_OFFSET_CONSTRUCTION, GetUnitY(this.unit) + Y_OFFSET_CONSTRUCTION, 200)
endif
elseif ( this.type == DataType.ITEM ) then
call SetTextTagVisibility(this.tag, IsVisibleToPlayer(GetItemX(this.item), GetItemY(this.item), GetLocalPlayer()))
call SetTextTagPos(this.tag, GetItemX(this.item) + X_OFFSET, GetItemY(this.item) + Y_OFFSET, 200)
elseif ( this.type == DataType.DESTRUCTABLE ) then
call SetTextTagVisibility(this.tag, IsVisibleToPlayer(GetDestructableX(this.destructable), GetDestructableY(this.destructable), GetLocalPlayer()))
call SetTextTagPos(this.tag, GetDestructableX(this.destructable) + X_OFFSET, GetDestructableY(this.destructable) + Y_OFFSET, 200)
endif
if ( this.track == ValueType.HEALTH ) then
if ( this.type == DataType.UNIT ) then
set ratio = GetUnitState(this.unit, UNIT_STATE_LIFE) / GetUnitState(this.unit, UNIT_STATE_MAX_LIFE)
set i = R2I(NUM_CHARS * ratio + 0.5)
elseif ( this.type == DataType.DESTRUCTABLE ) then
set ratio = GetDestructableLife(this.destructable) / GetDestructableMaxLife(this.destructable)
set i = R2I(NUM_CHARS * GetDestructableLife(this.destructable) / GetDestructableMaxLife(this.destructable) + 0.5)
endif
elseif ( this.track == ValueType.MANA ) then
set ratio = GetUnitState(this.unit, UNIT_STATE_MANA) / GetUnitState(this.unit, UNIT_STATE_MAX_MANA)
set i = R2I(NUM_CHARS * ratio + 0.5)
elseif ( this.track == ValueType.CONSTRUCTION ) then
set tick = LoadReal(thistype.hash, id, 0)
if ( GetUnitBuildTime(GetUnitTypeId(this.unit)) - tick < T32_PERIOD or this.unit == null or not UnitAlive(this.unit) ) then
set this.autoDestroy = true
set i = 0
else
set count = LoadInteger(thistype.hash, id, 1)
if ( count == 1 ) then
call SaveReal(thistype.hash, id, 0, tick + T32_PERIOD)
elseif ( count == 2 ) then
call SaveReal(thistype.hash, id, 0, tick + T32_PERIOD * 1.592859695 )
elseif ( count == 3 ) then
call SaveReal(thistype.hash, id, 0, tick + T32_PERIOD * 2.185)
endif
set ratio = LoadReal(thistype.hash, id, 0) / GetUnitBuildTime(GetUnitTypeId(this.unit))
set i = R2I(NUM_CHARS_CONSTRUCTION * ratio + 0.5)
endif
elseif ( this.track == ValueType.CUSTOM1 ) then
call SetTextTagPos(this.tag, GetLocationX(this.location) + X_OFFSET_CUSTOM1, GetLocationY(this.location) + Y_OFFSET_CUSTOM1, 200)
//! runtextmacro Bar__GetCustomData1()
set ratio = i / this.max
set i = R2I(NUM_CHARS * ratio + 0.5)
//! runtextmacro Bar__Custom1EndCondition()
if ( b ) then
set this.autoDestroy = true
endif
elseif ( this.track == ValueType.CUSTOM2 ) then
call SetTextTagPos(this.tag, GetLocationX(this.location) + X_OFFSET_CUSTOM2, GetLocationY(this.location) + Y_OFFSET_CUSTOM2, 200)
//! runtextmacro Bar__GetCustomData2()
set ratio = i / this.max
set i = R2I(NUM_CHARS * ratio + 0.5)
//! runtextmacro Bar__Custom2EndCondition()
if ( b ) then
set this.autoDestroy = true
endif
elseif ( this.track == ValueType.CUSTOM3 ) then
call SetTextTagPos(this.tag, GetLocationX(this.location) + X_OFFSET_CUSTOM3, GetLocationY(this.location) + Y_OFFSET_CUSTOM3, 200)
//! runtextmacro Bar__GetCustomData3()
set ratio = i / this.max
set i = R2I(NUM_CHARS * ratio + 0.5)
//! runtextmacro Bar__Custom3EndCondition()
if ( b ) then
set this.autoDestroy = true
endif
endif
if ( this.track == ValueType.CONSTRUCTION ) then
set m = NUM_CHARS_CONSTRUCTION - i
else
set m = NUM_CHARS - i
endif
if ( this.Mixed == 0 ) then
set this.Mixed = Color.create(0,0,0)
endif
if ( this.Color1 != 0 ) then
set this.Mixed.red = R2I(RAbsBJ(this.Color1.red*(1-ratio)-this.Color2.red*ratio)+.5)
set this.Mixed.green = R2I(RAbsBJ(this.Color1.green*(1-ratio)-this.Color2.green*ratio)+.5)
set this.Mixed.blue = R2I(RAbsBJ(this.Color1.blue*(1-ratio)-this.Color2.blue*ratio)+.5)
else
set this.Mixed = this.Color2
endif
call SetTextTagText(this.tag, this.Mixed.apply(Text<i>) + thistype.background.apply(Text[m]), BAR_SIZE * 0.023 / 10)
if ( this.autoDestroy ) then
call this.stopPeriodic()
call this.destroy()
endif
endmethod
implement T32xs
public method operator maximum takes nothing returns integer
debug if ( this.trackType != ValueType.CUSTOM1 and this.trackType != ValueType.CUSTOM2 and this.trackType != ValueType.CUSTOM3 ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot geta maximum for a non-custom tracking type!")
debug return 0
debug endif
return this.maximum
endmethod
public method operator maximum= takes integer maximum returns nothing
debug if ( this.trackType != ValueType.CUSTOM1 and this.trackType != ValueType.CUSTOM2 and this.trackType != ValueType.CUSTOM3 ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot set a maximum for a non-custom tracking type!")
debug return
debug endif
set this.max = maximum
endmethod
public static method createOnLocation takes location whichLocation, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
local thistype this
debug if ( trackType != ValueType.Custom1 and trackType != ValueType.Custom2 and trackType != ValueType.Custom3 ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot track Health/Mana/Construction of a location!")
return 0
debug endif
if (recycleCount != 0) then
set recycleCount = recycleCount - 1
set this = recycle[recycleCount]
else
set instanceCount = instanceCount + 1
set this = instanceCount
endif
set this.tag = CreateTextTag()
call SetTextTagPos(this.tag, GetLocationX(whichLocation) + X_OFFSET, GetLocationY(whichLocation) + Y_OFFSET, 200)
call SetTextTagPermanent(this.tag, true)
call SetTextTagVisibility(this.tag, IsLocationVisibleToPlayer(whichLocation, GetLocalPlayer()))
set this.Color1 = Color1
set this.Color2 = Color2
if ( trackType == ValueType.CUSTOM1 or trackType == ValueType.CUSTOM2 or trackType == ValueType.CUSTOM3 ) then
set this.max = maximum
endif
//call SaveInteger(thistype.hash, GetHandleId(whichLocation), 0, this)
set this.location = whichLocation
set this.type = DataType.LOCATION
set this.track = trackType
call this.startPeriodic()
call RemoveLocation(whichLocation)
set whichLocation = null
return this
endmethod
public static method createOnUnit takes unit whichUnit, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
local thistype this
debug if ( trackType == ValueType.MANA and GetUnitState(whichUnit, UNIT_STATE_MAX_MANA) == 0 ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot track Mana of a non-mana unit!")
debug return 0
debug endif
if (recycleCount != 0) then
set recycleCount = recycleCount - 1
set this = recycle[recycleCount]
else
set instanceCount = instanceCount + 1
set this = instanceCount
endif
if ( trackType == ValueType.CONSTRUCTION ) then
call SaveReal(thistype.hash, GetHandleId(whichUnit), 0, 0)
endif
set this.tag = CreateTextTag()
call SetTextTagPos(this.tag, GetUnitX(whichUnit) + X_OFFSET, GetUnitY(whichUnit) + Y_OFFSET, 200)
call SetTextTagPermanent(this.tag, true)
call SetTextTagVisibility(this.tag, IsUnitVisible(whichUnit, GetLocalPlayer()))
set this.Color1 = Color1
set this.Color2 = Color2
if ( trackType == ValueType.CUSTOM1 or trackType == ValueType.CUSTOM2 or trackType == ValueType.CUSTOM3 ) then
set this.max = maximum
endif
call SaveInteger(thistype.hash, GetHandleId(whichUnit), 0, this)
set this.unit = whichUnit
set this.type = DataType.UNIT
set this.track = trackType
call this.startPeriodic()
return this
endmethod
public static method createOnItem takes item whichItem, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
local thistype this
debug if ( trackType != ValueType.CUSTOM1 and trackType != ValueType.CUSTOM2 and trackType != ValueType.CUSTOM3 ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot track Health/Mana/Construction of an item!")
debug return 0
debug endif
if (recycleCount != 0) then
set recycleCount = recycleCount - 1
set this = recycle[recycleCount]
else
set instanceCount = instanceCount + 1
set this = instanceCount
endif
set this.tag = CreateTextTag()
call SetTextTagPos(this.tag, GetItemX(whichItem) + X_OFFSET, GetItemY(whichItem) + Y_OFFSET, 200)
call SetTextTagPermanent(this.tag, true)
call SetTextTagVisibility(this.tag, IsVisibleToPlayer(GetItemX(whichItem), GetItemY(whichItem), GetLocalPlayer()))
set this.Color1 = Color1
set this.Color2 = Color2
if ( trackType == ValueType.CUSTOM1 or trackType == ValueType.CUSTOM2 or trackType == ValueType.CUSTOM3 ) then
set this.max = maximum
endif
call SaveInteger(thistype.hash, GetHandleId(whichItem), 0, this)
set this.item = whichItem
set this.type = DataType.ITEM
set this.track = trackType
call this.startPeriodic()
return this
endmethod
public static method createOnDestructable takes destructable whichDestructable, integer trackType, Color Color1, Color Color2, integer maximum returns thistype
local thistype this
debug if ( trackType == ValueType.MANA or trackType == ValueType.CONSTRUCTION ) then
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Error (Bar): Cannot track Mana/Construction of a destructable!")
debug return 0
debug endif
if (recycleCount != 0) then
set recycleCount = recycleCount - 1
set this = recycle[recycleCount]
else
set instanceCount = instanceCount + 1
set this = instanceCount
endif
set this.tag = CreateTextTag()
call SetTextTagPos(this.tag, GetDestructableX(whichDestructable) + X_OFFSET, GetDestructableY(whichDestructable) + Y_OFFSET, 200)
call SetTextTagPermanent(this.tag, true)
call SetTextTagVisibility(this.tag, IsVisibleToPlayer(GetDestructableX(whichDestructable), GetDestructableY(whichDestructable), GetLocalPlayer()))
set this.Color1 = Color1
set this.Color2 = Color2
if ( trackType == ValueType.CUSTOM1 or trackType == ValueType.CUSTOM2 or trackType == ValueType.CUSTOM3 ) then
set this.max = maximum
endif
//call SaveInteger(thistype.hash, GetHandleId(whichDestructable), 0, this)
set this.destructable = whichDestructable
set this.type = DataType.DESTRUCTABLE
set this.track = trackType
call this.startPeriodic()
return this
endmethod
public method destroy takes nothing returns nothing
call DestroyTextTag(this.tag)
set this.tag = null
if ( this.location != null ) then
call RemoveLocation(this.location)
set this.location = null
endif
set this.unit = null
set this.item = null
set recycle[recycleCount] = this
set recycleCount = recycleCount + 1
endmethod
// Item Management
private static trigger itemDrop = CreateTrigger()
private static trigger itemPickUp = CreateTrigger()
private static method itemDropC takes nothing returns boolean
local thistype this = LoadInteger(thistype.hash, GetHandleId(GetManipulatedItem()), 0)
set this.type = DataType.ITEM
set this.unit = null
return false
endmethod
private static method itemPickUpC takes nothing returns boolean
local thistype this = LoadInteger(thistype.hash, GetHandleId(GetManipulatedItem()), 0)
set this.type = DataType.UNIT
set this.unit = GetTriggerUnit()
return false
endmethod
// Construction Management
private static trigger stopBuild = CreateTrigger()
private static trigger startBuild = CreateTrigger()
private static method stopBuildC takes nothing returns boolean
local integer tid = GetHandleId(GetTriggerUnit())
local thistype this = LoadInteger(thistype.hash, tid, 2)
local integer uid = GetHandleId(this.unit)
if ( this.unit == GetOrderTargetUnit() ) then
return false
endif
call SaveInteger(thistype.hash, uid, 1, LoadInteger(thistype.hash, uid, 1) - 1)
if ( LoadInteger(thistype.hash, uid, 1) == 0 ) then
call this.stopPeriodic()
endif
call SaveInteger(thistype.hash, tid, 2, 0)
return false
endmethod
private static method startBuildC takes nothing returns boolean
local thistype this = LoadInteger(thistype.hash, GetHandleId(GetOrderTargetUnit()), 0)
local integer id = GetHandleId(this.unit)
if ( not HaveSavedInteger(thistype.hash, id, 1) ) then
call SaveInteger(thistype.hash, id, 1, 0)
endif
call SaveInteger(thistype.hash, id, 1, LoadInteger(thistype.hash, id, 1) + 1)
call this.startPeriodic()
call SaveInteger(thistype.hash, GetHandleId(GetTriggerUnit()), 2, this)
return false
endmethod
private static method onInit takes nothing returns nothing
local integer i = 16
local integer n
loop
set i = i -1
call TriggerRegisterPlayerUnitEvent(thistype.itemDrop, Player(i), EVENT_PLAYER_UNIT_DROP_ITEM, null)
call TriggerRegisterPlayerUnitEvent(thistype.itemPickUp, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
call TriggerRegisterPlayerUnitEvent(thistype.stopBuild, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
call TriggerRegisterPlayerUnitEvent(thistype.startBuild, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
call TriggerRegisterPlayerUnitEvent(thistype.stopBuild, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
exitwhen i == 0
endloop
call TriggerAddCondition(thistype.itemDrop, Condition(function thistype.itemDropC))
call TriggerAddCondition(thistype.itemPickUp, Condition(function thistype.itemPickUpC))
call TriggerAddCondition(thistype.stopBuild, Condition(function thistype.stopBuildC))
call TriggerAddCondition(thistype.startBuild, Condition(function thistype.startBuildC))
set i = NUM_CHARS_CONSTRUCTION
loop
exitwhen i == 0
set n = i
loop
exitwhen n == 0
set Text<i> = Text<i> + BAR_CHAR
set n = n -1
endloop
set i = i - 1
endloop
set thistype.background = Color.create(BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE)
set thistype.hash = InitHashtable()
endmethod
endstruct
endlibrary</i></i></i>
Change Log
1.0.0.2 said:Removed an O(n) generation that I missed.
1.0.0.1 said:Fixed textmacro bug when AdicParser is disabled, removed multibuilder boolean
1.0.0.0 said:Initial Release
Demo
JASS:
scope Tests initializer initTest
private function construct takes nothing returns nothing
call Bar.createOnUnit(GetConstructingStructure(), TRACK_TYPE_CONSTRUCTION, Color.create(255,0,0), Color.create(0,255,0), 0)
endfunction
private function enter takes nothing returns nothing
if ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) ) then
return
endif
call Bar.createOnUnit(GetTriggerUnit(), TRACK_TYPE_HEALTH, 0, Color.create(0,255,0), 0)
if ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO ) ) then
call Bar.createOnUnit(GetTriggerUnit(), TRACK_TYPE_MANA, 0, Color.create(0,0,255), 0)
endif
endfunction
private function initTest takes nothing returns nothing
local trigger t = CreateTrigger()
local region world = CreateRegion()
call RegionAddRect(world, GetWorldBounds())
call TriggerRegisterEnterRegion(t, world, null)
call TriggerAddAction(t, function enter)
set t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
call TriggerAddAction(t, function construct)
call Cheat("greedisgood 9999999")
call CreateUnit(Player(0), 039;Hpal039;, 0, 0, 0)
call CreateUnit(Player(0), 039;hpea039;, 0, 0, 0)
call CreateUnit(Player(0), 039;hpea039;, 0, 0, 0)
call CreateUnit(Player(0), 039;hpea039;, 0, 0, 0)
call BJDebugMsg("Warning: Warpten Cheat Breaks Construction ATM!")
endfunction
endscope