--------- flag ----------
zz_y7.is_others = false;
zz_y7.teleported_to_mob = false;
--------- custom functions ---------
zz_y7.filter_only_live_mobs = function (hit,temp,output)
if (hit > 0) then
local count = 0
for _,c in ipairs(temp) do
---@type MobComponent
local mob = c.Entity.MobComponent
if (mob.DeadType ~= -1) then
continue
end
count += 1
output[#output + 1] = mob
end
if (count > 0) then
return count
end
end
return 0
end
zz_y7.is_someone_in_world = function()
local map_name = _UserService.LocalPlayer.CurrentMapName
local entities = _UserService:GetUsersByMapName(map_name)
return #entities ~= 1
end
zz_y7.play_timer_func = function(self)
--[[
_PlayerAttackLogic:PlayAction(_UserService.LocalPlayer
, _UserService.LocalPlayer.AvatarRendererComponent:GetBodyEntity()
, nil
, _CharacterAction:GetActionString(_CharacterAction.SWINGT1)
, 0
)
]]
local output = {}
--> BoxShape(vec2, vec2, angle)
--> TryDoingMeleeAttack(self, user, skillId, skillLevel, output, lastFinalAttack)
--> OverlapAllFast(CollisionGroup, Shape, output)
local box = BoxShape(Vector2(0.0, 0.0), Vector2(100.0, 100.0), 0) --> i think 0 still god cuzof size
local simulator = _CollisionService:GetSimulator(_UserService.LocalPlayer.WsCharacterData.Entity) --> if not working, lets put map's one
local temp = {}
local output = {}
local output2 = {}
local hit = simulator:OverlapAllFast(CollisionGroups.MapleMob, box, temp)
local count = zz_y7.filter_only_live_mobs(hit, temp, output)
_ChatMessageLogic:Add(_ChatMessageType.System, "남은 몹 수: " .. count)
if count == 0 then return end
zz_y7.teleported_to_mob = false;
for i,v in ipairs(output) do
local mob_pos = v.Entity.TransformComponent.WorldPosition
if zz_y7.is_someone_in_world() then return end
-- to do: change lookat
zz_y7.teleported_to_mob = true;
break
end
end
zz_y7.hit_timer_func = function(self)
if zz_y7.teleported_to_mob then
_PlayerActiveSkillLogic:DoActiveSkill(_UserService.LocalPlayer, 0, 0, output2, 0)
_UserService.LocalPlayer.WsUserController:ActionPickUp()
end
end
댓글0