Noob lua question: accessing research times, how?

Place to get help with not working mods / modding interface.
Stroomschok
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Apr 03, 2016 12:53 am
Contact:

Noob lua question: accessing research times, how?

Post by Stroomschok »

This is a basic programming question, if i look for example at the game's files:

Code: Select all

type = "technology",
    name = "bullet-damage-1",
    icon = "__base__/graphics/technology/bullet-damage.png",
    effects =
    {
      {
        type = "ammo-damage",
        ammo_category = "bullet",
        modifier = "0.1"
      }
    },
    prerequisites = {"military"},
    unit =
    {
      count = 50,
      ingredients =
      {
        {"science-pack-1", 1}
      },
      time = 30
    },
    upgrade = true,
    order = "e-l-a"
So I try the following:

Code: Select all

data.raw.technology["bullet-damage-1"].effects = {
    {
      {
        type = "ammo-damage",
        ammo_category = "bullet",
        modifier = "0.1"
      }
    },
    prerequisites = {"military"},
    unit =
    {
      count = 50,
      ingredients =
      {
        {"science-pack-1", 1}
      },
      time = 60 -- doubled for example
	}}	
But the game complains there is no such node, called bullet-damage-1. Anyone can explain me what's going wrong, because it seems to me, I'm basically doing just the same like (which works fine):

Code: Select all

data.raw.recipe["steel-chest"].energy_required = 6
data.raw.recipe["steel-chest"].ingredients = {{"steel-plate", 10}}
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Noob lua question: accessing research times, how?

Post by Choumiko »

You're trying to assign the complete bullet-damage-1 research to effects.
To change the time use

Code: Select all

data.raw.technology["bullet-damage-1"].unit.time = 60
Stroomschok
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Apr 03, 2016 12:53 am
Contact:

Re: Noob lua question: accessing research times, how?

Post by Stroomschok »

Ah, thanks! I think I tried something like that, but must have made a small typo or something, and went in circles after that trying to make it work.
Post Reply

Return to “Modding help”