initial commit
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
local ____lualib = require("lualib_bundle")
|
||||
local __TS__Class = ____lualib.__TS__Class
|
||||
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
||||
local __TS__Decorate = ____lualib.__TS__Decorate
|
||||
local ____exports = {}
|
||||
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
||||
local BaseAbility = ____dota_ts_adapter.BaseAbility
|
||||
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
||||
local registerAbility = ____dota_ts_adapter.registerAbility
|
||||
local registerModifier = ____dota_ts_adapter.registerModifier
|
||||
--- Пассивка для npc_capture_point: при приближении героя спавнит npc_teleport один раз.
|
||||
____exports.ability_capture_point = __TS__Class()
|
||||
local ability_capture_point = ____exports.ability_capture_point
|
||||
ability_capture_point.name = "ability_capture_point"
|
||||
ability_capture_point.____file_path = "scripts/vscripts/abilities/ability_capture_point.lua"
|
||||
__TS__ClassExtends(ability_capture_point, BaseAbility)
|
||||
function ability_capture_point.prototype.GetIntrinsicModifierName(self)
|
||||
return ____exports.modifier_ability_capture_point.name
|
||||
end
|
||||
ability_capture_point = __TS__Decorate(
|
||||
ability_capture_point,
|
||||
ability_capture_point,
|
||||
{registerAbility(nil)},
|
||||
{kind = "class", name = "ability_capture_point"}
|
||||
)
|
||||
____exports.ability_capture_point = ability_capture_point
|
||||
____exports.modifier_ability_capture_point = __TS__Class()
|
||||
local modifier_ability_capture_point = ____exports.modifier_ability_capture_point
|
||||
modifier_ability_capture_point.name = "modifier_ability_capture_point"
|
||||
modifier_ability_capture_point.____file_path = "scripts/vscripts/abilities/ability_capture_point.lua"
|
||||
__TS__ClassExtends(modifier_ability_capture_point, BaseModifier)
|
||||
function modifier_ability_capture_point.prototype.____constructor(self, ...)
|
||||
BaseModifier.prototype.____constructor(self, ...)
|
||||
self.activated = false
|
||||
self.intervalThinkCount = 0
|
||||
end
|
||||
function modifier_ability_capture_point.prototype.IsHidden(self)
|
||||
return true
|
||||
end
|
||||
function modifier_ability_capture_point.prototype.IsPurgable(self)
|
||||
return false
|
||||
end
|
||||
function modifier_ability_capture_point.prototype.OnCreated(self)
|
||||
if IsServer() then
|
||||
local p = self:GetParent()
|
||||
local o = p and p:GetAbsOrigin()
|
||||
local ____opt_2 = p and p.GetEntityIndex
|
||||
local idx = ____opt_2 and ____opt_2(p) or -1
|
||||
self:StartIntervalThink(0.25)
|
||||
end
|
||||
end
|
||||
function modifier_ability_capture_point.prototype.OnIntervalThink(self)
|
||||
if not IsServer() or self.activated then
|
||||
return
|
||||
end
|
||||
self:GetParent():StartGesture(ACT_DOTA_RUN)
|
||||
local parent = self:GetParent()
|
||||
if not parent or not IsValidEntity(parent) or not parent:IsAlive() then
|
||||
return
|
||||
end
|
||||
local ability = self:GetAbility()
|
||||
local radius = ability:GetSpecialValueFor("activation_radius")
|
||||
local spawnDistance = ability:GetSpecialValueFor("spawn_distance")
|
||||
local heroes = FindUnitsInRadius(
|
||||
parent:GetTeamNumber(),
|
||||
parent:GetAbsOrigin(),
|
||||
nil,
|
||||
radius,
|
||||
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
|
||||
DOTA_UNIT_TARGET_HERO,
|
||||
DOTA_UNIT_TARGET_FLAG_NONE,
|
||||
FIND_ANY_ORDER,
|
||||
false
|
||||
)
|
||||
self.intervalThinkCount = self.intervalThinkCount + 1
|
||||
local realHeroCount = 0
|
||||
for ____, u in ipairs(heroes) do
|
||||
if u and u:IsAlive() and u:IsRealHero() then
|
||||
realHeroCount = realHeroCount + 1
|
||||
end
|
||||
end
|
||||
for ____, h in ipairs(heroes) do
|
||||
if h and h:IsAlive() and h:IsRealHero() then
|
||||
parent:RemoveGesture(ACT_DOTA_RUN)
|
||||
self:spawnTeleport(parent, spawnDistance)
|
||||
self.activated = true
|
||||
self:StartIntervalThink(-1)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function modifier_ability_capture_point.prototype.spawnTeleport(self, capture, distance)
|
||||
local origin = capture:GetAbsOrigin()
|
||||
local forward = capture:GetForwardVector()
|
||||
local rawPos = Vector(origin.x + forward.x * distance, origin.y + forward.y * distance, -origin.z)
|
||||
local pos = GetGroundPosition(rawPos, nil)
|
||||
capture:StartGesture(ACT_DOTA_CAPTURE)
|
||||
local tp = CreateUnitByName(
|
||||
"npc_teleport",
|
||||
pos,
|
||||
false,
|
||||
nil,
|
||||
nil,
|
||||
capture:GetTeamNumber()
|
||||
)
|
||||
if tp and IsValidEntity(tp) then
|
||||
local pfx = ParticleManager:CreateParticle(
|
||||
"particles/econ/events/fall_2021/fountain_regen_fall_2021_lvl3.vpcf",
|
||||
PATTACH_ABSORIGIN_FOLLOW,
|
||||
self:GetParent()
|
||||
)
|
||||
ParticleManager:ReleaseParticleIndex(pfx)
|
||||
tp:SetEntityName("npc_teleport")
|
||||
tp:SetAbsOrigin(pos)
|
||||
tp:SetForwardVector(forward)
|
||||
end
|
||||
end
|
||||
modifier_ability_capture_point = __TS__Decorate(
|
||||
modifier_ability_capture_point,
|
||||
modifier_ability_capture_point,
|
||||
{registerModifier(nil)},
|
||||
{kind = "class", name = "modifier_ability_capture_point"}
|
||||
)
|
||||
____exports.modifier_ability_capture_point = modifier_ability_capture_point
|
||||
return ____exports
|
||||
Reference in New Issue
Block a user