BuildingType
    name = "BLD_GAS_GIANT_GEN"
    description = "BLD_GAS_GIANT_GEN_DESC"
    buildcost = 25 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 3
    tags = "ORBITAL"
    location = And [
        Planet
        Not Contains Building name = "BLD_GAS_GIANT_GEN"
        OwnedBy empire = Source.Owner
        Planet type = GasGiant
    ]
    enqueuelocation = [[ENQUEUE_BUILD_ONE_PER_PLANET]]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_BUILDING_STABILITY_EFFECTS]]
    
        EffectsGroup
            scope = And [
                InSystem id = Source.SystemID
                Planet
                Focus type = "FOCUS_INDUSTRY"
                Not Population high = 0
                OwnedBy empire = Source.Owner
                Happiness low = (NamedReal name = "BLD_GAS_GIANT_GEN_MIN_STABILITY" value = 10)
            ]
            activation = ContainedBy And [
                Object id = Source.PlanetID
                Population high = 0
            ]
            stackinggroup = "GAS_GIANT_GEN_STACK"
            priority = [[TARGET_AFTER_2ND_SCALING_PRIORITY]]
            effects = SetTargetIndustry value = Value
                          + (NamedReal name = "BLD_GAS_GIANT_GEN_OUTPOST_TARGET_INDUSTRY_FLAT"
                                       value = 25 * [[INDUSTRY_PER_POP]])

        EffectsGroup
            scope = And [
                Planet
                InSystem id = Source.SystemID
                Focus type = "FOCUS_INDUSTRY"
                Not Population high = 0
                OwnedBy empire = Source.Owner
                Happiness low = 10
            ]
            activation = ContainedBy Not Population high = 0
            stackinggroup = "GAS_GIANT_GEN_STACK"
            priority = [[TARGET_AFTER_2ND_SCALING_PRIORITY]]
            effects = SetTargetIndustry value = Value
                          + (NamedReal name = "BLD_GAS_GIANT_GEN_COLONY_TARGET_INDUSTRY_FLAT"
                                       value = 15 * [[INDUSTRY_PER_POP]])

        EffectsGroup
            scope = Source
            activation = Not Planet type = GasGiant
            effects = Destroy
    ]
    icon = "icons/building/gas-giant-generator.png"

#include "/scripting/macros/enqueue.macros"
#include "/scripting/macros/priorities.macros"
#include "/scripting/macros/base_prod.macros"
#include "/scripting/buildings/buildings.macros"
