1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-09-18 18:27:18 +02:00

Implement the option to specify how many times you want to allow intensive entity events to be forwarded to script callbacks.

Also expose several properties for the vehicle entity type that I forgot about.
This commit is contained in:
Sandu Liviu Catalin
2016-06-08 16:53:16 +03:00
parent 6489dfdf08
commit bc1e7dbde6
7 changed files with 202 additions and 8 deletions

View File

@@ -921,7 +921,15 @@ void Core::EmitPlayerUpdate(Int32 player_id, vcmpPlayerUpdate update_type)
if (pos != inst.mLastPosition)
{
// Trigger the event specific to this change
EmitPlayerPosition(player_id);
if (inst.mTrackPosition != 0)
{
EmitPlayerPosition(player_id);
// Should we decrease the tracked position changes?
if (inst.mTrackPosition)
{
--inst.mTrackPosition;
}
}
// Update the tracked value
inst.mLastPosition = pos;
}
@@ -980,7 +988,15 @@ void Core::EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type)
case vcmpVehicleUpdatePosition:
{
// Trigger the event specific to this change
EmitVehiclePosition(vehicle_id);
if (inst.mTrackPosition != 0)
{
EmitVehiclePosition(vehicle_id);
// Should we decrease the tracked position changes?
if (inst.mTrackPosition)
{
--inst.mTrackPosition;
}
}
// Update the tracked value
_Func->GetVehiclePosition(vehicle_id, &inst.mLastPosition.x,
&inst.mLastPosition.y, &inst.mLastPosition.z);
@@ -1019,13 +1035,19 @@ void Core::EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type)
} break;
case vcmpVehicleUpdateRotation:
{
Quaternion rot;
// Obtain the current position of this instance
_Func->GetVehicleRotation(vehicle_id, &rot.x, &rot.y, &rot.z, &rot.w);
// Trigger the event specific to this change
EmitVehicleRotation(vehicle_id);
// Update the tracked value
inst.mLastRotation = rot;
if (inst.mTrackRotation != 0)
{
EmitVehicleRotation(vehicle_id);
// Should we decrease the tracked rotation changes?
if (inst.mTrackRotation)
{
--inst.mTrackRotation;
}
}
// Obtain the current rotation of this instance
_Func->GetVehicleRotation(vehicle_id, &inst.mLastRotation.x, &inst.mLastRotation.y,
&inst.mLastRotation.z, &inst.mLastRotation.w);
} break;
default:
{