public static bool Prefix(SeaMoth __instance)
        {
            // Suppress powered on if a seamoth´s default is set to false
            GameObject gameObject         = __instance.gameObject;
            NitroxId   id                 = NitroxEntity.GetId(gameObject);
            Optional <SeamothModel> model = NitroxServiceLocator.LocateService <Vehicles>().TryGetVehicle <SeamothModel>(id);

            if (!model.HasValue)
            {
                Log.Error($"{nameof(Seamoth_SubConstructionComplete_Patch)}: Could not find {nameof(CyclopsModel)} by Nitrox id {id}.\nGO containing wrong id: {__instance.GetHierarchyPath()}");
                return(false);
            }

            // Set lights of seamoth
            ToggleLights toggleLights = gameObject.RequireComponentInChildren <ToggleLights>();

            toggleLights.lightsActive = model.Value.LightOn;
            return(model.Value.LightOn);
        }
Ejemplo n.º 2
0
        public static bool Prefix(SeaMoth __instance)
        {
            // Suppress powered on if a seamoth´s default is set to false
            GameObject gameObject         = __instance.gameObject;
            NitroxId   id                 = NitroxEntity.GetId(gameObject);
            Optional <SeamothModel> model = NitroxServiceLocator.LocateService <Vehicles>().TryGetVehicle <SeamothModel>(id);

            if (!model.HasValue)
            {
                Log.Error($"{nameof(Seamoth_SubConstructionComplete_Patch)}: Could not find {nameof(CyclopsModel)} by Nitrox id {id}.\nGO containing wrong id: {__instance.GetHierarchyPath()}");
                return(false);
            }

            // Set lights of seamoth
            Validate.NotNull(__instance.toggleLights, $"toggleLights is Null on {__instance.gameObject.name} {__instance.transform.position}");
            __instance.toggleLights.SetLightsActive(model.Value.LightOn);
            return(model.Value.LightOn);
        }