BuildingType
    name = "BLD_TERRAFORM_REVERT"
    description = "BLD_TERRAFORM_REVERT_DESC"
    buildcost = 150 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 6
    location = And [
        Planet
        Not Contains Building name = "BLD_TERRAFORM"
        Not Contains Building name = "BLD_TERRAFORM_REVERT"
        OwnedBy empire = Source.Owner
        Not Planet type = [Asteroids GasGiant]
        Not Planet type = LocalCandidate.OriginalType
    ]
    EnqueueLocation = And [
        Planet
        OwnedBy empire = Source.Owner
        Not Contains Building name = "BLD_TERRAFORM"
        Not Contains Building name = "BLD_GAIA_TRANS"
        Not HasSpecial name = "GAIA_SPECIAL"
        Not Enqueued type = Building name = "BLD_TERRAFORM"
        Not Enqueued type = Building name = "BLD_GAIA_TRANS"
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Object id = Source.PlanetID
                Planet
            ]
            effects = [
                SetPlanetType type = Target.NextCloserToOriginalPlanetType
                GenerateSitRepMessage
                    message = "EFFECT_TERRAFORM"
                    label = "EFFECT_TERRAFORM_LABEL"
                    icon = "icons/building/terraform.png"
                    parameters = tag = "planet" data = Target.ID
                    empire = Source.Owner
            ]

        EffectsGroup
            scope = Source
            effects = Destroy
    ]
    icon = "icons/building/terraform_revert.png"

#include "/scripting/common/base_prod.macros"