let any blueprint transfer configuration, not just single-building ones (if the orientation matches)
This commit is contained in:
@@ -144,24 +144,29 @@ BlueprintGhostResolved resolveBlueprintGhost(const FactoryState& state, const Ga
|
||||
findCoincidingSameTypeBuilding(state, config, type, anchor, rotation);
|
||||
if (coinciding.has_value())
|
||||
{
|
||||
// A single configurable building hands its settings over, whatever way the target
|
||||
// faces: a transfer never rotates anything, so the target's facing does not matter
|
||||
// (REQ-UI-BLUEPRINT-TRANSFER). Tested before the overlap rule, which then governs
|
||||
// only what this does not claim.
|
||||
if (blueprintHoldsOneBuilding && isConfigurableBuildingType(type))
|
||||
{
|
||||
return BlueprintGhostResolved{BlueprintGhostAction::Transfer, coinciding->id};
|
||||
}
|
||||
const bool configurable = isConfigurableBuildingType(type);
|
||||
|
||||
// Otherwise the building the blueprint wants must already be there in full,
|
||||
// facing the same way, because nothing here may re-orient it
|
||||
// (REQ-UI-BLUEPRINT-OVERLAP). Tunnels are not excluded: nothing is rotated, so
|
||||
// the reason for their REQ-BLD-ROTATE-IN-PLACE exception does not arise.
|
||||
// The building the blueprint wants is already there, facing the same way. It
|
||||
// takes the blueprint's settings if it has any to take (REQ-UI-BLUEPRINT-TRANSFER)
|
||||
// and is otherwise left exactly as it is (REQ-UI-BLUEPRINT-OVERLAP). Tunnels are
|
||||
// not excluded from the latter: nothing is rotated, so the reason for their
|
||||
// REQ-BLD-ROTATE-IN-PLACE exception does not arise.
|
||||
if (coinciding->rotation == rotation)
|
||||
{
|
||||
return BlueprintGhostResolved{BlueprintGhostAction::CompatibleOverlap,
|
||||
return BlueprintGhostResolved{configurable
|
||||
? BlueprintGhostAction::Transfer
|
||||
: BlueprintGhostAction::CompatibleOverlap,
|
||||
coinciding->id};
|
||||
}
|
||||
|
||||
// Facing the other way. Placement may not re-orient it, so this is invalid --
|
||||
// except for the deliberate one-click gesture of a single-building blueprint,
|
||||
// where a transfer rotates nothing anyway and the target's facing is beside the
|
||||
// point (REQ-UI-BLUEPRINT-TRANSFER).
|
||||
if (blueprintHoldsOneBuilding && configurable)
|
||||
{
|
||||
return BlueprintGhostResolved{BlueprintGhostAction::Transfer, coinciding->id};
|
||||
}
|
||||
return BlueprintGhostResolved{BlueprintGhostAction::Invalid, std::nullopt};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user