Garry's Mod

Garry's Mod

NextFX - Stylish Chase FX [EASY Custom Packs]
Optimization problem
On maps with big amount of entites this addon causes lag. That's because in local function GetAllNextbots() you use ents.GetAll(), which is not intented to use in loops/frequent calls. For that you need to use ents.Iterator()[wiki.facepunch.com]. That should help improve perfomance.

Aside from that, I don't understand why for NPC detection you try to find "npc_" in their classname, even though you can use method IsNPC() on them to check if they are NPC or not. What makes it more confusing for more is the fact that you did acknowledged IsNextBot() method (however you still firstly check for "nextbot_" in their classname for some reason)

Sorry for my little rant here, I just wanted to point at some inconstancy and questionable decisions in the code. Didn't want to be sound rude.
最后由 Король таджиков 编辑于; 8 月 1 日 上午 6:51
< >
正在显示第 1 - 6 条,共 6 条留言
VAKANCY  [开发者] 8 月 1 日 上午 8:13 
No worries man! I was aiming for generous detection, and I'm sorry for any lua newbie mistakes!
VAKANCY  [开发者] 8 月 1 日 上午 8:14 
Thank you for bringing this to my attention, optimization due!
VAKANCY  [开发者] 8 月 1 日 上午 8:16 
Transparency: This uses some AI to get the job done because I don't know what the f#$k I'm doing half the time when it comes to lua
最后由 VAKANCY 编辑于; 8 月 1 日 上午 8:16
No problems, glad to help you out! One thing I didn't mentioned is that same thing should be done in GetValidPlayers(), where instead of player.GetAll() it's better to use player.Iterator(). Though it's not that critical, due to amount of players, but hey, extra perfomance is still extra perfomance.
最后由 Король таджиков 编辑于; 8 月 1 日 上午 8:29
VAKANCY  [开发者] 8 月 1 日 上午 8:33 
nah dude you're genuinely such an awesome help bro
right now i'm struggling to read the custom directory without using lua, once this is resolved, i'm loving the sound of extra framejuice
though tomorrow i'm going on a trip that was planned way before the workshop upload
so we'll see how much i can get done before that
VAKANCY  [开发者] 8 月 1 日 下午 12:51 
Yay for optimization! Should be more performant for you! Thanks again for all the helpful detail.
最后由 VAKANCY 编辑于; 8 月 1 日 下午 12:51
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50