Reactor component sorting

A place for discussion of making game modifications.
gaerzi
Posts: 177
Joined: Wed Jul 10, 2019 1:30 pm

Reactor component sorting

Postby gaerzi » Fri Aug 06, 2021 5:36 pm

So, as a minor quality of life thing, I made myself this:

Image

Sorting by reactors was easy. I even took the opportunity to give them a nice light cyan color instead of boring white.

Adding the Orthin busbar power converter to the mix (since it serves as a power plant, and there's the precedent of bulkheads and blast doors being listed as armor) was a problem, though. The way the code looked like, it seemed to me that the way to do that was to split the power converter away from the "capacitor" type, and then manually add it to the various lists where it needs to be added.

Changes:
Spoiler: show
@DesignerSkin1.lua:

Code: Select all

      add_dropdown_title(frames.available_frame,|) {
        'All Components',
        'Compatible Components',
        'Weapons',
        'Systems',
        'Point Defense',
        'Shields',
        'Armor',
        'Reactors', -- new addition to drop down


SYSTEMS.lua:

Code: Select all

define_system "Power Converter" {
  type = 'power_converter', -- changed from type = 'capacitor'
   drawer_type="power_converter",
   desc = [=[
      At short enough wavelengths, shield systems can experience effects related to zero-point vacuum energy.
        This busbar component converts these quantum fluctuations into continuous usable power.
   ]=],
  update_design_specs = increase_var 'power' { space_times=40, plus=20 },
}


@AvailableSystems.lua:

Code: Select all

    local armor_types = set('armor','blast_door','bulkheads')
    function filters.Armor(n)
      return armor_types[PartInfo[n].type]
    end
    local shield_types = set('shield','shield_regenerator')
    function filters.Shields(n)
      return shield_types[PartInfo[n].type]
    end
    local power_type = set('reactor', 'power_converter') -- addition start here, inspired by the armor and shield filters
    function filters.Reactors(n)
        return power_type[PartInfo[n].type]
    end -- addition ends here

    local filter=  filters[liststr] or catch(true)


PartInfo.lua:

Code: Select all

local system_types = set('shield','system','drive','reactor','bulkheads','lab','power_converter') -- adding power_converter here

Code: Select all

  Capacitor = set('capacitor','blast_door','shield_regenerator', 'power_converter'),  -- adding power_converter here too


hardpoint_icons.lua

Code: Select all

semantic_to_color = color_table {
  light = 'FFFFFF',
  capacitor = 'FFFFFF',
  heavy = 'ffb200',
  missile = '788cff',
  hangar = '788cff',
  planet = '00e57f',
  system = '00ff00',
  station = '00ff00',
  medium = 'ffff00',
  siege='eb1c25',
  unused='4963f7',
  armor='52aeff',
  reactor='80ffff', -- added that
  error = 'FF00FF',
}

Code: Select all

set_color(semantic_to_color.system,
  'shield','system','drive','bulkheads','lab','transporter') -- removed reactor
 
set_color(semantic_to_color.reactor, 'reactor', 'power_converter') -- added new line for new color

Code: Select all

set_color(white,'capacitor','shuttle','cargo','power_converter') -- added power_converter here and on the below line
set_mountname('Busbar',"capacitor", "power_converter")

Code: Select all

set_overlay('capacitor', 'capacitor', 'power_converter') -- added power_converter here too


I think I'll tinker with this a little bit more, with some other sorting functions to reduce the need to scroll through a large list of stuff. Maybe separate weapon categories by size (there's already one for point defense after all) or by type (beams, missiles, etc.). A docking category for boarding module, shuttles, transporter, and marine quarters. A "misc systems" for all the one-of-a-kind components like deep space scanner, science stations, warp lane amplifier, distortion generator...

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 5 guests

cron