### UPDATED

### Caerulenite

###Normal
stz_caerulenite_foundry = {
    category = specialist

    swappable_data = {
        default = {
            condition_string = SPECIALIST_JOB_TRIGGER
            building_icon = building_foundry_1
        }
        # Catalytic Swap
        swap_type = {
            trigger = {
                industrial_jobs_are_catalytic_trigger = yes
            }
            name = stz_caerulenite_catalytic_technician
            desc = stz_caerulenite_catalytic_technician
            weight = 5
        }
    }

    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_being_purged = no
        is_being_assimilated = no
        is_sapient = yes
    }

    possible_precalc = can_fill_specialist_job
    possible = {
        hidden_trigger = { exists = owner }
        owner = {
            is_gestalt = no
        }
    }

    ### Replace with custom variant in the future.
    inline_script = "jobs/inf_navalcap_jobs"

    resources = {
        category = planet_metallurgists
        inline_script = "output/stz_caerulenite_foundry_output"

        upkeep = {
            stz_sr_caerulenite = 1
        }
    }

    overlord_resources = {
        category = planet_requisitioned_alloys
        produces = {
            trigger = {
                planet = {
                    has_planet_flag = has_material_requisitorium
                }
            }
            alloys = 4
        }
    }

    weight = {
        weight = @specialist_job_weight # Fairly important job
        mult = value:job_weights_modifier|JOB|stz_caerulenite_foundry|RESOURCE|alloys|
        modifier = {
            factor = 2
            is_enslaved = yes
            can_take_servant_job = no
        }
        modifier = {
            factor = 5
            has_trait = trait_cyborg_creed_of_construction
        }
    }

    inline_script = "jobs/automodding_priority_alloys"

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = specialist
                AMOUNT = local_pop_amount
            }
        }
    }
}

stz_caerulenite_catalytic_technician = {
    category = specialist

    swappable_data = {
        default = {
            condition_string = SPECIALIST_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }
    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_being_purged = no
        is_being_assimilated = no
    }

    possible = {
        always = no
    }

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = specialist
                AMOUNT = local_pop_amount
            }
        }
    }
}


###Gestalt

### Fabricator
stz_caerulenite_fabricator = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
        #Alloy Drone - auth_hive
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_hive_empire = yes
                    is_catalytic_empire = no
                    is_wilderness_empire = no
                }
            }
            name = stz_caerulenite_alloy_drone
            desc = stz_caerulenite_alloy_drone
            icon = stz_caerulenite_alloy_drone
            building_icon = building_foundry_1
            condition_string = DRONE_JOB_TRIGGER
            weight = 2
        }
        #Catalytic Drone - auth_hive
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_catalytic_empire = yes
                }
            }
            name = stz_caerulenite_catalytic_drone
            desc = stz_caerulenite_catalytic_drone
            icon = stz_caerulenite_catalytic_drone
            building_icon = building_foundry_1
            condition_string = DRONE_JOB_TRIGGER
            weight = 3
        }
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_wilderness_empire = yes
                }
            }
            name = stz_caerulenite_forgesymbiont
            desc = stz_caerulenite_forgesymbiont
            icon = stz_caerulenite_forgesymbiont
            building_icon = natural_furnace_3
            condition_string = DRONE_JOB_TRIGGER
            weight = 10
        }
    }

    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_enslaved = no
        is_being_purged = no
        is_being_assimilated = no
        is_sapient = yes
    }

    possible_precalc = can_fill_drone_job

    possible = { can_think = yes }

    resources = {
        category = planet_metallurgists
        inline_script = "output/stz_caerulenite_foundry_output"

        upkeep = {
            stz_sr_caerulenite = 1
        }
    }

    overlord_resources = {
        category = planet_requisitioned_alloys
        produces = {
            trigger = {
                planet = {
                    has_planet_flag = has_material_requisitorium
                }
            }
            alloys = 4
        }
    }

    weight = {
        weight = @complex_drone_job_weight
        mult = value:job_weights_modifier|JOB|stz_caerulenite_fabricator|RESOURCE|alloys|
        mult = value:scripted_job_weight_shroud_forged_mult
        modifier = {
            factor = 0.9
            exists = owner
            years_passed < 1
            owner = { has_valid_civic = civic_machine_assimilator }
            has_trait = trait_cybernetic
        }
    }
    inline_script = "jobs/automodding_priority_alloys"

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = complex_drone
                AMOUNT = local_pop_amount
            }
        }
    }
}

#Swap for auth_hive
stz_caerulenite_alloy_drone = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }

    possible = {
        always = no
    }
}

#Swap for is_catalytic_empire
stz_caerulenite_catalytic_drone = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }

    possible = {
        always = no
    }
}

### Viridian

###Normal
stz_viridian_foundry = {
    category = specialist

    swappable_data = {
        default = {
            condition_string = SPECIALIST_JOB_TRIGGER
            building_icon = building_foundry_1
        }
        # Catalytic Swap
        swap_type = {
            trigger = {
                industrial_jobs_are_catalytic_trigger = yes
            }
            name = stz_viridian_catalytic_technician
            desc = stz_viridian_catalytic_technician
            weight = 5
        }
    }

    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_being_purged = no
        is_being_assimilated = no
        is_sapient = yes
    }

    possible_precalc = can_fill_specialist_job
    possible = {
        hidden_trigger = { exists = owner }
        owner = {
            is_gestalt = no
        }
    }

    ### Replace with custom variant in the future.
    inline_script = "jobs/inf_navalcap_jobs"

    resources = {
        category = planet_metallurgists
        inline_script = "output/stz_viridian_foundry_output"

        upkeep = {
            stz_sr_viridisium = 1
        }
    }

    overlord_resources = {
        category = planet_requisitioned_alloys
        produces = {
            trigger = {
                planet = {
                    has_planet_flag = has_material_requisitorium
                }
            }
            alloys = 6
        }
    }

    weight = {
        weight = @specialist_job_weight # Fairly important job
        mult = value:job_weights_modifier|JOB|stz_viridian_foundry|RESOURCE|alloys|
        modifier = {
            factor = 2
            is_enslaved = yes
            can_take_servant_job = no
        }
        modifier = {
            factor = 5
            has_trait = trait_cyborg_creed_of_construction
        }
    }

    inline_script = "jobs/automodding_priority_alloys"

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = specialist
                AMOUNT = local_pop_amount
            }
        }
    }
}

stz_viridian_catalytic_technician = {
    category = specialist

    swappable_data = {
        default = {
            condition_string = SPECIALIST_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }
    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_being_purged = no
        is_being_assimilated = no
    }

    possible = {
        always = no
    }

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = specialist
                AMOUNT = local_pop_amount
            }
        }
    }
}

###Gestalt

### Fabricator
stz_viridian_fabricator = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
        #Alloy Drone - auth_hive
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_hive_empire = yes
                    is_catalytic_empire = no
                    is_wilderness_empire = no
                }
            }
            name = stz_viridian_alloy_drone
            desc = stz_viridian_alloy_drone
            icon = stz_viridian_alloy_drone
            building_icon = building_foundry_1
            condition_string = DRONE_JOB_TRIGGER
            weight = 2
        }
        #Catalytic Drone - auth_hive
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_catalytic_empire = yes
                }
            }
            name = stz_viridian_catalytic_drone
            desc = stz_viridian_catalytic_drone
            icon = stz_viridian_catalytic_drone
            building_icon = building_foundry_1
            condition_string = DRONE_JOB_TRIGGER
            weight = 3
        }
        swap_type = {
            trigger = {
                exists = owner
                owner = {
                    is_wilderness_empire = yes
                }
            }
            name = stz_viridian_forgesymbiont
            desc = stz_viridian_forgesymbiont
            icon = stz_viridian_forgesymbiont
            building_icon = natural_furnace_3
            condition_string = DRONE_JOB_TRIGGER
            weight = 10
        }
    }

    tags = { alloys }

    possible_pre_triggers = {
        has_owner = yes
        is_enslaved = no
        is_being_purged = no
        is_being_assimilated = no
        is_sapient = yes
    }

    possible_precalc = can_fill_drone_job

    possible = { can_think = yes }

    resources = {
        category = planet_metallurgists
        inline_script = "output/stz_viridian_foundry_output"

        upkeep = {
            stz_sr_viridisium = 1
        }
    }

    overlord_resources = {
        category = planet_requisitioned_alloys
        produces = {
            trigger = {
                planet = {
                    has_planet_flag = has_material_requisitorium
                }
            }
            alloys = 6
        }
    }

    weight = {
        weight = @complex_drone_job_weight
        mult = value:job_weights_modifier|JOB|stz_viridian_fabricator|RESOURCE|alloys|
        mult = value:scripted_job_weight_shroud_forged_mult
        modifier = {
            factor = 0.9
            exists = owner
            years_passed < 1
            owner = { has_valid_civic = civic_machine_assimilator }
            has_trait = trait_cybernetic
        }
    }
    inline_script = "jobs/automodding_priority_alloys"

    promotion = {
        time = @standard_promotion_time
        effect = {
            pop_amount_change_category = {
                CATEGORY = complex_drone
                AMOUNT = local_pop_amount
            }
        }
    }
}

#Swap for auth_hive
stz_viridian_alloy_drone = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }

    possible = {
        always = no
    }
}

#Swap for is_catalytic_empire
stz_viridian_catalytic_drone = {
    category = complex_drone

    swappable_data = {
        default = {
            condition_string = DRONE_JOB_TRIGGER
            building_icon = building_foundry_1
        }
    }

    possible = {
        always = no
    }
}