Remove Vanilla Ores
Remove Vanilla Ores
Hi all
So i'm trying to make mod that has ores but i need to remove the vanilla related ores like iron ,copper etc,however i don't know from where should i start to able to do that.Any help would be appreciated.
So i'm trying to make mod that has ores but i need to remove the vanilla related ores like iron ,copper etc,however i don't know from where should i start to able to do that.Any help would be appreciated.
Re: Remove Vanilla Ores
Code: Select all
data.raw.resource["iron-ore"] = nil
Code: Select all
data.raw.resource["iron-ore"].autoplace = nil
Re: Remove Vanilla Ores
So i've tried that and it removed the ores in-game but in map settings or while in map editing they're still there.is there a way to remove all of that as well?
Re: Remove Vanilla Ores
Maybe also:
Code: Select all
data.raw["noise-layer"]["iron-ore"] = nil
Code: Select all
data.raw["autoplace-control"]["iron-ore"] = nil
Code: Select all
data.raw["map-gen-presets"].default["rich-resources"].basic_settings.autoplace_controls["iron-ore"] = nil
data.raw["map-gen-presets"].default["rail-world"].basic_settings.autoplace_controls["iron-ore"] = nil
data.raw["map-gen-presets"].default["ribbon-world"].basic_settings.autoplace_controls["iron-ore"] = nil
Re: Remove Vanilla Ores
the first one has no effect; the ore on map generator still there and in game still there
the second one gave me this error :Error in assignID: autoplace-control with name 'iron-ore' does not exist. It was removed by my mod
the third one(presets) has no effect same as the first line
the second one gave me this error :Error in assignID: autoplace-control with name 'iron-ore' does not exist. It was removed by my mod
the third one(presets) has no effect same as the first line
Re: Remove Vanilla Ores
Here's the function I use, it removes it from all the autoplace controls and then removes the resource itself:
Code: Select all
local function RemoveResource(resource, fromResourceList)
local map_gen_presets = data.raw["map-gen-presets"]["default"]
data.raw["autoplace-control"][resource] = nil
for i, preset in pairs(map_gen_presets) do
if(preset.basic_settings and preset.basic_settings.autoplace_controls) then
preset.basic_settings.autoplace_controls[resource] = nil
end
end
if fromResourceList then
data.raw["resource"][resource] = nil
end
end
RemoveResource("iron-ore", true)
Re: Remove Vanilla Ores
Thanks for the help it workedmpratt wrote: ↑Wed Jul 15, 2020 10:11 pm Here's the function I use, it removes it from all the autoplace controls and then removes the resource itself:
Code: Select all
local function RemoveResource(resource, fromResourceList) local map_gen_presets = data.raw["map-gen-presets"]["default"] data.raw["autoplace-control"][resource] = nil for i, preset in pairs(map_gen_presets) do if(preset.basic_settings and preset.basic_settings.autoplace_controls) then preset.basic_settings.autoplace_controls[resource] = nil end end if fromResourceList then data.raw["resource"][resource] = nil end end RemoveResource("iron-ore", true)
Re: Remove Vanilla Ores
All of the above recommendations are great. Here is one more. Take a look at what what other mod authors do in their mods, particulary look at how they code their mods. I say this because, to see how an existing mod performs a specific task, and how it works can be a great way to learn new way to do stuff, and new techniques.
Hiladdar
Hiladdar
Re: Remove Vanilla Ores
Yeah I've checked multiple mods that use ores before posting this question;their structures are way different than the code above since most of them rely on other mods the author made,even though after i took all of that as reference (and changed some variables) it didn't work as the code above and it gave me many errors.Hiladdar wrote: ↑Fri Jul 17, 2020 5:58 pm All of the above recommendations are great. Here is one more. Take a look at what what other mod authors do in their mods, particulary look at how they code their mods. I say this because, to see how an existing mod performs a specific task, and how it works can be a great way to learn new way to do stuff, and new techniques.
Hiladdar
As you may guessed i'm lua noob here and i'm trying to understand the concept and change the codes to what i'm trying to achieve in my mod than just copy-paste without understanding anything,but apparently there's no updated lua tutorial for Factorio(visually) that does that for me,if you got anything similar to what i'm talking about then by all means tell me about it.
Re: Remove Vanilla Ores
Like you, when I started writing mods, I knew nothing about modding any game. I am just sharing one technique I used to learn how to mod this game, as well as learning from functional coding samples from a published mob. The other thing, that provided me was several different coding styles which work well with the lua language.Suf wrote: ↑Sat Jul 18, 2020 5:26 amYeah I've checked multiple mods that use ores before posting this question;their structures are way different than the code above since most of them rely on other mods the author made,even though after i took all of that as reference (and changed some variables) it didn't work as the code above and it gave me many errors.Hiladdar wrote: ↑Fri Jul 17, 2020 5:58 pm All of the above recommendations are great. Here is one more. Take a look at what what other mod authors do in their mods, particulary look at how they code their mods. I say this because, to see how an existing mod performs a specific task, and how it works can be a great way to learn new way to do stuff, and new techniques.
Hiladdar
As you may guessed i'm lua noob here and i'm trying to understand the concept and change the codes to what i'm trying to achieve in my mod than just copy-paste without understanding anything,but apparently there's no updated lua tutorial for Factorio(visually) that does that for me,if you got anything similar to what i'm talking about then by all means tell me about it.
Hiladdar