initial commit
This commit is contained in:
54
aghanim_singleplayer/scripts/vscripts/traps/fire_trap_cycle_d.lua
Executable file
54
aghanim_singleplayer/scripts/vscripts/traps/fire_trap_cycle_d.lua
Executable file
@@ -0,0 +1,54 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Fire Trap Cycle
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function OnTrigger( trigger )
|
||||
thisEntity.fRefireTime = 3.9
|
||||
|
||||
EmitGlobalSound( "ui.ui_player_disconnected" )
|
||||
EmitSoundOn( "AghanimsFortress.FireTrap", hTrigger )
|
||||
|
||||
thisEntity.hBreatheFireAbility = thisEntity:FindAbilityByName( "breathe_fire" )
|
||||
if thisEntity.hBreatheFireAbility == nil then
|
||||
print( "ERROR: thisEntity.hBreatheFireAbility not found" )
|
||||
return
|
||||
end
|
||||
|
||||
thisEntity.fNextAttackTime = GameRules:GetGameTime() + thisEntity.fRefireTime
|
||||
|
||||
thisEntity:SetContextThink( "ActivateTrap", function() return FireTrapActivate() end, 0 )
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function DisableTrap( trigger )
|
||||
thisEntity.bDisabled = true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function FireTrapActivate()
|
||||
if not IsServer() then
|
||||
return
|
||||
end
|
||||
|
||||
if thisEntity.bDisabled then
|
||||
return -1
|
||||
end
|
||||
|
||||
if GameRules:IsGamePaused() == true then
|
||||
return 0.5
|
||||
end
|
||||
|
||||
if GameRules:GetGameTime() >= thisEntity.fNextAttackTime then
|
||||
thisEntity:SetAnimation( "bark_attack" );
|
||||
thisEntity:CastAbilityOnPosition( thisEntity:GetTrapTarget(), thisEntity.hBreatheFireAbility, -1 )
|
||||
thisEntity.fNextAttackTime = GameRules:GetGameTime() + thisEntity.fRefireTime
|
||||
end
|
||||
|
||||
return 0.5
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user