Skip to content

Commit

Permalink
Implement fast partmodule lookup in one more spot
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Oct 20, 2024
1 parent e493ea4 commit 0db5ddb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/RealAntennasProject/RACommNetVessel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,16 @@ protected override void OnStart()
GameEvents.CommNet.OnNetworkInitialized.Add(OnNetworkInitialized);
if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
GameEvents.onPlanetariumTargetChanged.Add(OnMapFocusChange);
foreach (ModuleDeployablePart mdp in Vessel.FindPartModulesImplementing<ModuleDeployablePart>())
foreach (Part p in vessel.parts)
{
mdp.OnMoving.Add(OnMoving);
mdp.OnStop.Add(OnStop);
List<PartModule> modules = p.FindModulesImplementingReadOnly<ModuleDeployablePart>();
foreach (ModuleDeployablePart mdp in modules)
{
mdp.OnMoving.Add(OnMoving);
mdp.OnStop.Add(OnStop);
}
}

overridePostUpdate = true;
electricChargeDef = PartResourceLibrary.Instance.GetDefinition("ElectricCharge");
}
Expand Down

0 comments on commit 0db5ddb

Please sign in to comment.