Custom Spawner Question

Place to get help with not working mods / modding interface.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Custom Spawner Question

Post by TheSAguy »

I created a custom Spawner, but I don't want the AI to place them when generating the world.
Is there a way to do that? I though by removing the Flag "placeable-enemy" it would solve that, but it did not.

Code: Select all

  {
    type = "unit-spawner",
    name = "Natural_Evolution_Spitter-Spawner",
    icon = "__base__/graphics/icons/biter-spawner.png",
    flags = {"placeable-player", "not-repairable"},
    max_health = 750,
    order="b-b-j",
    subgroup="enemies",
    working_sound =
    {
      sound =
      {
        {
          filename = "__base__/sound/creatures/spawner.ogg",
          volume = 1.0
        }
      },
      apparent_volume = 2
    },
    dying_sound =
    {
      {
        filename = "__base__/sound/creatures/spawner-death-1.ogg",
        volume = 1.0
      },
      {
        filename = "__base__/sound/creatures/spawner-death-2.ogg",
        volume = 1.0
      }
    },
    resistances =
    {
      {
        type = "physical",
        decrease = 2,
      },
      {
        type = "explosion",
        decrease = 5,
        percent = 25,
      },
	 {
        type = "laser",
        percent = 80,
      },
      {
        type = "fire",
        percent = 20,
      },
    },
    healing_per_tick = 0.02,
    collision_box = {{-3.2, -2.2}, {2.2, 2.2}},
    selection_box = {{-3.5, -2.5}, {2.5, 2.5}},
    pollution_absorbtion_absolute = 20,
    pollution_absorbtion_proportional = 0.01,
    pollution_to_enhance_spawning = 30000,
    corpse = "Natural_Evolution_Spitter-Spawner-corpse",
    dying_explosion = "blood-explosion-huge",
    loot =
    {
      {
        count_min = 5,
        count_max = 15,
        item = "alien-artifact",
        probability = 1
      },
    },
    max_count_of_owned_units = 10,
    max_friends_around_to_spawn = 5,
    animations =
    {
      spawner_idle_animation(0, Natural_Evolution_Spitter_Spawner_tint),
      spawner_idle_animation(1, Natural_Evolution_Spitter_Spawner_tint),
      spawner_idle_animation(2, Natural_Evolution_Spitter_Spawner_tint),
      spawner_idle_animation(3, Natural_Evolution_Spitter_Spawner_tint)
    },
    result_units = (function()
                     local res = {}
                     res[1] = {"tame-small-biter", {{0.0, 0.3}, {0.7, 0.0}}}
                     
                       -- from evolution_factor 0.3 the weight for medium-biter is linearly rising from 0 to 0.3
                       -- this means for example that when the evolution_factor is 0.45 the probability of spawning
                       -- a small biter is 66% while probability for medium biter is 33%.
                       res[2] = {"tame-medium-biter", {{0.3, 0.0}, {0.6, 0.3}, {0.8, 0.1}}}
                       -- for evolution factor of 1 the spawning probabilities are: small-biter 0%, medium-biter 1/7, big-biter 4/7, behemoth biter 3/7
                       res[3] = {"tame-big-biter", {{0.6, 0.0}, {1.0, 0.4}}}
                       res[4] = {"tame-behemoth-biter", {{0.99, 0.0}, {1.0, 0.3}}}

                     return res
                   end)(),
    -- With zero evolution the spawn rate is 5 seconds, with max evolution it is 2 seconds
    spawning_cooldown = {300, 120},
    spawning_radius = 10,
    spawning_spacing = 3,
    max_spawn_shift = 0,
    max_richness_for_spawn_shift = 100,
    autoplace =
    {
      sharpness = 0.4,
      control = "enemy-base",
      order = "b[enemy]-a[Natural_Evolution_Spitter-Spawner]",
      richness_multiplier = 1,
      richness_base = 0,
      force = "enemy",
      peaks =
      {
        {
          influence = 0,
          richness_influence = 100,
          tier_from_start_optimal = 20,
          tier_from_start_top_property_limit = 20,
          tier_from_start_max_range = 40,
        },
        {
          influence = -10.0,
          starting_area_weight_optimal = 1,
          starting_area_weight_range = 0,
          starting_area_weight_max_range = 2,
        },
        {
          influence = 0.42,
          noise_layer = "enemy-base",
          noise_octaves_difference = -1.8,
          noise_persistence = 0.5,
        },
        -- increase the size when moving further away
        {
          influence = 0.55,
          noise_layer = "enemy-base",
          noise_octaves_difference = -1.8,
          noise_persistence = 0.5,
          tier_from_start_optimal = 20,
          tier_from_start_top_property_limit = 20,
          tier_from_start_max_range = 40,
        },
      }
    }
  },
Thanks.
orzelek
Smart Inserter
Smart Inserter
Posts: 3928
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Custom Spawner Question

Post by orzelek »

Don't put the autoplace section in there and they won't spawn.
At least I think so :D
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Custom Spawner Question

Post by TheSAguy »

That did it!
Thanks.
Post Reply

Return to “Modding help”