Selected CarGen using popGroup for vehicle model set

This commit is contained in:
dexyfex 2017-10-01 18:52:50 +11:00
parent 3e46c2e60a
commit 81e24ef86f
2 changed files with 24 additions and 1 deletions

View File

@ -1358,6 +1358,16 @@ namespace CodeWalker.GameFiles
BBMax = new Vector3(hlen);
}
public string NameString()
{
MetaHash mh = _CCarGen.carModel;
if ((mh == 0) && (_CCarGen.popGroup != 0))
{
mh = _CCarGen.popGroup;
}
return mh.ToString();
}
public override string ToString()
{
return _CCarGen.carModel.ToString() + ", " + Position.ToString() + ", " + _CCarGen.popGroup.ToString() + ", " + _CCarGen.livery.ToString();

View File

@ -3161,6 +3161,19 @@ namespace CodeWalker
SelectedCarGenEntity.SetOrientation(cgori);
uint carhash = cg._CCarGen.carModel;
if ((carhash == 0) && (cg._CCarGen.popGroup != 0))
{
//find the pop group... and choose a vehicle..
var stypes = Scenarios.ScenarioTypes;
if (stypes != null)
{
var modelset = stypes.GetVehicleModelSet(cg._CCarGen.popGroup);
if ((modelset != null) && (modelset.Models != null) && (modelset.Models.Length > 0))
{
carhash = JenkHash.GenHash(modelset.Models[0].NameLower);
}
}
}
if (carhash == 0) carhash = 418536135; //"infernus"
YftFile caryft = gameFileCache.GetYft(carhash);
@ -9484,7 +9497,7 @@ namespace CodeWalker
}
if (CarGenerator != null)
{
name = CarGenerator.CCarGen.carModel.ToString();
name = CarGenerator.NameString();
}
if (EntityExtension != null)
{