-
-
Notifications
You must be signed in to change notification settings - Fork 446
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
Add serverside isPedReloadingWeapon #3295
Add serverside isPedReloadingWeapon #3295
Conversation
@@ -68,6 +68,7 @@ CPed::CPed(CPedManager* pPedManager, CElement* pParent, unsigned short usModel) | |||
m_fGravity = 0.008f; | |||
m_bDoingGangDriveby = false; | |||
m_bStealthAiming = false; | |||
m_bReloadingWeapon = false; |
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.
It's better to move it into the member initializer list.
// Add new ones in separate structs | ||
struct | ||
{ | ||
bool bIsReloadingWeapon : 1; |
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.
Why not just put it into the existing data
struct?
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 want to maintain compatibility with older BitStream version on the server/client.
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.
For this it's enough to permute BITCOUNT depending on a bitstream version.
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.
Earlier, I tried to apply it like this, but there were issues with comparing the bitstream versions with different client <-> server versions.
bool IsReloadingWeapon() const { return m_bReloadingWeapon; } | ||
void SetReloadingWeapon(bool bState) { m_bReloadingWeapon = bState; } |
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.
noexcept
@@ -1617,3 +1620,8 @@ int CLuaPedDefs::TakeAllWeapons(lua_State* luaVM) | |||
lua_pushboolean(luaVM, false); | |||
return 1; | |||
} | |||
|
|||
bool CLuaPedDefs::IsPedReloadingWeapon(CPed* const ped) |
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.
noexcept
@@ -79,4 +79,6 @@ class CLuaPedDefs : public CLuaDefs | |||
LUA_DECLARE(SetPedHeadless); | |||
LUA_DECLARE(SetPedFrozen); | |||
LUA_DECLARE(reloadPedWeapon); | |||
|
|||
static bool IsPedReloadingWeapon(CPed* const ped); |
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.
noexcept
@@ -316,6 +319,7 @@ class CPed : public CElement | |||
bool m_bFrozen; | |||
bool m_bStealthAiming; | |||
CVehicle* m_pJackingVehicle; | |||
bool m_bReloadingWeapon; |
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.
If you could, please don't use hungarian notation: bool m_reloadingWeapon;
Adds a new function:
Related to #1525 and #1529 due to lack of compatibility with BitStream.