Skip to content

Commit a15bc2c

Browse files
committed
fix: Re-add trough creation that was for some reason removed in 6abe133.
1 parent 6c1c4ff commit a15bc2c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

VisualPinball.Unity/VisualPinball.Unity.Editor/Import/VpxSceneConverter.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,35 @@ private void ConfigurePlayer(Dictionary<string, IMainComponent> components)
500500
_tableGo.AddComponent<BallRollerComponent>();
501501
var dga = _tableGo.AddComponent<DefaultGamelogicEngine>();
502502

503+
// add trough if none available
504+
if (!_sourceContainer.HasTrough) {
505+
CreateTrough(components);
506+
}
507+
503508
// populate hardware
504509
_tableComponent.RepopulateHardware(dga);
505510
}
506511

512+
private void CreateTrough(Dictionary<string, IMainComponent> components)
513+
{
514+
var troughData = new TroughData("Trough") {
515+
BallCount = 4,
516+
SwitchCount = 4,
517+
Type = TroughType.ModernMech
518+
};
519+
if (_sourceContainer.Has<Kicker>("BallRelease")) {
520+
troughData.PlayfieldExitKicker = "BallRelease";
521+
}
522+
if (_sourceContainer.Has<Kicker>("Drain")) {
523+
troughData.PlayfieldEntrySwitch = "Drain";
524+
}
525+
var item = new Trough(troughData) {
526+
StorageIndex = _sourceContainer.ItemDatas.Count()
527+
};
528+
529+
InstantiateAndPersistPrefab(item, components);
530+
}
531+
507532
private void CreateFileHierarchy()
508533
{
509534
if (!Directory.Exists("Assets/Tables/")) {

0 commit comments

Comments
 (0)