-
Notifications
You must be signed in to change notification settings - Fork 5
Category
This component implement categories logic for you custom components.
"Category" : { "CategoryID" : "MyCategory", "Tag" : "sometag" }
"Category" : [
{ "CategoryID" : "MyCategory1" },
{ "CategoryID" : "MyCategory2" },
]
- CategoryID - Category name
- Tag - Sub Category(if empty - component def id will be used) for mixing check
To control how Category work you need CategoryDescriptor for it. You can add it by code using CustomComponents.Control.AddCategory() or add it to Setting sections of mod.json.
Control Category behaviour, each CategoryID need CategoryDescriptor for work, if descriptor not present - default one will be created with default behaviour(same as default game item)
Descriptor can be added by code Using CustomComponent.AddCategory() or with json using mod.json for cc in section "Categories" : [];
Current implemented parameters are:
- string Name; - same as CategoryID parameter on component
- string displayName; - this string will be shown in error messages, if empty Name will be used.
- int MaxEquiped = -1; - maximum of items of same category on mech, if <= 0 - ignored
- bool ReplaceAnyLocation = false; - only work with MaxEquiped > 0 and AutoReplace == true, allow replace item at any location, not only same location where item installing.
- int MaxEquipedPerLocation = -1; - maximum items of same category per location
- int MinEquiped = 0; - minimum items of this category in mech. if not enought - mech design cannot be saved and mech cannot be used in battle
- bool AllowMixTags = true; - allow mix different tagged(Category.Tag) items of same category on mech.
- bool AutoReplace = false; - auto replace item os same category by droping it on mech when maximum reached(if MaxEquip or MaxEquipPerLocation set). like weapon when all hardpoint used
- bool AddCategoryToDescription = true; - add category display name to item tooltip
Implement TableTop rule "only one heatsink type per mech"
open mod.json of CustomComponents and add to "Categories" : []
next definition:
{
"Name": "HeatSink",
"displayName": "Heat Sink",
"AllowMixTags" : false
}
- Inside your mod folder create some folder, for example "data/heatsink"
- Add to mod.json of your mod
"Manifest": [
{
"Type": "HeatSinkDef",
"Path": "data/heatsink/"
"ShouldMergeJSON": false
}
]
-
Copy
Gear_HeatSink_Generic_Standard.json
andGear_HeatSink_Generic_Double.json
from game StreamingAssets/data/heatsink to created on first step folder. Also copyGear_HeatSink_Generic_Standard.json
toGear_HeatSink_Generic_Advanced.json
for making Heat Sink + -
Add to standard heatsink
{
"Custom" : {
"Category" : { "CategoryID" : "HeatSink", "Tag" : "Single" }
},
... left rest of definition as is ...
}
- Add and edit advanced heatsink
{
"Custom" : {
"Category" : { "CategoryID" : "HeatSink", "Tag" : "Single" }
},
"DissipationCapacity" : 4, //real value of heat sink bonus
"Description" : {
"Id" : "Gear_HeatSink_Generic_Advanced",
... edit description as you want ...
},
"BonusValueA" : "- 4 Heat / Turn", //just a text for bonus
... rest of definition ...
}
- Add to double
{
"Custom" : {
"Category" : { "CategoryID" : "HeatSink", "Tag" : "Double" }
},
... rest of definition ...
}
note: for testing purposes also remove "component_type_lostek" from "ComponentTags", so it will appear in scrimish mechlab and you can check how it work without complete half of storyline
...and done.
now you have 3 heat sinks HeatSink, HeatSink+, Double HeatSink. HS and HS+ can be equiped same time as both count as single while HS and DHS or HS+ and DHS not
Error Messages can be changed using same CategoryDescriptor class. Default values
-
parameters
-
- {0} - displayName
-
AddAlreadyEquiped = "{0} already installed on mech"
- you put item on mech with MaxEquiped = 1(unique item per mech) and it already present. when AutoReplace = true and you drop item in same location - it replace it without warning. -
AddAlreadyEquipedLocation = "{0} already installed on {1}
- same with MaxEqipedPerLocation = 1(unique per location) -
- {1} - location name
-
AddMaximumReached = "Mech already have {1} of {0} installed"
- you put item with MaxEquiped > 1 -
- {1} - allowed count
-
AddMaximumLocationReached = "Mech already have {1} of {0} installed at {2}"
- same with MaxEqipedPerLocation > 1 -
- {1} - allowed count
-
- {2} - location name
-
AddMixed = "Mech can have only one type of {0}"
- when you try mix items from same category and AllowMixTags = false
-
- {0} - displayName.ToUpper()
-
- {1} - displayName
-
ValidateRequred = "MISSING {0}: This mech must mount a {1}"
- MinEquiped = 1 and no item present -
ValidateMinimum = "MISSING {0}: This mech must mount at least {2} of {1}"
- MinEquiped = {2} and not enought items present -
ValidateMixed = "WRONG {0}: Mech can have only one type of {1}"
- AllowMixTags = false and items with different tags present -
ValidateUnique = "EXCESS {0}: This mech can't mount more then one {1}"
- MaxEquiped = 1 and more then one item -
ValidateMaximum = "EXCESS {0}: This mech can't mount more then {2} of {1}"
- MaxEquiped = {2} and more then {2} items -
ValidateUniqueLocation = "EXCESS {0}: This mech can't mount more then one {1} at any location"
- same for MaxEquiped PerLocation = 1 -
ValidateMaximumLocation = "EXCESS {0}: This mech can't mount more then {2} of {1} any location"
- same for MaxEquiped PerLocation = {2}