-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(server/gamestate): vehicles natives #3071
base: master
Are you sure you want to change the base?
Conversation
* Added IS_VEHICLE_IN_AIR * Added IS_VEHICLE_DROWNING * Added GET_DEATH_STATE to check if a player is alive, dying or dead.
DeathState_Max acts as a boundary marker. It defines the range of valid eDeathState values. |
Good to know thanks, and IS_ENTITY_IN_AIR is client side, a server side native is still better. |
They're saying to reuse the name |
U mean to rename IS_VEHICLE_IN_AIR by IS_ENTITY_IN_AIR? |
If the native can work with all the entities that will be the correct name |
Need to check, since it's in vehicle data node not sure but will test |
DeathState_Alive = 0, // The ped is alive | ||
DeathState_Dying = 1, // The ped is in the process of dying | ||
DeathState_Dead = 2, // The ped is dead | ||
DeathState_Max = 3 // Maximum health? maybe |
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.
Nit: It is just an indicator that the enum has ended. Just a utility - e.g. can be used to iterate through all values of the enum (i = 0; i < DeathState_Max; ++i
) or check that enum values never take more than x bits of space (assert(DeathState_Max < (1 << 3))
). Some other enums in the game have this _Max
value as well
Lets either remove or update the comment accordingly.
return vn ? vn->isDrowning : false; | ||
})); | ||
|
||
fx::ScriptEngine::RegisterNativeHandler("GET_PED_DEATH_STATE", makeEntityFunction([](fx::ScriptContext& context, const fx::sync::SyncEntityPtr& entity) |
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.
Nit: move this to somewhere around line 800 so its near other GET_PED_*
natives (e.g. GET_PED_MAX_HEALTH
).
@@ -805,6 +813,8 @@ struct SyncTreeBase | |||
|
|||
virtual CVehicleGameStateNodeData* GetVehicleGameState() = 0; | |||
|
|||
virtual CVehicleScriptGameStateNodeData* GetVehicleGameScript() = 0; |
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.
Seems like this PR is missing the following code in SyncTrees_Five.h
. It doesn't build without it as it can't instantiate SyncTree
class that is now abstract.
virtual CVehicleScriptGameStateNodeData* GetVehicleGameScript() override
{
auto[hasVdn, vehScriptNode] = this->template GetData<CVehicleScriptGameStateDataNode>();
return (hasVdn) ? &vehScriptNode->data : nullptr;
}
Also - please resolve merge conflicts with master. |
Goal of this PR
How is this PR achieving the goal
By exposing fields in datanodes that were already read, (i couldn't find doc about DeathState_Max tho)
This PR applies to the following area(s)
Server, Natives
Successfully tested on
Game builds: 3095, 3258
Platforms: Windows
Checklist
Fixes issues