-
-
Notifications
You must be signed in to change notification settings - Fork 479
New vehicle features functions (setVehicleSpecialFeatureEnabled) #4330
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
base: master
Are you sure you want to change the base?
Conversation
Huge W |
Wow, thank you for this contribution! |
Towing ability for tow truck and other trucks like Roadtrain will be super cool. Afaik for this to work the DFF of the vehicle needs to have a special dummy that is positioned at the tow hitch (where the trailer/vehicle will attach), right? |
@@ -27,7 +27,7 @@ void CAutomobileSAInterface::SetPanelDamage(std::uint8_t panelId, bool breakGlas | |||
if (nodeId < 0) | |||
return; | |||
|
|||
eCarNodes node = static_cast<eCarNodes>(nodeId); | |||
CarNodes::Enum node = static_cast<CarNodes::Enum>(nodeId); |
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.
How about using namespace CarNodes
and then just use WINDSCREEN
, WING_LF
and WING_RF
directly?
return; | ||
|
||
// Simple turret like in fire truck | ||
if (vehicle->pEntity->IsSpecialFeatureEnabled(VehicleFeatures::Enum::WATER_CANNON) && !vehicle->pEntity->IsSpecialFeatureEnabled(VehicleFeatures::Enum::TURRET)) |
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.
How about using namespace VehicleFeatures
and then just use WATER_CANNON
and TURRET
directly?
@@ -322,6 +323,13 @@ class CGameSA : public CGame | |||
|
|||
bool SetBuildingPoolSize(size_t size); | |||
|
|||
bool SetVehicleModelSpecialFeatureEnabled(std::uint16_t model, const VehicleFeatures::Enum& feature, bool enabled) override { return CVehicleSA::SetModelSpecialFeatureEnabled(model, feature, enabled); }; |
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.
Can be shortened to VehicleFeatures::Enum feature
because the underlying type is numerical. By passing it by ref you can potentially slow down the execution.
|
||
switch (feature) | ||
{ | ||
case WATER_CANNON: |
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 looks like the if
would fit better here.
return false; | ||
|
||
if (feature == VehicleFeatures::Enum::WATER_CANNON) | ||
if (static_cast<VehicleClass>(modelInfo->GetVehicleType()) != VehicleClass::AUTOMOBILE) |
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 dislike this style of nesting. Please, arrange the brackets around the outer if statement.
@@ -222,6 +222,13 @@ class CAutoPilot | |||
BYTE pad[56]; | |||
}; | |||
|
|||
enum class eComponentRotationAxis |
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.
enum class eComponentRotationAxis : uint8_t
This PR is the first step toward resolving #1861.
It introduces a new set of functions that allow manipulation of vehicle features. For now, only the water_cannon functionality is supported - additional features will be added in separate future PRs. These functions allow enabling or disabling the water cannon support.
Importantly, the functionality works both on a model level and on specific vehicles - this means, for example, you could implement a system where a firetruck can't use its water cannon if its tank is empty!
It works for both allocated vehicles and vanilla game vehicles.
Syntax
Available features: