Liam0102 / Star-Wars-Vehicles

Star Wars Vehicles addon for Garrys Mod (Code only)
3 stars 2 forks source link

Issue with Pilot Avatar Drawing #20

Closed dhkatz closed 5 years ago

dhkatz commented 6 years ago

When drawing the pilot avatar you are doing this at the end

https://github.com/Liam0102/Star-Wars-Vehicles/blob/b9eae7e129d2696cf4523696e1a64d645b41c6d1/lua/entities/fighter_base.lua#L1664-L1667

However, this is causing a new avatar being added to the table EVERY think tick, meaning thousands upon thousands of values will fill up the table.

You should instead do the following:

        if (not table.HasValue(self.Filter, avatar)) then
          table.insert(self.Filter, avatar)
        end