initial commit
This commit is contained in:
41
aghanim_singleplayer/scripts/vscripts/traps/pendulum_trap.lua
Executable file
41
aghanim_singleplayer/scripts/vscripts/traps/pendulum_trap.lua
Executable file
@@ -0,0 +1,41 @@
|
||||
|
||||
require("ai/shared")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function Spawn( entityKeyValues )
|
||||
if IsServer() == false then
|
||||
return
|
||||
end
|
||||
|
||||
--printf( "thisEntity:GetUnitName() == %s", thisEntity:GetUnitName() )
|
||||
|
||||
thisEntity.hSwingAbility = thisEntity:FindAbilityByName( "pendulum_swing" )
|
||||
thisEntity:SetContextThink( "PendulumTrapThink", PendulumTrapThink, RandomFloat( 0.1, 1.0 ) )
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function PendulumTrapThink()
|
||||
if IsServer() then
|
||||
local enemies = GetEnemyHeroesInRange( thisEntity, 2048 ) -- will need to search just in room
|
||||
if not enemies or #enemies == 0 then
|
||||
--print( "no enemies" )
|
||||
thisEntity:InterruptChannel()
|
||||
return RandomFloat( 0.1, 1.0 )
|
||||
end
|
||||
|
||||
if not thisEntity:IsChanneling() then
|
||||
ExecuteOrderFromTable({
|
||||
UnitIndex = thisEntity:entindex(),
|
||||
OrderType = DOTA_UNIT_ORDER_CAST_NO_TARGET,
|
||||
AbilityIndex = thisEntity.hSwingAbility:entindex(),
|
||||
Queue = false,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user