Skip to content

Clean up the mess around entity types between client and server - #5276

Open
FileEX wants to merge 3 commits into
multitheftauto:masterfrom
FileEX:refactor/entity-type
Open

Clean up the mess around entity types between client and server#5276
FileEX wants to merge 3 commits into
multitheftauto:masterfrom
FileEX:refactor/entity-type

Conversation

@FileEX

@FileEX FileEX commented Aug 28, 2026

Copy link
Copy Markdown
Member

Currently, the MTA codebase has separate enums for entity and element types. On the client side, eClientEntityType is used for MTA element types, while on the server side, the types are defined directly in the CElement class. Additionally, the client has an eEntityType enum representing GTA entity types at the game-engine level.

To work around this, CClientGame also defines a separate enum containing the element types. This enum is used as the entityTypeId in CEntityAddPacket to map entity types from the server to the client. This results in a lot of unnecessary complexity and spaghetti code.

This PR introduces a single shared enum for both sides in the ElementType namespace, with EntityType used to distinguish GTA entity types from MTA element types.

This PR is not backwards compatible, so the NETCODE version is bumped. Otherwise, entityTypeId values sent by the server would no longer match the corresponding ElementType values on the client.

The PR was tested by creating vehicles and peds and verifying that they are correctly created on the client.

@FileEX FileEX added refactor backwards-incompatible Should be merged after the release of 1.7.1 labels Aug 28, 2026
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.

1 participant