Borg module action QOL: put module name into tooltips (#38750)

* Borg module action QOL: put module name into tooltips

* Fix tests

* Tidy up component lookups

* formatting

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
eoineoineoin
2025-11-01 17:13:57 +00:00
committed by GitHub
parent 4efb02609e
commit fb22cefd8d
3 changed files with 14 additions and 2 deletions

View File

@@ -65,6 +65,16 @@ public sealed partial class BorgSystem
_actions.SetEntityIcon(actEnt, uid);
if (TryComp<BorgModuleIconComponent>(uid, out var moduleIconComp))
_actions.SetIcon(actEnt, moduleIconComp.Icon);
/// Set a custom name and description on the action. The borg module action prototypes are shared across
/// all modules. Extract localized names, then populate variables with the info from the module itself.
var moduleName = Name(uid);
var actionMetaData = MetaData(component.ModuleSwapActionEntity.Value);
var instanceName = Loc.GetString("borg-module-action-name", ("moduleName", moduleName));
_metaData.SetEntityName(component.ModuleSwapActionEntity.Value, instanceName, actionMetaData);
var instanceDesc = Loc.GetString("borg-module-action-description", ("moduleName", moduleName));
_metaData.SetEntityDescription(component.ModuleSwapActionEntity.Value, instanceDesc, actionMetaData);
}
if (!TryComp(chassis, out BorgChassisComponent? chassisComp))