Override Existing (Vanilla) Object?

Place to get help with not working mods / modding interface.
EisteeMod
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed May 11, 2016 10:54 am
Contact:

Override Existing (Vanilla) Object?

Post by EisteeMod »

Hi,

can someone explain me, how to modificate the max. distance of the normal underground belt with an new technology?

This is what I actual have:

Code: Select all

data:extends({

type = "technology",
    name = "underground-belt-upgrad-MK1",
    icon = "underground-beld-upgrades/graphics/technology/underground-belt-1.png",
    effects =
    {
      {
        type = "unlock-recipe",
        recipe = "underground-belt-upgrad-MK2"


      }
    },
    prerequisites = {"logistics-2", "automation-2"},
    unit =
    {
      count = 250,
      ingredients =
      {
        {"science-pack-1", 3},
        {"science-pack-2", 2},
      },
      time = 15
    },
    order = "a-f-c",
  },

type = "technology",
    name = "underground-belt-upgrad-MK2",
    icon = "underground-beld-upgrades/graphics/technology/underground-belt-2.png",
    effects =
    {
      {

      }
    },
    prerequisites = {"underground-belt-upgrad-MK1"},
    unit =
    {
      count = 300,
      ingredients =
      {
        {"science-pack-1", 3},
        {"science-pack-2", 2},
        {"science-pack-3", 1},
      },
      time = 20
    },
    order = "a-f-d",
  },
	})
But how to change the max_distance of the standard underground beld without creating an completly new ingame item, I want to override the vanilla one.

Code: Select all

effects =
    {
      {
        type = "unlock-recipe",
        recipe = "underground-belt-upgrad-MK2"
______________________________________
first upgrade here eg.:
    type = "basic-transport-belt-to-ground",
    name = "--belt-tunnel",
    max_distance = 10
But we know, this is the wrong syntax
______________________________________
      }
Can someone help me :?
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Override Existing (Vanilla) Object?

Post by daniel34 »

Changing the existing underground belt entity would look like this (put this in the data.lua):

Code: Select all

data.raw["transport-belt-to-ground"]["basic-transport-belt-to-ground"].max_distance = 20
However, the max_distance is static to the entity and can't be changed dynamically with a technology update.

You'd need to create a new tier of underground belt (a new entity), and the player would need to replace them. Or find and replace all existing underground belts after the player researched it with your new entity.
quick links: log file | graphical issues | wiki
Post Reply

Return to “Modding help”