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

Revisit changes made in #661 #684

Open
Poggicek opened this issue Nov 23, 2024 · 6 comments
Open

Revisit changes made in #661 #684

Poggicek opened this issue Nov 23, 2024 · 6 comments
Labels
documentation Issue related to documentation regarding CS2 or CS:S. enhancement New feature or request

Comments

@Poggicek
Copy link
Contributor

I am all for preventing developers from stuff that will only lead to broken behavior, however in this case I don't think anything is wrong with the behavior addressed in the #661 except for not meeting developer's expectations, the original PR did not include any cases where this could be bad in any way.

the Teleport method is a general function targeted at any entity, including the controller, it's not a special method with specific behavior for each entity.

These changes have only made the code ambiguous and instead of developers learning the difference between controllers and pawns it tries to smooth out the line between them, creating only more confusion.

Please do join the discussion below this issue and say what your perspective on this is.

@github-actions github-actions bot added the untriaged New issue has not been triaged label Nov 23, 2024
@Poggicek
Copy link
Contributor Author

Poggicek commented Nov 23, 2024

Extending the controller class with let's say TeleportPawn that does all the pawn sanity checks sounds a lot more sensible

edit: with the few null changes to handles, this should not even be needed thanks to optional chaining

@zonical
Copy link
Collaborator

zonical commented Nov 23, 2024

Joining the discussion after talking on the Discord. I agree with @Poggicek that we should push developers to learn the differences between pawns and controllers rather than create edge-case solutions.

xstage on Discord suggested adding a warning message to Teleport (and any other functions that may need it) when run from CCSPlayerController saying something along the lines of "you may have intended to target the player pawn instead" - and direct the developer to the wiki with the appropriate documentation - maybe with an accompanying core config value disabling the warning if the developer knows what they're doing. Perhaps we could also re-arrange the article so the reference section is closer to the top and more visible to developers.

@zonical zonical added enhancement New feature or request documentation Issue related to documentation regarding CS2 or CS:S. and removed untriaged New issue has not been triaged labels Nov 23, 2024
@qstage
Copy link

qstage commented Nov 23, 2024

Maybe something like this. We will hide the Teleport method in CCSPlayerController and using the Obsolute attribute we will output a warning when compiling.

image

@zonical
Copy link
Collaborator

zonical commented Nov 23, 2024

Maybe something like this. We will hide the Teleport method in CCSPlayerController and using the Obsolute attribute we will output a warning when compiling.

image

Part of me wishes there was a custom [Warning] attribute in C#, but this seems like an alright solution to me.

@Poggicek
Copy link
Contributor Author

Maybe something like this. We will hide the Teleport method in CCSPlayerController and using the Obsolute attribute we will output a warning when compiling.

image

sounds good, I'd just rather use the more generic Pawn rather than PlayerPawn, there's a big difference.

@roflmuffin
Copy link
Owner

I've raised a PR reverting the functionality and adding an obsolete compiler warning to just the ccsplayercontroller class instead. I would like to avoid runtime warnings if possible. Open to adding a new TeleportPawn helper method but I think honestly people should just null chain to the pawn teleport manually and be explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue related to documentation regarding CS2 or CS:S. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants