Fix preferred variant not getting saved when clicking on the hud

pull/403/head
Daan Vanoverloop 4 years ago
parent 6c6ad6af22
commit 299b6c6302

@ -178,7 +178,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
consumeEvents: true,
targetOnly: true,
});
detector.click.add(() => this.currentVariant.set(variant));
detector.click.add(() => this.setVariant(variant));
}
}

@ -506,12 +506,20 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
);
const newIndex = (index + 1) % availableVariants.length;
const newVariant = availableVariants[newIndex];
this.currentVariant.set(newVariant);
this.preferredVariants[metaBuilding.getId()] = newVariant;
this.setVariant(newVariant);
}
}
/**
* Sets the current variant to the given variant
*/
setVariant(variant) {
const metaBuilding = this.currentMetaBuilding.get();
this.currentVariant.set(variant);
this.preferredVariants[metaBuilding.getId()] = variant;
}
/**
* Performs the direction locked placement between two points after
* releasing the mouse

Loading…
Cancel
Save