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
Fix the armory use distance situation #1546
Fix the armory use distance situation #1546
Conversation
70cb809
to
a42fd43
Compare
|
Do we need to make |
|
It's already larger than what the UI allowed you to do before. So if
the map worked before this commit, it should still work :)
…On Sun, Oct 24 2021 at 11:39:54 -0700, Thomas Debesse ***@***.***> wrote:
Do we need to make ENTITY_USE_RANGE larger? If I'm right with current
value it's already usable for tricks like reloading though a wall and
that's used by some mission maps that put thin indestructible glass
in front of the armoury to protect it from alien players/bots while
keeping it usable by human players.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
|
I mean, it may make the trick work and be abused in situation it was not expected before (like through larger walls). |
|
I also wonder why the range was increased from 64 to 96. This does not concerns me too much though, because there is currently no mission map working on unvanquished which uses illwieckz's trick (as for the bot problem, it would not be a regression since I've heard than tremulous didn't had bots). |
|
Not checking for the ->usable field and prefering instead to only check for hard-coded value "armory" seems a regression to me. What's the motivation?
It could be considered as a regression I guess, but considering how there was already an hardcoded value and how to add a new buildable you would need to add it at several places anyway; I sligtly prefer it that way.
Le 28 octobre 2021 18:30:48 GMT+02:00, "Morel Bérenger" ***@***.***> a écrit :
***@***.*** commented on this pull request.
…
>
- if ( es->eType == entityType_t::ET_BUILDABLE && BG_Buildable( es->modelindex )->usable &&
- CG_IsOnMyTeam(*es) )
+ if ( es.eType == entityType_t::ET_BUILDABLE
+ && es.modelindex == BA_H_ARMOURY
Not checking for the `->usable` field and prefering instead to only check for hard-coded value "armory" seems a regression to me. What's the motivation?
> {
- //hack to prevent showing the usable buildable when you aren't carrying an energy weapon
- if ( es->modelindex == BA_H_REACTOR &&
- ( !BG_Weapon( cg.snap->ps.weapon )->usesEnergy ||
- BG_Weapon( cg.snap->ps.weapon )->infiniteAmmo ) )
+ if ( !IsVisible() )
No code is reachable in both visibility cases or in the opposite condition (IsVisible()). Thus, why not integrate this on previous if?
Simply returning at end of block would allow to just `setProperty( "display", "none" ); cg.nearUsableBuildable = BA_NONE;` at end of function an be done with it. Plus, the way you do it, it means in some cases those values are not changed at all: is that what you want?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#1546 (review)
|
|
[Why] replacing all later ENTITY_USE_RANGE occurrences by ENTITY_USE_RANGE - 0.2?
The reason I updated the cgame code to use a slightly lower distance is to avoid slight rounding/prediction errors. Otherwise you might have cases where you think you can buy something, but the server will actually refuses to let you do it
|
|
Last minor point (this really is a minor one): having this distance as a CVar would be nice. There's no need to keep this hard-coded, right?
That is technically true. However doing that means having a cvar on server side then sending it to clients so they can have a relevant info. I think it's more work than it's worth.
|
Makes sense.
But then, you should have that slightly smaller value only in cgame, right? I'm pretty sure you did it in both cgame and sgame?
Ah, right, it would need syncing. Indeed, that does not seems small enough to fit in the scope. |
|
No code is reachable in both visibility cases or in the opposite
condition (IsVisible()). Thus, why not integrate this on previous if?
I kept the if like that instead of using a `SetProperty( "display",
condition ? display : "none" );` because it was it like it was in the
previous version of the code. The reason for that may very well be
performance.
But then, you should have that slightly smaller value only in cgame,
right? I'm pretty sure you did it in both cgame and sgame?
whoops, fixed
…>
On Thu, Oct 28 2021 at 20:49:25 +0000, Morel Bérenger ***@***.***> wrote:
> there was already an hardcoded value and how to add a new buildable
> you would need to add it at several places anyway
>
Makes sense.
> the reason to use a slightly lower distance is to avoid slight
> rounding/prediction errors
>
But then, you should have that slightly smaller value only in cgame,
right? I'm pretty sure you did it in both cgame and sgame?
>> Last minor point (this really is a minor one): having this distance
>> as a CVar would be nice. There's no need to keep this hard-coded,
>> right?
>> That is technically true. However doing that means having a cvar
>> on server side then sending it to clients so they can have a
>> relevant info. I think it's more work than it's worth.
>>
Ah, right, it would need syncing. Indeed, that does not seems small
enough to fit in the scope.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I see 0 cases in which a branch cost more than a "logical and" (&&). Previous code had duplicated code in that area (from what I've read in the diff), your patch fixed it, so you could also simplify that. |
|
I see 0 cases in which a branch cost more than a "logical and" (&&).
Previous code had duplicated code in that area (from what I've read in
the diff), your patch fixed it, so you could also simplify that.
Changing the display css property may very well trigger a reflow and
cause the html rendering engine to recalc, resize and redraw every
element of the UI. That would be bad.
|
a42fd43
to
8bf6197
Compare
I don't see where the flow would be changed? The last PS: could you do the quoting properly? |
8bf6197
to
efe9a53
Compare
|
(by @illwieckz)
If it's any consolation, in such case, the previous behavior would actually let pr0 players who had binds buy gear anyway. I can change the distance back if it helps though. This is more practical though IMO. |
|
ping @bmorel |
src/shared/bg_gameplay.h
Outdated
| @@ -307,8 +307,7 @@ extern int MEDKIT_STARTUP_SPEED; | |||
|
|
|||
| #define QU_TO_METER 0.03125 // in m/qu | |||
|
|
|||
| #define ENTITY_USE_RANGE 64.0f | |||
| #define ENTITY_BUY_RANGE 128.0f | |||
| #define ENTITY_USE_RANGE 96.0f | |||
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.
I'm not that fond of elarging the area in which one can enable armory honesty. CUrren dist seems fine to me.
|
Ping. Are there still stuff to review on this? |
efe9a53
to
f72ed1c
Compare
also use an average of the two distances for the new use distance, it feels nice enough
f72ed1c
to
9ea72fd
Compare
Currently, there are 4 (four!) slightly different experiences in game when trying to buy stuff
This PR makes the experience nicer and make it look and feel much more consistent. I tried to avoid making a larger refactoring to avoid breaking stuff in the process (for example maybe some maps have activatable buttons?).