Page 1 of 1

Infinite Research Extender

Posted: Sat Apr 29, 2017 7:55 pm
by DJ_Coal
Hello, I'm attempting to create a mod that adds the 0.15 infinite research to many other aspects of the game. I've been trying to add another research that once completed increases the speed of the drill (very similar to the mining drill productivity research, but for speed).

I've tried to extend the research normally but It says the effects i'm using don't exist.

Code: Select all

data:extend(
{
  {
    type = "technology",
    name = "mining-speed-1",
    icon = "__base__/graphics/technology/mining-speed.png",
    --prerequisites = {"advanced-electronics"},
    effects =
    {
      {
        type = "mining-drill-speed-bonus", --I know this doesn't exist
        modifier = 0.02
      }
    },
    unit =
    {
      count_formula = "100*L",
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1},
      },
      time = 60
    },
    upgrade = true,
    max_level = "3",
    order = "c-k-f-e"
  }
})
I've tried many different effect names/types with no luck. I could possibly get this working if I had access to data.raw in control.lua but I think that's bad practice.

Can anyone point me in the right direction? Is what i'm doing even possible?

Thank you!

Re: Infinite Research Extender

Posted: Sat Apr 29, 2017 7:59 pm
by orzelek
Effects are hardcoded in game - you can't simply add new ones.

Re: Infinite Research Extender

Posted: Sat Apr 29, 2017 8:04 pm
by DJ_Coal
So there is no way to modify the mining_speed of the drill?

This bit of code works great, but it has to be used in data.lua in order to work. Is there anyway to expose mining_speed in control.lua?

Code: Select all

for _,dat in pairs(data.raw) do
	for _,items in pairs(dat) do
		-- Mining Speed
		if (string.find(items.name, "-drill") or string.find(items.name, "pumpjack")) and items.mining_speed and items.mining_speed > 0 then
			items.mining_speed = items.mining_speed * mining_multiplier;
		end
        end
end

Re: Infinite Research Extender

Posted: Sat Apr 29, 2017 8:28 pm
by Rseding91
DJ_Coal wrote:So there is no way to modify the mining_speed of the drill?

This bit of code works great, but it has to be used in data.lua in order to work. Is there anyway to expose mining_speed in control.lua?

Code: Select all

for _,dat in pairs(data.raw) do
	for _,items in pairs(dat) do
		-- Mining Speed
		if (string.find(items.name, "-drill") or string.find(items.name, "pumpjack")) and items.mining_speed and items.mining_speed > 0 then
			items.mining_speed = items.mining_speed * mining_multiplier;
		end
        end
end
No, that's not how the game works :P

Prototypes can't be changed runtime - they're immutable after the data stage of loading.

Re: Infinite Research Extender

Posted: Sat Apr 29, 2017 8:31 pm
by DJ_Coal
Bummer, thank you!