Project

General

Profile

Bug #13381

KSPModule class attribute has no effect

Added by yamori.yuki over 7 years ago. Updated almost 7 years ago.

Status:
Closed
Severity:
Very Low
Assignee:
Category:
Plugins/Add-Ons
Target version:
-
Start date:
12/06/2016
% Done:

100%

Version:
Platform:
Windows
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

Looking for a way to change the display name (green label above the text generated by GetInfo()) of my part module I discovered that KSPModule attribute was apparently designed to do that.
However it does not have any effect thanks to a bug in PartModule.ReflectedAttributes constructor where kspModules field is not populated correctly resulting in PartModule.ModularSetup() ignoring the module name from KSPModule and always using the class name to derive the display name of the module.

Bug seems to be caused by this line:

  kspModules = (KSPModule[])moduleType.GetType().GetCustomAttributes(typeof(KSPModule), true);

which should be corrected to:
  kspModules = (KSPModule[])moduleType.GetCustomAttributes(typeof(KSPModule), true);

because moduleType already refers to the class

Notes:
  • PartModule.GUIName is not virtual, so it cannot be overriden.
  • There is no other way to change the private field used by PartModule.GUIName
  • other fields/properties with "name" in them have different use.
  • This does not look like intentionally disabled. There are cleaner (and clearer) ways.
  • This has practically no impact even for moddes. It's just something that is broken and trivial to fix.

History

#1 Updated by JPLRepo over 7 years ago

  • Status changed from New to Investigating
  • Assignee set to JPLRepo
  • % Done changed from 0 to 20

#3 Updated by JPLRepo over 7 years ago

  • Status changed from Investigating to Confirmed
  • % Done changed from 20 to 10

#4 Updated by JPLRepo about 7 years ago

  • Status changed from Confirmed to Ready to Test
  • % Done changed from 10 to 80

This has been fixed in the 1.2.9 Pre-Release

#5 Updated by Squelch almost 7 years ago

  • Status changed from Ready to Test to Resolved
  • % Done changed from 80 to 100

#6 Updated by Squelch almost 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF