Page 1 of 1
[0.3.0] Unlock your items from the default technologies
Posted: Sat Mar 30, 2013 4:35 pm
by I_IBlackI_I
Hello,
Is there a way to unlock my crafting recipies after the person researched "automation".
Or do i need to make my own technologies,
thanks,
I_IBlackI_I
Re: [0.3.0] Unlock your items from the default technologies
Posted: Sat Mar 30, 2013 4:49 pm
by ficolas
You can modify the technologies, read the post slpwnd posted
Re: [0.3.0] Unlock your items from the default technologies
Posted: Sat Mar 30, 2013 6:09 pm
by slpwnd
You can modify the existing technologies. Try something like this in the data.lua of your mod:
Code: Select all
local automationeffects = data.raw.technology.automation.effects
automationeffects[#automationeffects + 1] = {type="unlock-recipe", recipe="your-recipe-name-here"}
Re: [0.3.0] Unlock your items from the default technologies
Posted: Sat Mar 30, 2013 7:18 pm
by I_IBlackI_I
after an hour of trying different things it still cant load the graphics here is my mod:
http://www.mediafire.com/download.php?4l3fi2rbj5g7jqq
If some things are wrong it might also be because of me changing everything around to try to get it working

Re: [0.3.0] Unlock your items from the default technologies
Posted: Sat Mar 30, 2013 7:44 pm
by FreeER
I_IBlackI_I wrote:after an hour of trying different things it still cant load the graphics here is my mod:
http://www.mediafire.com/download.php?4l3fi2rbj5g7jqq
If some things are wrong it might also be because of me changing everything around to try to get it working

Two problems are causing this, both are spelling errors. The first inside of prototypes\entity\inserters.lua you miss-spelled in
serters when you told the game where the graphics were so it was looking in in
seters.
Second in graphic/entity/inserters the inverted-longhanded-inserter-platform has two .pngs so it is inverted-longhanded-inserter-platform.png.png. the game is looking for a picture named inverted-longhanded-inserter-platform.png so remove one .png from the filename
Re: [0.3.0] Unlock your items from the default technologies
Posted: Thu Apr 04, 2013 2:34 am
by FreeER
slpwnd wrote:You can modify the existing technologies. Try something like this in the data.lua of your mod:
Code: Select all
local automationeffects = data.raw.technology.automation.effects
automationeffects[#automationeffects + 1] = {type="unlock-recipe", recipe="your-recipe-name-here"}
I figured I'd try this out using ficolas's mod (since he forgot to add the creeper loot lol) and was wondering why I had to directly modify data.raw.creeper.loot
Initially I had
Code: Select all
creeperloot=data.raw.unit.creeper.loot
creeperloot = {
{
count_max = 10,
count_min = 2,
item = "small-alien-artifact",
probability = 1
}
}
I was expecting it to work, or error on loot being nil, since the creepers do not typically have any loot. Instead it looked like it worked but nothing dropped...was just wondering why I get no error and no loot using the local variable, and yet it works if i modify it directly.
Code: Select all
data.raw.unit.creeper.loot = {
{
count_max = 10,
count_min = 2,
item = "small-alien-artifact",
probability = 1
}
}
edit: if someone wants to test this code without having ficolas's f-mod installed all you need to do is change small-alien-artifact to alien-artifact
Re: [0.3.0] Unlock your items from the default technologies
Posted: Thu Apr 04, 2013 8:59 am
by slpwnd
FreeER wrote:
Initially I had
Code: Select all
creeperloot=data.raw.unit.creeper.loot
creeperloot = {
{
count_max = 10,
count_min = 2,
item = "small-alien-artifact",
probability = 1
}
}
I was expecting it to work, or error on loot being nil, since the creepers do not typically have any loot. Instead it looked like it worked but nothing dropped...was just wondering why I get no error and no loot using the local variable, and yet it works if i modify it directly.
This won't work because of the way Lua works. After
Code: Select all
creeperloot=data.raw.unit.creeper.loot
creeperloot variable either contains a copy of the variable in loot or "points" to it (depending whether this is mutable or immutable structure). However either way if you "rebind" the variable by
You don't change the original loot object. In the original loot there is whatever has been there before and the creeperloot will eventually go out of scope.
FreeEr wrote:
Code: Select all
data.raw.unit.creeper.loot = {
{
count_max = 10,
count_min = 2,
item = "small-alien-artifact",
probability = 1
}
}
This works because you are assigning directly into the loot.
Re: [0.3.0] Unlock your items from the default technologies
Posted: Thu Apr 04, 2013 4:50 pm
by FreeER
Ah, thanks for clarifying that for me

I started thinking it was something along those lines before I posted
but wasn't sure since I knew I'd read in one of the lua tutorials I've found that variables can 'point' to the data, but I hadn't realized (that logically) by reassigning the variable it changes the variable and not what it is pointing to

At least I did find the proper way
