FieldType
    name = "FLD_NEBULA_1"
    description = "FLD_NEBULA_1_DESC"
    stealth = 0.01
    effectsgroups = [
        EffectsGroup    // shrink slowly when in no-star system
            scope = Source
            activation = And [
                Size low = 2 high = 180
                Star type = NoStar
            ]
            effects =
                SetSize value = Value + RandomNumber(-0.8, 0.3)

        EffectsGroup    // shrink slowly when in no-star system
            scope = Source
            activation = And [
                Size low = 180
                Star type = NoStar
            ]
            effects =
                SetSize value = Value + RandomNumber(-0.8, 0)

        EffectsGroup    // spawn new star when small enough
            scope = And [ 
                    System
                    Object id = Source.SystemID
                ]
            activation = And [
                Size high = 5
                Star type = NoStar
            ]
            effects = [
                SetStarType type = OneOf(White, Yellow, Orange, Red)
                GenerateSitRepMessage
                    message = "EFFECT_NEBULA"
                    label = "EFFECT_NEBULA_LABEL"
                    icon = "nebulae/nebula12.png"
                    parameters = [
                        tag = "system" data = Source.SystemID
                        ]
                    affiliation = CanSee condition = Source
                ]

        [[CREATE_PLANETS]]

        EffectsGroup    // dissipate when small
            scope = Source
            activation = Size high = 5
            effects = [
                Destroy
                CreateField type = "FLD_ACCRETION_DISC" size = 20
                AddSpecial name = "ACCRETION_DISC_SPECIAL"
            ]
    ]
    graphic = "fields/star_forming_nebula_1.png"

#include "fields.macros"
