FWolfe/ProfessionFramework

Is it possible to remove standard clothing

Closed this issue · 6 comments

For example, I added a profession:

ProfessionFramework.addProfession('evacuated', {
    name = "Evacuated",
    icon = "profession_evacuated",
    cost = -4,
    xp = { 
        [Perks.SmallBlunt] = 2,
        [Perks.Blunt] = 1,
        [Perks.SmallBlade] = 1,
	[Perks.Maintenance] = 2,
	[Perks.Cooking] = 1,
	[Perks.Farming] = 2,
	[Perks.Mechanics] = 1,
	[Perks.Electricity] = 2,
	[Perks.MetalWelding] = 2,
	[Perks.Woodwork] = 2,
    },
	traits = {},
	clothing = {
        Tshirt = {"Base.Tshirt_Profession_RangerBrown", "Base.Tshirt_Profession_RangerGreen"},
        Pants = {"Base.Trousers_Ranger"},
		Back = {"Base.Bag_Satchel"},
		LeftWrist = {"Base.WristWatch_Left_ClassicBlack", "Base.WristWatch_Left_ClassicBrown"},
    },
    inventory = {
        ["Base.Hammer"] = 1,
        ["Base.Pencil"] = 1,
        ["Base.TinnedBeans"] = 2,
	["Base.WaterBottleFull"] = 1,
    },
})

In the code, I added clothes that the player can choose when creating a character. Can I somehow remove the clothes that the game offers initially?

the clothing table supports 2 keys for this:

  • replace bool value, completely replaces all vanilla clothing options (default false)
  • replace_items bool value, only replace vanilla options for the BodyLocations specified in this table. (default false)

edit:
sorry, just noticed you're using a custom profession, those keys are mostly for modifying vanilla ones
there maybe additional items offered by default to all professions (its been a while since i browsed the files), PF would have no way to cleanly remove those from specific professions

I see. I will then try to remove them on my own ways) If I find a method that will not use PF, you will allow me to publish it here? Suddenly someone will also look for solutions

browsing through the files i can see shared/Definitions/ClothingSelectionDefinitions.lua has the following table:

-- default selection, always available
ClothingSelectionDefinitions.default = {
  -- snip
  }

which gets called into play at client/OptionScreens/CharacterCreationMain.lua in the function CharacterCreationMain:initClothing() (line #943) lines 957-962 are what adds the default items to the list:

  local default = ClothingSelectionDefinitions.default;
  if MainScreen.instance.desc:isFemale() then
  	self:doClothingCombo(default.Female, true);
  else
  	self:doClothingCombo(default.Male, true);
  end

so looks like theres 2 options:

  1. replace the default table, negating defaults for all professions
  2. replace the function, checking the profession before adding the defaults

Okay, I did everything)

Now, when creating a character, there are only clothes that are displayed when creating a profession.

Need to:
Create file ClothingSelectionDefinitions.lua in \YourModName\media\lua\shared

And write in it:

ClothingSelectionDefinitions = ClothingSelectionDefinitions or {};

ClothingSelectionDefinitions.default = {
	Female = {
		Hat = {
			chance = 10,
			items = {},
		},
		
		Eyes = {
			chance = 10,
			items = {},
		},
		
		TankTop = {
			chance = 10,
			items = {},
		},
		
		Shirt = {
			chance = 10,
			items = {},
		},
	
		Tshirt = {
			items = {},
		},
		
		Pants = {
			items = {},
		},
		
		Skirt = {
			chance = 50,
			items = {},
		},
		
		Socks = {
			items = {},
		},
		
		Shoes = {
			items = {},
		},
	},
	
	Male = {
		Hat = {
			chance = 10,
			items = {},
		},
		
		Eyes = {
			chance = 10,
			items = {},
		},
		
		TankTop = {
			chance = 30,
			items = {},
		},
		
		Shirt = {
			chance = 10,
			items = {},
		},
		
		Tshirt = {
			items = {},
		},
		
		Pants = {
			items = {},
		},
		
		Socks = {
			items = {},
		},
		
		Shoes = {
			items = {},
		},
	}
}

I don't know why, but if we do not specify a clothing slot in which we want to clear the standard clothing, the clothing will still be available for selection.

Might be worthwhile to rename the file to something else. If its got the same path and name as the vanilla file it will overwrite the whole file which is generally not desirable.

Closing this issue since this is essentially solved.