- Joined
- Sep 9, 2007
- Messages
- 6,759
JASS:
....
nothing defaults nothing
module Missile_Collisions_Unit
public boolean hitsUnits = true
public boolean hitsUnitsOnZ = false
private group enumedUnits = null
private static boolexpr unitFilter = null
....
private static method enum takes nothing returns boolean
local thistype this = thistype.self
local unit u = GetFilterUnit()
local real z = 0.
local boolean collide = true
call BJDebugMsg("Before GroupCheck")
//if IsUnitInGroup(u, .enumedUnits) then
//set u = null
//return false
//endif
if .hitsUnitsOnZ then
set z = GetUnitZ(u)
set collide = z >= .z - .height /2 and z <= .z + .height /2
endif
call BJDebugMsg("Hitting unit now.")
if collide then
call BJDebugMsg("Unit is hit")
call .hitUnit(u)
endif
set u = null
return false
endmethod
private static method check takes thistype this returns nothing
if not .hitsUnits then
return
endif
call BJDebugMsg("X: " + R2S(.x) + " - Y: " + R2S(.y))
call BJDebugMsg("Range: " + R2S(.range))
call GroupEnumUnitsInRange(.enumedUnits, .x, .y, .range, thistype.unitFilter)
endmethod
private static method init takes thistype this returns nothing
if LIBRARY_GroupUtils then
set .enumedUnits = NewGroup()
else
set .enumedUnits = CreateGroup()
endif
endmethod
private static method onInit takes nothing returns nothing
set thistype.unitFilter = Filter(function thistype.enum)
call thistype.addCreateEvent(thistype.init)
call thistype.addMoveEvent(thistype.check)
call BJDebugMsg("Test: " + I2S(GetHandleId(thistype.unitFilter)))
endmethod
endmodule
What it does not do: It NEVER, even with a range of 100000. and the full map with units, runs the condition function.
Edit: Sorry for bad indention, hive screws it up. (Has Ralle again changed something?)
Can anyone help me please?