[CPLUS plus ex] Base Classes - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki

Base Classes for Custom Skills

CPLUS+ Ex provides three base classes that simplify creating custom pilot skills. These classes handle common patterns and automatically integrate with the skill tracking system.

All base classes are available under cplus_plus_ex.baseClasses:

  • cplus_plus_ex.baseClasses.SkillTrait
  • cplus_plus_ex.baseClasses.SkillActive
  • cplus_plus_ex.baseClasses.SkillEffectModifier

When to Use Each Base Class

SkillTrait

Use when: Your skill needs to add or remove a vanilla trait on the pawn

Example use cases:

  • Adding "Flying", "Armored"
  • Visual indicators that need to persist while the skill is active

SkillActive

Use when: Your skill needs to react to game events and perform custom actions

Example use cases:

  • Skills that trigger on turn start/end
  • Skills that react to pawn movement
  • Skills that modify bonuses based on game conditions

SkillEffectModifier

Use when: Your skill needs to modify weapon damage or effects

Example use cases:

  • Adding bonus damage under certain conditions
  • Modifying damage types or amounts
  • Adding additional SpaceDamage effects (smoke, fire, push, etc.)

Note: SkillEffectModifier inherits from SkillActive.

Common Pattern

All base classes follow the same basic pattern:

-- 1. Create the skill by calling :new()
local mySkill = cplus_plus_ex.baseClasses.SomeBaseClass:new{
    id = "MySkillId",
    shortName = "My Skill",
    fullName = "My Skill Name",
    description = "What the skill does",
    -- ... other properties ...
}

-- 2. Override the appropriate method(s)
function mySkill:methodToOverride(...)
    -- Your implementation
end

-- 3. Register in init()
function mod:init()
    cplus_plus_ex:registerSkill("Custom", mySkill)  -- category required first
end

Next Steps

See the individual base class pages for detailed API documentation and examples: