BuildingType
    name = "BLD_GATEWAY_VOID"
    description = "BLD_GATEWAY_VOID_DESC"
    buildcost = 200 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 10
    location = And [
        Planet
        Not Contains Building name = "BLD_GATEWAY_VOID"
        OwnedBy empire = Source.Owner
    ]
    enqueuelocation = [[ENQUEUE_BUILD_ONE_PER_PLANET]]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_BUILDING_STABILITY_EFFECTS]]
    
        EffectsGroup
            scope = And [
                Fleet
                InSystem id = Source.SystemID
            ]
            effects = [
                Destroy
                GenerateSitRepMessage
                    message = "EFFECT_GATEWAY_VOID_DESTROY"
                    label = "EFFECT_GATEWAY_VOID_DESTROY_LABEL"
                    parameters = [
                        tag = "buildingtype" data = "BLD_GATEWAY_VOID"
                        tag = "planet" data = Source.PlanetID
                        tag = "fleet" data = Target.ID
                    ]
                    empire = Source.Owner
            ]
            
        EffectsGroup
            scope = And [
                Planet
                InSystem id = Source.SystemID
            ]
            activation = Turn low = Source.CreationTurn + 1
            priority = [[POPULATION_OVERRIDE_PRIORITY]]  // Overrides both target and current population effects
            effects = [
                SetTargetPopulation value = min(Value, 0)
                SetPopulation value = min(Value, 0)
                SetMaxSupply value = 0
                SetSupply value = 0
            ]

        EffectsGroup
            scope = InSystem id = Source.SystemID
            activation = Turn low = Source.CreationTurn + 1
            effects = SetStealth value = Value + 1000
    ]
    icon = "icons/building/monument_to_exodus.png"

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