Skip to content

Rename handlers and events for entity processing consistency #3925

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

lynconsl
Copy link

@lynconsl lynconsl commented Jan 4, 2025

The change from onClientPedsProcessed to onClientEntitiesProcessed indicates that the event is not only related to pedestrians, but can also be used on various elements, for example: #3922 The idea to revive the event came from this issue.

The ped manipulators have also been renamed to entities.

@botder
Copy link
Member

botder commented Jan 4, 2025

Can you add a warning/error to addEventHandler whenever somebody tries to register a handler for onClientPedsProcessed?

@botder botder added refactor backwards-incompatible Should be merged after the release of 1.7.1 labels Jan 4, 2025
@lynconsl
Copy link
Author

lynconsl commented Jan 4, 2025

Can you add a warning/error to addEventHandler whenever somebody tries to register a handler for onClientPedsProcessed?

I'll find a way to do it

@tederis
Copy link
Member

tederis commented Jan 5, 2025

This event should be named "onClientPostUpdate". It will describe the meaning of the event better.

Comment on lines 3879 to 3883
if (m_pRootEntity->CallEvent("onClientPedsProcessed", Arguments, false))
{
throw std::runtime_error("'onClientPedsProcessed' is no longer supported, renamed to 'onClientPostUpdate'");
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better solution would be to just assume onClientPostUpdate when somebody does addEventHandler("onClientPedsProcessed", ...) but also show a warning.

Comment on lines 3879 to 3883
if (m_pRootEntity->CallEvent("onClientPedsProcessed", Arguments, false))
{
CStaticFunctionDefinitions::AddEventHandler("onClientPedsProcessed", "onClientPostUpdate", "The 'onClientPedsProcessed' event is deprecated and has been renamed to 'onClientPostUpdate'.");
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how you came up with the idea to put that here, remove it and adapt CStaticFunctionDefinitions::AddEventHandler.

@lynconsl lynconsl closed this Feb 7, 2025
@lynconsl lynconsl reopened this Jul 31, 2025
MohabCodeX and others added 9 commits July 31, 2025 21:21
- Move deprecation handling from event trigger to AddEventHandler
- Remove broken compatibility code from PostWorldProcessEntitiesAfterPreRenderHandler
- Add proper warning when scripts use deprecated event name
- Ensure seamless migration: old event name redirects to onClientPostUpdate
Fix backward compatibility for onClientPedsProcessed event
@lynconsl lynconsl requested a review from botder August 3, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-incompatible Should be merged after the release of 1.7.1 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants