GlowingTree880 / L4D2_LittlePlugins

L4D2_LittlePlugins
GNU General Public License v3.0
62 stars 7 forks source link

treeutil GetClosetMobileSurvivor 方法是不是判断错了 #2

Open shucai520 opened 1 year ago

shucai520 commented 1 year ago

if (IsValidSurvivor(newtarget) && IsPlayerAlive(newtarget) && !IsClientIncapped(client) &&!IsClientPinned(client) && newtarget != exclude_client) https://github.com/GlowingTree880/L4D2_LittlePlugins/blob/main/Ai_HardSi/treeutil.sp#L228 后面两个成client了

GlowingTree880 commented 1 year ago

if (IsValidSurvivor(newtarget) && IsPlayerAlive(newtarget) && !IsClientIncapped(client) &&!IsClientPinned(client) && newtarget != exclude_client) https://github.com/GlowingTree880/L4D2_LittlePlugins/blob/main/Ai_HardSi/treeutil.sp#L228 后面两个成client了

是的,是判断错误,感谢提出(。・ω・。),可以改为:if (IsValidSurvivor(newtarget) && IsPlayerAlive(newtarget) && !IsClientIncapped(newtarget) &&!IsClientPinned(newtarget) && newtarget != client && newtarget != exclude_client),原来还有个 bug,因为忘记判断 newtarget 是否等于入参 client,导致这个方法用在生还者身上时返回的将会是自身,由于大多都是使用在特感上的所以可以找到一个生还者目标。目前已更新 treeutil.sp,优化了 GetClosetMobileSurvivor() 方法,更改为使用 ArrayList 集合存储相互距离与客户端索引,并使用 ArrayList.sort() 方法找到最近目标。