[CPLUS plus ex] Skill Configuration - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki
Skill Configuration
Functions for configuring registered skills
Table of Contents
- setSkillConfig
- enableSkill
- disableSkill
- enableGroup
- disableGroup
- getEnabledSkillsSet
- getAllowedReusability
- getGroup
- listGroups
- saveConfiguration
- loadConfiguration
- resetToDefaults
setSkillConfig
voidcplus_plus_ex:setSkillConfig(skillId, config)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | The skill ID |
config |
table | Configuration options |
Updates configuration for a registered skill.
Config table fields:
| Field | Type | Description |
|---|---|---|
enabled |
bool | Whether skill is available for selection |
weight |
float | Probability weight (must be >= 0) |
reusability |
int | See Key Concept: Level Up Skill Reusability |
slotRestriction |
int/enum | See Key Concepts: Slot Restriction. One of cplus_plus_ex.SLOT_RESTRICTION.* |
Example:
cplus_plus_ex:setSkillConfig("Health", {
weight = 2.0, -- More likely to appear
enabled = true
})
cplus_plus_ex:setSkillConfig("PowerfulSkill", {
reusability = cplus_plus_ex.REUSABLILITY.PER_RUN,
weight = 0.5
})
cplus_plus_ex:setSkillConfig("HotHeaded", {
slotRestriction = cplus_plus_ex.SLOT_RESTRICTION.FIRST_ONLY,
})
enableSkill
voidcplus_plus_ex:enableSkill(skillId, forceApply)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | The skill ID to enable |
forceApply |
bool | Optional. After configuration has been loaded from save, calls no-op unless forceApply is true (UI uses force). Default false. |
Enables a skill, making it available for selection.
Example:
cplus_plus_ex:enableSkill("Reactor", true)
disableSkill
voidcplus_plus_ex:disableSkill(skillId, forceApply)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | The skill ID to disable |
forceApply |
bool | Optional. After configuration has been loaded from save, calls no-op unless forceApply is true (UI uses force). Default false. |
Disables a skill, preventing it from being selected.
Example:
cplus_plus_ex:disableSkill("Grid", true)
enableGroup
voidcplus_plus_ex:enableGroup(groupName)
| Argument name | Type | Description |
|---|---|---|
groupName |
string | The group to enable |
Enables a group, making it active - i.e. applying constraints
Example:
cplus_plus_ex:enableGroup("Add Move")
disableGroup
voidcplus_plus_ex:disableGroup(groupName)
| Argument name | Type | Description |
|---|---|---|
groupName |
string | The group to enable |
Disables a group - i.e. will not apply constraints
Example:
cplus_plus_ex:disableGroup("Add Health")
getEnabledSkillsSet
tablecplus_plus_ex:getEnabledSkillsSet()
Returns a map like table of enabled skill IDs (skillId -> true). This is useful for quickly checking if a skill is enabled.
Example:
local enabledSet = cplus_plus_ex:getEnabledSkillsSet()
if enabledSet["Health"] then
LOG("Health skill is enabled")
end
getAllowedReusability
tablecplus_plus_ex:getAllowedReusability(skillId)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | The skill ID |
Returns a map like table of allowed reusability values for this skill. Skills cannot be made more permissive than their registered reusability.
Example:
local allowed = cplus_plus_ex:getAllowedReusability("Health")
if allowed[cplus_plus_ex.REUSABLILITY.REUSABLE] then
LOG("Health can be set to REUSABLE")
end
getGroup
tablecplus_plus_ex:getGroup(groupName)
| Argument name | Type | Description |
|---|---|---|
groupName |
string | The group name |
Returns the group information if it exists or nil if it does not exist.
Current configs table
| Field | Type | Description |
|---|---|---|
name |
string | The group name |
skillIds |
table | skills in the group |
enabled |
boolean | If the group is enabled or not |
Example:
local add_hp = cplus_plus_ex:getGroup("Add Health")
if add_hp then
LOG("Group Add Health was created")
end
listGroups
tablecplus_plus_ex:listGroups()
Returns an array like table of the currently defined groups
Example:
local groups = cplus_plus_ex:listGroups()
if groups then
LOG("Found " .. #groups .. " groups")
end
saveConfiguration
voidcplus_plus_ex:saveConfiguration()
Generally not expected to be used by mods.
Manually saves current configuration to profile. This is already called automatically after UI changes.
Example:
-- After programmatically changing configs
cplus_plus_ex:setSkillConfig("Health", {weight = 2.0})
cplus_plus_ex:saveConfiguration()
loadConfiguration
voidcplus_plus_ex:loadConfiguration()
Generally not expected to be used by mods.
Manually loads configuration from profile. Called automatically on game start. Merges saved configuration with current defaults to preserve settings for existing skills while keeping defaults for newly registered skills.
Example:
-- Manually reload configuration
cplus_plus_ex:loadConfiguration()
resetToDefaults
voidcplus_plus_ex:resetToDefaults()
Generally not expected to be used by mods.
Resets all skill configurations to registered defaults - i.e. the values they were registered with.
Example:
cplus_plus_ex:resetToDefaults()