New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce GetBlueprint() calls in weapons #3193
Reduce GetBlueprint() calls in weapons #3193
Conversation
Some were pretty obvious, just save the first call in a local variable and reuse. Then saving some values directly in the weapon table and reusing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 446 in f5564ff
error('Error on rackbones ' .. self.unit.UnitId) |
Can delete it as it is checked in OnCreate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@speed2CZ this is a good implement but there are a few small changes that should be done in this PR.
self.bpRateOfFire = bp.RateOfFire | ||
self.EnergyRequired = bp.EnergyRequired | ||
self.EnergyDrainPerSecond = bp.EnergyDrainPerSecond | ||
self.WeaponUnpacks = bp.WeaponUnpacks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting these variables are not needed if you make this change in OnCreate function:
self.bp = self:GetBlueprint()
then rest of the code can access above variables and many more directly from blueprint table like this:
self.bp.RateOfFire -- instead of self.bpRateOfFire
self.bp.EnergyRequired -- instead of self.EnergyRequired
Already done in OnCreate
Some were pretty obvious, just save the first call in a local variable and reuse.
Then saving some values directly in the weapon table and reusing them.