Jump to content

Recommended Posts

Hi everyone

 

The mod "Spider Cage" on Steam

 

Playing around with the new feature configure mod, I have options of Normal and Expert.I would love to be able to hide the recipe for none enabled prefabs.When you try to build the none enabled version of the Spider Cage  the game won't let you but, it still take your materials.So i would like to just hide it.The reason it needs to be an option is so you can't accidentally build the dangerous cage.And I don't want to make two versions of the mod.

 

Not ideal but except-able option would be no material consumption.

 

 

Any help would be great!

Edited by afro1967
Link to comment
https://forums.kleientertainment.com/forums/topic/36969-hide-it/
Share on other sites

From your modmain.lua:

local enabled = (GetModConfigData("Mode")=="on")local disabled = (GetModConfigData("Mode")=="off")		if disabled then 		PrefabFiles = {"silk_farm"}		else		if enabled then 		PrefabFiles = {"silk_farm_advanced","spider_baby"}	endendAssets = 	{		Asset("ATLAS", "images/inventoryimages/silk_farm.xml"),		Asset( "IMAGE", "minimap/silk_farm.tex" ),		Asset( "ATLAS", "minimap/silk_farm.xml" ),		}		AddMinimapAtlas("minimap/silk_farm.xml")		STRINGS = GLOBAL.STRINGS		RECIPETABS = GLOBAL.RECIPETABS		Recipe = GLOBAL.Recipe		Ingredient = GLOBAL.Ingredient		TECH = GLOBAL.TECH		GLOBAL.STRINGS.NAMES.SILK_FARM = "Spider Cage"		STRINGS.RECIPE_DESC.SILK_FARM = "Silk collection at it's best"		GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.SILK_FARM = "Hope it's strong enough!"		GLOBAL.STRINGS.NAMES.SILK_FARM_ADVANCED = "Expert Spider Cage"		STRINGS.RECIPE_DESC.SILK_FARM_ADVANCED = "Silk collection at it's best"		GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.SILK_FARM_ADVANCED = "It's no match for me!"		local silk_farm = GLOBAL.Recipe("silk_farm",	{ 		Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),		Ingredient("goldnugget", GetModConfigData("Gold Nuggets")),		Ingredient("boards", GetModConfigData("Boards")) 	},		RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )		silk_farm.atlas = "images/inventoryimages/silk_farm.xml"		local silk_farm_advanced = GLOBAL.Recipe("silk_farm_advanced",	{		Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),		Ingredient("goldnugget",GetModConfigData("Gold Nuggets")),		Ingredient("boards", GetModConfigData("Boards")) 	},		RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )		silk_farm_advanced.atlas = "images/inventoryimages/silk_farm_advanced.xml"TUNING.SILK_AMOUNT = 6

Replace

		local silk_farm_advanced = GLOBAL.Recipe("silk_farm_advanced",	{		Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),		Ingredient("goldnugget",GetModConfigData("Gold Nuggets")),		Ingredient("boards", GetModConfigData("Boards")) 	},		RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )		silk_farm_advanced.atlas = "images/inventoryimages/silk_farm_advanced.xml"

with

if enabled then        local silk_farm_advanced = GLOBAL.Recipe("silk_farm_advanced",    {        Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),        Ingredient("goldnugget",GetModConfigData("Gold Nuggets")),        Ingredient("boards", GetModConfigData("Boards"))    },        RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )        silk_farm_advanced.atlas = "images/inventoryimages/silk_farm_advanced.xml"end

Then, if the expert mode is not enabled, that "Advanced Silk Farm" recipe will not even be registered.

Does that solve your issues?

Here we almost have it but, on the recipe tab if enabled the atlas is the same as the one above it.

if not enabled the atlas shows correctly.Only one is showing at this point and recipes can be crafted.

 

if not enabled then
local silk_farm = GLOBAL.Recipe("silk_farm",
{
Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),
Ingredient("goldnugget", GetModConfigData("Gold Nuggets")),
Ingredient("boards", GetModConfigData("Boards"))
},
RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )
silk_farm.atlas = "images/inventoryimages/silk_farm.xml"
else
if enabled then
local silk_farm_advanced = GLOBAL.Recipe("silk_farm_advanced",
{
Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),
Ingredient("goldnugget",GetModConfigData("Gold Nuggets")),
Ingredient("boards", GetModConfigData("Boards"))
},
RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )
silk_farm_advanced.atlas = "images/inventoryimages/silk_farm_advanced.xml"
end
end
Edited by afro1967

 

Here we almost have it but, on the recipe tab if enabled the atlas is the same as the one above it.

if not enabled the atlas shows correctly.Only one is showing at this point and recipes can be crafted.

 

if not enabled then

local silk_farm = GLOBAL.Recipe("silk_farm",

{

Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),

Ingredient("goldnugget", GetModConfigData("Gold Nuggets")),

Ingredient("boards", GetModConfigData("Boards"))

},

RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )

silk_farm.atlas = "images/inventoryimages/silk_farm.xml"

else

if enabled then

local silk_farm_advanced = GLOBAL.Recipe("silk_farm_advanced",

{

Ingredient("spidereggsack", GetModConfigData("Spider Eggs")),

Ingredient("goldnugget",GetModConfigData("Gold Nuggets")),

Ingredient("boards", GetModConfigData("Boards"))

},

RECIPETABS.TOWN, TECH.NONE, "silk_farm_placer" )

silk_farm_advanced.atlas = "images/inventoryimages/silk_farm_advanced.xml"

end

end

 

Fixed
Although the atlas had showed before i had never added it in as an asset.
 
Thanks for the good starting place!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...