| 1228 | } |
| 1229 | |
| 1230 | int CScriptObjectEntity::LoadVehicle(IFunctionHandler *pH) |
| 1231 | { |
| 1232 | //CHECK_PARAMETERS(1); |
| 1233 | _SmartScriptObject pTable(m_pScriptSystem,true); |
| 1234 | pH->GetParam(1,*pTable); |
| 1235 | bool bDestroy=false; |
| 1236 | if (pH->GetParamCount()>1) |
| 1237 | pH->GetParam(2,bDestroy); |
| 1238 | |
| 1239 | const char *filename; |
| 1240 | std::vector<pe_cargeomparams> pparts; |
| 1241 | |
| 1242 | pe_params_car params; |
| 1243 | |
| 1244 | pTable->GetValue("file",filename); |
| 1245 | pTable->GetValue("engine_power",params.enginePower); |
| 1246 | //pTable->GetValue("engine_power_back",params.enginePowerBack); |
| 1247 | pTable->GetValue("engine_maxrpm",params.engineMaxRPM); |
| 1248 | pTable->GetValue("axle_friction",params.axleFriction); |
| 1249 | pTable->GetValue("max_steer",params.maxSteer); |
| 1250 | pTable->GetValue("integration_type",params.iIntegrationType); |
| 1251 | pTable->GetValue("max_time_step_vehicle",params.maxTimeStep); |
| 1252 | float velSleep; |
| 1253 | if (pTable->GetValue("sleep_speed_vehicle",velSleep)) |
| 1254 | params.minEnergy = velSleep*velSleep; |
| 1255 | pTable->GetValue("damping_vehicle",params.damping); |
| 1256 | |
| 1257 | int i=2; |
| 1258 | char str[255]; |
| 1259 | sprintf(str,"hull1"); |
| 1260 | _SmartScriptObject pHull(m_pScriptSystem,true); |
| 1261 | while (pTable->GetValue(str,*pHull)) |
| 1262 | { |
| 1263 | pe_cargeomparams pone; |
| 1264 | pHull->GetValue("mass",pone.mass); |
| 1265 | pHull->GetValue("flags",(int&)pone.flags); |
| 1266 | pHull->GetValue("yoffset",pone.pos.y); |
| 1267 | pHull->GetValue("zoffset",pone.pos.z); |
| 1268 | pone.flagsCollider = geom_colltype3; |
| 1269 | sprintf(str,"hull%d",i++); |
| 1270 | pparts.push_back(pone); |
| 1271 | //if (i==5) break; |
| 1272 | } |
| 1273 | |
| 1274 | i=2; |
| 1275 | sprintf(str,"wheel1"); |
| 1276 | while (pTable->GetValue(str,*pHull)) |
| 1277 | { |
| 1278 | pe_cargeomparams pone; |
| 1279 | pone.density = 5000; |
| 1280 | pone.flagsCollider = geom_colltype3; |
| 1281 | pHull->GetValue("driving",pone.bDriving); |
| 1282 | pHull->GetValue("axle",pone.iAxle); |
| 1283 | pHull->GetValue("can_brake",pone.bCanBrake); |
| 1284 | |
| 1285 | pHull->GetValue("len_max",pone.lenMax); |
| 1286 | pHull->GetValue("stiffness",pone.kStiffness); |
| 1287 | pHull->GetValue("damping",pone.kDamping); |
nothing calls this directly
no test coverage detected