mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-26 04:12:41 +01:00
Add isStopped() in VehicleObject and CharacterObject
This commit is contained in:
parent
63711a55ab
commit
d1131a63a8
@ -132,6 +132,12 @@ public:
|
||||
void setPrimaryColour(uint8_t color);
|
||||
void setSecondaryColour(uint8_t color);
|
||||
|
||||
/**
|
||||
* @brief isStopped
|
||||
* @return True if the vehicle isn't moving
|
||||
*/
|
||||
bool isStopped() const;
|
||||
|
||||
private:
|
||||
|
||||
void registerPart(ModelFrame* mf);
|
||||
|
@ -467,8 +467,11 @@ bool CharacterObject::enterVehicle(VehicleObject* vehicle, size_t seat)
|
||||
|
||||
bool CharacterObject::isStopped() const
|
||||
{
|
||||
RW_UNIMPLEMENTED("Checking if character is stopped");
|
||||
return true;
|
||||
if (currentVehicle != nullptr) {
|
||||
return currentVehicle->isStopped();
|
||||
}
|
||||
|
||||
return controller->getCurrentActivity() == nullptr;
|
||||
}
|
||||
|
||||
VehicleObject *CharacterObject::getCurrentVehicle() const
|
||||
|
@ -752,6 +752,11 @@ void VehicleObject::setSecondaryColour(uint8_t color)
|
||||
colourSecondary = engine->data->vehicleColours[color];
|
||||
}
|
||||
|
||||
bool VehicleObject::isStopped() const
|
||||
{
|
||||
return fabsf(physVehicle->getCurrentSpeedKmHour()) < 0.75f;
|
||||
}
|
||||
|
||||
void *VehicleRaycaster::castRay(const btVector3 &from, const btVector3 &to, btVehicleRaycaster::btVehicleRaycasterResult &result)
|
||||
{
|
||||
ClosestNotMeRayResultCallback rayCallback( _vehicle->physBody, from, to );
|
||||
|
@ -688,20 +688,11 @@ bool game_character_stoped_in_volume(const ScriptArguments& args)
|
||||
glm::vec3 pp = character->getPosition();
|
||||
|
||||
if (pp.x >= min.x && pp.y >= min.y && pp.z >= min.z &&
|
||||
pp.x <= max.x && pp.y <= max.y && pp.z <= max.z )
|
||||
{
|
||||
if( character->getCurrentVehicle() != nullptr )
|
||||
{
|
||||
return character->getCurrentVehicle()->physVehicle->getCurrentSpeedKmHour() < 0.75f;
|
||||
}
|
||||
else
|
||||
{
|
||||
return character->controller->getCurrentActivity() == nullptr;
|
||||
}
|
||||
pp.x <= max.x && pp.y <= max.y && pp.z <= max.z) {
|
||||
return character->isStopped();
|
||||
}
|
||||
|
||||
if( drawCylinder )
|
||||
{
|
||||
if (drawCylinder) {
|
||||
args.getWorld()->drawAreaIndicator(AreaIndicatorInfo::Cylinder, (max+min)/2.f, (max-min)/2.f);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user