BuildingType
    name = "BLD_SOL_ORB_GEN"
    description = "BLD_SOL_ORB_GEN_DESC"
    buildcost = 75 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 6
    tags = "ORBITAL"
    location = AND [
        Not Contains Building name = "BLD_SOL_ORB_GEN"
        OwnedBy empire = Source.Owner
        Not Star type = [Neutron BlackHole NoStar]
        ]
    EnqueueLocation = [[ENQUEUE_BUILD_ONE_PER_PLANET]]
    effectsgroups = [
        EffectsGroup
            scope = And [
                PopulationCenter
                Focus type = "FOCUS_INDUSTRY"
                OwnedBy empire = Source.Owner
                ResourceSupplyConnected empire = Source.Owner condition = Source
            ]
            activation = Star type = [Blue White]
            stackinggroup = "BLD_SOL_ORB_GEN_EFFECT"
            priority = [[VERY_LATE_PRIORITY]]
            effects = SetTargetIndustry value = Value + Target.Population * 2 * [[INDUSTRY_PER_POP]]

        EffectsGroup
            scope = And [
                PopulationCenter
                Focus type = "FOCUS_INDUSTRY"
                OwnedBy empire = Source.Owner
                ResourceSupplyConnected empire = Source.Owner condition = Source
            ]
            activation = And [
                Star type = [Yellow Orange]
                Not ResourceSupplyConnected empire = Source.Owner condition = And [
                    Building name = "BLD_SOL_ORB_GEN"
                    OwnedBy empire = Source.Owner
                    Star type = [Blue White]
                ]
            ]
            stackinggroup = "BLD_SOL_ORB_GEN_EFFECT"
            priority = [[VERY_LATE_PRIORITY]]
            effects = SetTargetIndustry value = Value + Target.Population * 1.0 * [[INDUSTRY_PER_POP]]

        EffectsGroup
            scope = And [
                PopulationCenter
                Focus type = "FOCUS_INDUSTRY"
                OwnedBy empire = Source.Owner
                ResourceSupplyConnected empire = Source.Owner condition = Source
            ]
            activation = And [
                Star type = Red
                Not ResourceSupplyConnected empire = Source.Owner condition = And [
                    Building name = "BLD_SOL_ORB_GEN"
                    OwnedBy empire = Source.Owner
                    Star type = [Yellow Orange Blue White]
                ]
            ]
            stackinggroup = "BLD_SOL_ORB_GEN_EFFECT"
            priority = [[VERY_LATE_PRIORITY]]
            effects = SetTargetIndustry value = Value + Target.Population * 0.5 * [[INDUSTRY_PER_POP]]
    ]
    icon = "icons/building/miniature_sun.png"

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