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

Code and logic improvements #15

Closed
wants to merge 3 commits into from
Closed

Conversation

ShadowsAdi
Copy link

  1. #NeverNestCode

  2. Fixed accuracy logic

    • if the player is in mid-air, he shouldn't have the same accuracy
    • if the traceline didn't hit anything, no point to continue logic
  3. Bumped version

- if the player is in mid-air, he shouldn't have the same accuracy
- if the traceline didn't hit anything, no point to continue logic
@SmileYzn
Copy link
Owner

SmileYzn commented Jun 15, 2024

Thanks for work in that fixes 🙏 I'm out of time to work with CS, but these changes are welcome.

Some things that i need to review here:

  1. The most common lie in programming is that called "never nest code", nest what? I think that can have some point of: "Never use returns a lot".
    And i have some point to that: In whole code of accuracy fix where is 'elses' of that whole nested codes? It's just preferences

  2. I accept the fact in the air player must loss their accuracy, needed more checks than a simple on ground check maybe?

We can't mix things up here either. Why i should check something that can not be even executed in first place? That "Not nested code" is mixing-up things here, and i even check whole changes

if (!(DistanceLimit > 0.0f && Player->edict()->v.flags & FL_ONGROUND))

We are checking for entities in that case, i think flFraction is welcome here too.

But check for null entities already do flFraction part no?
I did not remember if that entity is always nulls for non-players, when i write that code i just want to fix that traceline for any type of entity in game, not only in CS.

Anyway i will accept that as a nice fix 👍

if (!(trResult.flFraction != 1.0f && !FNullEnt(trResult.pHit)))

  1. Thanks for bump version, i will make a script to bump this automatically.

Other things:
At line 44 of GetPath() function, that is used to replace all characters "" by "/".
What is wrong there? I sill need to understand that change

@SmileYzn SmileYzn closed this Jul 16, 2024
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