Skip to content

Commit e24fcd3

Browse files
committed
Game: Code cleanup
1 parent 4ed11e1 commit e24fcd3

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

Source/Statics/Game.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using static KeepCoding.ComponentPool;
5+
using static Localization;
56
using Connection = IRCConnection;
6-
using KTInfo = Assets.Scripts.Mods.ModInfo;
77
using KTInput = KTInputManager;
88
using KTMod = ModManager;
99
using KTPlayer = Assets.Scripts.Settings.PlayerSettingsManager;
1010
using KTScene = SceneManager;
11+
using KTModSourceEnum = Assets.Scripts.Mods.ModInfo.ModSourceEnum;
1112

1213
namespace KeepCoding
1314
{
@@ -131,12 +132,12 @@ public static class Mission
131132
/// <value>
132133
/// The description as it appears in the bomb binder.
133134
/// </value>
134-
public static string Description => Localization.GetLocalizedString(KTScene.Instance.GameplayState.Mission.DescriptionTerm);
135+
public static string Description => GetLocalizedString(KTScene.Instance.GameplayState.Mission.DescriptionTerm);
135136

136137
/// <value>
137138
/// The mission name as it appears in the bomb binder.
138139
/// </value>
139-
public static string DisplayName => Localization.GetLocalizedString(KTScene.Instance.GameplayState.Mission.DisplayNameTerm);
140+
public static string DisplayName => GetLocalizedString(KTScene.Instance.GameplayState.Mission.DisplayNameTerm);
140141

141142
/// <value>
142143
/// The ID of the mission.
@@ -193,12 +194,12 @@ public static class ModManager
193194
/// <value>
194195
/// Gets all of the mod paths within the <see cref="ModSourceEnum"/> constraint.
195196
/// </value>
196-
public static Func<ModSourceEnum, List<string>> GetAllModPathsFromSource => source => KTMod.Instance.GetAllModPathsFromSource((KTInfo.ModSourceEnum)source);
197+
public static Func<ModSourceEnum, List<string>> GetAllModPathsFromSource => source => KTMod.Instance.GetAllModPathsFromSource((KTModSourceEnum)source);
197198

198199
/// <value>
199200
/// Gets all of the enabled mod paths within the <see cref="ModSourceEnum"/> constraint.
200201
/// </value>
201-
public static Func<ModSourceEnum, List<string>> GetEnabledModPaths => source => KTMod.Instance.GetEnabledModPaths((KTInfo.ModSourceEnum)source);
202+
public static Func<ModSourceEnum, List<string>> GetEnabledModPaths => source => KTMod.Instance.GetEnabledModPaths((KTModSourceEnum)source);
202203
}
203204

204205
/// <summary>
@@ -288,19 +289,11 @@ public static class PlayerSettings
288289
}
289290

290291
/// <value>
291-
/// Gets the bomb by recursively looking at parent objects until it is found.
292+
/// Gets the game's internal bomb component, not to be mistaken with <see cref="KMBomb"/>.
292293
/// </value>
293294
/// <remarks>
294295
/// To prevent a reference to the game, the type is boxed in <see cref="object"/>. You can cast it to Bomb or <see cref="MonoBehaviour"/> type to restore its functionality.
295296
/// </remarks>
296-
public static Func<GameObject, object> Bomb => gameObject =>
297-
{
298-
if (gameObject.transform.parent is null)
299-
return null;
300-
301-
var bomb = gameObject.GetComponentInParent(typeof(Bomb));
302-
303-
return bomb ?? Bomb(gameObject.transform.parent.gameObject);
304-
};
297+
public static Func<GameObject, object> Bomb => gameObject => gameObject.GetComponentInParent(typeof(Bomb));
305298
}
306299
}

0 commit comments

Comments
 (0)