mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 11:22:45 +01:00
Script: 0422 (Garage Contains Car)
This commit is contained in:
parent
52477013f3
commit
8c72bd33fb
@ -431,6 +431,31 @@ bool game_is_car_inside_garage(const ScriptArguments& args)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool game_garage_contains_car(const ScriptArguments& args)
|
||||
{
|
||||
/// @todo move to garage code
|
||||
|
||||
GameWorld* gw = args.getWorld();
|
||||
const auto& garages = gw->state->garages;
|
||||
int garageIndex = args[0].integerValue();
|
||||
|
||||
RW_CHECK(garageIndex >= 0, "Garage index too low");
|
||||
RW_CHECK(garageIndex < static_cast<int>(garages.size()), "Garage index too high");
|
||||
const auto& garage = garages[garageIndex];
|
||||
|
||||
auto vehicle = static_cast<VehicleObject*>(args.getObject<VehicleObject>(1));
|
||||
if (vehicle) {
|
||||
/// @todo if this car only accepts mission cars we probably have to filter here / only check for one specific car
|
||||
auto vp = vehicle->getPosition();
|
||||
if(vp.x >= garage.min.x && vp.y >= garage.min.y && vp.z >= garage.min.z &&
|
||||
vp.x <= garage.max.x && vp.y <= garage.max.y && vp.z <= garage.max.z) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void game_disable_ped_paths(const ScriptArguments& args)
|
||||
{
|
||||
glm::vec3 min(args[0].real,args[1].real,args[2].real);
|
||||
@ -1261,6 +1286,7 @@ GameModule::GameModule()
|
||||
bindUnimplemented( 0x041E, game_set_radio, 2, "Set Radio Station" );
|
||||
|
||||
bindUnimplemented( 0x0421, game_force_rain, 1, "Force Rain" );
|
||||
bindFunction( 0x0422, game_garage_contains_car, 2, "Garage Contains Car" );
|
||||
|
||||
bindUnimplemented( 0x0426, game_create_level_transition, 6, "Create Save Cars Between Levels cube" );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user