-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make wards invisible unless you get close to them (#912)
* Make wards invisible unless you get close to them * Make invisiaura invisible
- Loading branch information
1 parent
de2c255
commit ea4da86
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
game/scripts/vscripts/modifiers/modifier_ward_invisibility.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
LinkLuaModifier('modifier_ward_invisibility_enemy', 'modifiers/modifier_ward_invisibility.lua', LUA_MODIFIER_MOTION_NONE) | ||
|
||
modifier_ward_invisibility = class({}) | ||
modifier_ward_invisibility_enemy = class({}) | ||
|
||
function modifier_ward_invisibility_enemy:IsHidden() | ||
return true | ||
end | ||
|
||
function modifier_ward_invisibility:OnCreated() | ||
self.isInvis = true | ||
self.id = "ward_" .. tostring(math.random()) | ||
end | ||
function modifier_ward_invisibility:OnRefresh() | ||
self.isInvis = true | ||
self.id = "ward_" .. tostring(math.random()) | ||
end | ||
|
||
function modifier_ward_invisibility:CheckState() | ||
return { | ||
[MODIFIER_STATE_INVISIBLE] = self.isInvis, | ||
} | ||
end | ||
|
||
function modifier_ward_invisibility:IsHidden() | ||
return true | ||
end | ||
|
||
-------------------------------------------------------------------------- | ||
-- aura stuff | ||
|
||
function modifier_ward_invisibility:IsAura() | ||
return true | ||
end | ||
|
||
function modifier_ward_invisibility:GetAuraSearchType() | ||
return DOTA_UNIT_TARGET_HERO | ||
end | ||
|
||
function modifier_ward_invisibility:GetAuraSearchTeam() | ||
return DOTA_UNIT_TARGET_TEAM_ENEMY | ||
end | ||
|
||
function modifier_ward_invisibility:GetAuraRadius() | ||
return 300 | ||
end | ||
|
||
function modifier_ward_invisibility:GetModifierAura() | ||
return "modifier_ward_invisibility_enemy" | ||
end | ||
|
||
function modifier_ward_invisibility:GetAuraEntityReject(entity) | ||
if self.isInvis then | ||
print(self.id .. ': showing self') | ||
end | ||
self.isInvis = false | ||
|
||
Timers:RemoveTimer(self.id) | ||
Timers:CreateTimer(self.id, { | ||
endTime = 3, | ||
callback = function() | ||
print(self.id .. ': hiding self') | ||
self.isInvis = true | ||
end | ||
}) | ||
return false | ||
end |