Exemplo n.º 1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            Events["BreakWheel"].active = ModuleRobonaut.showDebug;

            wheelDamage = this.part.FindModuleImplementing <ModuleWheelDamage>();
        }
Exemplo n.º 2
0
 public ModuleWheelBaseAdaptor(Part part)
 {
     _moduleWheelBase          = part.FindModuleImplementing <ModuleWheelBase>();
     _moduleWheelMotor         = part.FindModuleImplementing <ModuleWheelMotor>();
     _moduleWheelMotorSteering = part.FindModuleImplementing <ModuleWheelMotorSteering>();
     _moduleWheelDamage        = part.FindModuleImplementing <ModuleWheelDamage>();
 }
Exemplo n.º 3
0
        public override void OnStart(StartState state)
        {
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            InitialiseSound(WheelSound, wheelSoundFile, wheelSoundVolume, true);
            _wheelSoundsEnabled = WheelSound != null && WheelSound.audio != null && wheelSoundVolume > 0;

            InitialiseSound(SkidSound, skidSoundFile, skidSoundVolume, true);
            _skidSoundsEnabled = SkidSound != null && SkidSound.audio != null && skidSoundVolume > 0;
            if (_skidSoundsEnabled)
            {
                SkidSound.audio.pitch = skidSoundPitch;
            }

            InitialiseSound(DamageSound, damageSoundFile, damageSoundVolume, false);
            _damageSoundsEnabled = DamageSound != null && DamageSound.audio != null && damageSoundVolume > 0;

            GameEvents.onGamePause.Add(OnPause);
            _moduleWheelDamage = part.FindModuleImplementing <ModuleWheelDamage>();
            if (_moduleWheelDamage != null)
            {
                _hasDamageableWheel = true;
            }
            //WheelModule.WheelDamaged += OnWheelDamage;
        }
 public ModuleWheelBaseAdaptor(Part part)
 {
     _moduleWheelBase = part.FindModuleImplementing<ModuleWheelBase>();
     _moduleWheelMotor = part.FindModuleImplementing<ModuleWheelMotor>();
     _moduleWheelMotorSteering = part.FindModuleImplementing<ModuleWheelMotorSteering>();
     _moduleWheelDamage = part.FindModuleImplementing<ModuleWheelDamage>();
 }
        private static bool PrefixFixedUpdate(ModuleWheelDamage __instance)
        {
            if (MainSystem.NetworkState < ClientState.Connected)
            {
                return(true);
            }

            return(__instance.part.crashTolerance != float.PositiveInfinity);
        }
 private static bool PrefixRequireEngineer(ModuleWheelDamage __instance)
 {
     if (FlightGlobals.ActiveVessel.VesselValues.RepairSkill.value < 0)
     {
         ScreenMessages.PostScreenMessage(Localizer.Format("#BSS_LOC_scrmsg_reqengg"));
     }
     else
     {
         __instance.SetDamaged(false);
     }
     return(false);
 }
 private static bool PrefixOverrideLvlReq(ModuleWheelDamage __instance)
 {
     if (FlightGlobals.ActiveVessel.VesselValues.RepairSkill.value < lvlReq)
     {
         // #autoLOC_214609 and #autoLOC_246904 are identical
         // bet that the smaller 214609 is for ModuleParachute, use 246904 here
         ScreenMessages.PostScreenMessage(Localizer.Format("#autoLOC_246904", lvlReq.ToString()));
     }
     else
     {
         __instance.SetDamaged(false);
     }
     return(false);
 }
Exemplo n.º 8
0
        public override void OnStart(StartState state)
        {
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            SetupParticles();
            if (scrapeSparks)
            {
                SetupLight();
            }

            if (part.Modules.Contains("ModuleWheelBase")) // Suppress the log message on failure.
            {
                moduleWheel = part.Modules["ModuleWheelBase"] as ModuleWheelBase;
            }
            if (part.Modules.Contains("ModuleWheelDamage"))
            {
                moduleWheelDamage = part.Modules["ModuleWheelDamage"] as ModuleWheelDamage;
            }
            wheelCollider = part.GetComponent <WheelCollider>();
            // No longer necessary, all wheel parts and landing gear parts are the same now - Alshain01

            /*if (wheelCollider == null)
             * {
             *  ModuleLandingGear gear = part.GetComponent<ModuleLandingGear>();
             *  if (gear != null)
             *  {
             *      wheelCollider = gear.wheelCollider;
             *  }
             * }*/

            SetupAudio();

            GameEvents.onGamePause.Add(OnPause);
            GameEvents.onGameUnpause.Add(OnUnpause);

#if DEBUG
            for (int i = 0; i < spheres.Length; i++)
            {
                spheres[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                Destroy(spheres[i].GetComponent <Collider>());
            }
            spheres[0].GetComponent <Renderer>().material.color = Color.red;
            spheres[1].GetComponent <Renderer>().material.color = Color.green;
#endif
        }
        public override void OnStart(StartState state)
        {
            Log.InitLog();
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            SetupParticles();
            if (scrapeSparks)
            {
                SetupLight();
            }

            moduleWheel = part.FindModuleImplementing <ModuleWheelBase>();
            if (moduleWheel != null)
            {
                moduleWheelDamage     = part.FindModuleImplementing <ModuleWheelDamage>();
                moduleWheelDeployment = part.FindModuleImplementing <ModuleWheelDeployment>();
                wheelCollider         = moduleWheel.wheelColliderHost.GetComponent <WheelCollider>();
                InvokeRepeating("checkLanding", 0f, 0.5f);
            }

            part.GetComponent <AudioBehaviour>().enabled = true;;

            SetupAudio();

            GameEvents.onGamePause.Add(OnPause);
            GameEvents.onGameUnpause.Add(OnUnpause);

#if DEBUG
            if (useSpheres)
            {
                for (int i = 0; i < spheres.Length; i++)
                {
                    spheres[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    Destroy(spheres[i].GetComponent <Collider>());
                }
                spheres[0].GetComponent <Renderer>().material.color = Color.red;
                spheres[1].GetComponent <Renderer>().material.color = Color.green;
                spheres[3].GetComponent <Renderer>().material.color = Color.yellow;
            }
#endif
            //_sparklauncher = gameObject.AddComponent<SparkLauncher>();
        }
Exemplo n.º 10
0
        public override void OnUpdate()
        {
            base.OnUpdate();
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            if (wheelDamage == null)
            {
                wheelDamage = this.part.FindModuleImplementing <ModuleWheelDamage>();
            }
            if (wheelDamage == null)
            {
                return;
            }

            Events["RepairWheel"].active = wheelDamage.isDamaged && !FlightGlobals.ActiveVessel.isEVA;
        }
Exemplo n.º 11
0
        public void SetupEndurance()
        {
            Debug.Log("Reductor: Enduracne Setup called");
            Part prefab = part.partInfo.partPrefab;
            ModuleWheelDamage prefabDamage = prefab.Modules.GetModule <ModuleWheelDamage>();

            if (prefabDamage == null)
            {
                return;
            }

            guiEnduranceMassModifier = enduranceMassModifier;
            checkTweakScale();

            ModuleWheelDamage wheelDamage = part.Modules.GetModule <ModuleWheelDamage>();

            wheelDamage.impactTolerance = prefabDamage.impactTolerance * tweakScaleRatio * enduranceMassModifier;
            wheelDamage.stressTolerance = prefabDamage.stressTolerance * tweakScaleRatio * enduranceMassModifier;
            float massModifier = part.mass * (enduranceMassModifier - 1);

            Debug.Log($"Reductor Endurance: impact = {wheelDamage.impactTolerance}, stress={wheelDamage.stressTolerance}" +
                      $" mass modifier={massModifier}");
        }
Exemplo n.º 12
0
        public override void OnStart(StartState state)
        {
            if (state == StartState.Editor || state == StartState.None) return;

            InitialiseSound(WheelSound, wheelSoundFile, wheelSoundVolume, true);
            _wheelSoundsEnabled = WheelSound != null && WheelSound.audio != null && wheelSoundVolume > 0;

            InitialiseSound(SkidSound, skidSoundFile, skidSoundVolume, true);
            _skidSoundsEnabled = SkidSound != null && SkidSound.audio != null && skidSoundVolume > 0;
            if (_skidSoundsEnabled) SkidSound.audio.pitch = skidSoundPitch;

            InitialiseSound(DamageSound, damageSoundFile, damageSoundVolume, false);
            _damageSoundsEnabled = DamageSound != null && DamageSound.audio != null && damageSoundVolume > 0;

            GameEvents.onGamePause.Add(OnPause);
            _moduleWheelDamage = part.FindModuleImplementing<ModuleWheelDamage>();
            if (_moduleWheelDamage != null)
                _hasDamageableWheel = true;
            //WheelModule.WheelDamaged += OnWheelDamage;
        }