Skip to content
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

Adding function addVehicleSirens & removeVehicleSirens client-side #3704

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ void CLuaVehicleDefs::LoadFunctions()
{"setVehicleDoorsUndamageable", SetVehicleDoorsUndamageable},
{"setVehicleSirensOn", SetVehicleSirensOn},
{"addVehicleUpgrade", AddVehicleUpgrade},
{"addVehicleSirens", ArgumentParser<AddVehicleSirens>},
{"removeVehicleUpgrade", RemoveVehicleUpgrade},
{"removeVehicleSirens", ArgumentParser<RemoveVehicleSirens>},
{"setVehicleDoorState", SetVehicleDoorState},
{"setVehicleWheelStates", SetVehicleWheelStates},
{"setVehicleLightState", SetVehicleLightState},
Expand Down Expand Up @@ -4273,3 +4275,30 @@ std::variant<bool, std::array<CVector, 4>> CLuaVehicleDefs::OOP_GetVehicleEntryP

return entryPoints;
}

bool CLuaVehicleDefs::AddVehicleSirens(CClientVehicle* vehicle, unsigned char ucSirenType, unsigned char ucSirenCount, std::optional<bool> bEnable360, std::optional<bool> bEnableLOSCheck , std::optional<bool> bEnableRandomiser, std::optional<bool> bEnableSilent)
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
{
eClientVehicleType vehicleType = vehicle->GetVehicleType();

if (vehicleType != CLIENTVEHICLE_PLANE && vehicleType != CLIENTVEHICLE_BOAT && vehicleType != CLIENTVEHICLE_TRAILER && vehicleType != CLIENTVEHICLE_HELI &&
vehicleType != CLIENTVEHICLE_BIKE && vehicleType != CLIENTVEHICLE_BMX)
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
{
if (ucSirenType >= 1 && ucSirenType <= 6)
{
if (ucSirenCount <= SIREN_COUNT_MAX)
{
vehicle->GiveVehicleSirens(ucSirenType, ucSirenCount);
vehicle->SetVehicleFlags(bEnable360.value_or(false), bEnableRandomiser.value_or(true), bEnableLOSCheck.value_or(true), bEnableSilent.value_or(false));
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
}
}
return false;
}

bool CLuaVehicleDefs::RemoveVehicleSirens(CClientVehicle* vehicle)
{
vehicle->RemoveVehicleSirens();
return true;
}

2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class CLuaVehicleDefs : public CLuaDefs
const std::optional<eResizableVehicleWheelGroup> eWheelGroup);
static bool SetVehicleModelWheelSize(const unsigned short usModel, const eResizableVehicleWheelGroup eWheelGroup, const float fWheelSize);
static int GetVehicleWheelFrictionState(CClientVehicle* pVehicle, unsigned char wheel);
static bool AddVehicleSirens(CClientVehicle* vehicle, unsigned char ucSirenType, unsigned char ucSirenCount, std::optional<bool> bEnable360, std::optional<bool> bEnableLOSCheck, std::optional<bool> bEnableRandomiser, std::optional<bool> bEnableSilent );
static bool RemoveVehicleSirens(CClientVehicle* vehicle);

// Components
LUA_DECLARE(SetVehicleComponentPosition);
Expand Down
Loading