Skip to content
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

Improvements to game scripts #253

Merged
merged 1 commit into from
Jul 16, 2022
Merged

Improvements to game scripts #253

merged 1 commit into from
Jul 16, 2022

Conversation

diamante0018
Copy link
Collaborator

  • setClientDvars is to be preferred over setClientDvar when there is the need to set more than one client dvar. The reason is that only one server command is sent instead of multiples. That may cause issues, especially when other game scripts are causing other server commands to be sent. In short, the fewer server commands are sent the better.
  • getDvarInt is to be preferred over int( getDvar() ). The reason is that getDvarInt already fully supports casting variables to the desired type internally. The second int() is redundant. Additionally, the IW variant of getDvarInt supports a default value that is returned in case the dvar was not registered or other errors were to arise when calling getDvarInt. This can't be done with a regular getDvar.
  • getTime() always returns an integer type and self.lastAttackTime is always assigned an integer type therefore the casting to int before subtraction is redundant as well.

@RaidMax RaidMax merged commit d746ca0 into RaidMax:release/pre Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants