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 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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
28 changes: 28 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,29 @@ std::variant<bool, std::array<CVector, 4>> CLuaVehicleDefs::OOP_GetVehicleEntryP

return entryPoints;
}

bool CLuaVehicleDefs::AddVehicleSirens(CClientVehicle* vehicle, std::uint8_t sirenType, std::uint8_t sirenCount, std::optional<bool> enable360, std::optional<bool> enableLOSCheck, std::optional<bool> enableRandomiser, std::optional<bool> enableSilent)
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
{
eClientVehicleType vehicleType = vehicle->GetVehicleType();

if (vehicleType == CLIENTVEHICLE_CAR)
{
if (sirenType >= 1 && sirenType <= 6)
{
if (sirenCount <= SIREN_COUNT_MAX)
{
vehicle->GiveVehicleSirens(sirenType, sirenCount);
vehicle->SetVehicleFlags(enable360.value_or(false), enableRandomiser.value_or(true), enableLOSCheck.value_or(true), enableSilent.value_or(false));
return true;
}
}
}
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
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, std::uint8_t sirenType, std::uint8_t sirenCount, std::optional<bool> enable360, std::optional<bool> enableLOSCheck, std::optional<bool> enableRandomiser, std::optional<bool> enableSilent );
static bool RemoveVehicleSirens(CClientVehicle* vehicle);

// Components
LUA_DECLARE(SetVehicleComponentPosition);
Expand Down
Loading