void evt_OnEnterFirstPerson(KerbalEVA eva) { //Hook it! if (!(eva.st_idle_fl is HookedKerbalFSMState)) { HookedKerbalFSMState newst = new HookedKerbalFSMState(eva.st_idle_fl, IsThisEVAIVA); newst.Hook(eva); newst.PreOnFixedUpdate += evtHook_PreOnFixedUpdate; newst.PostOnFixedUpdate += evtHook_PostOnFixedUpdate; } }
void evt_OnEnterFirstPerson(KerbalEVA eva) { //Hook it! ReflectedMembers.Initialize(); //********************* //***Walk/Run States*** if (!(eva.st_walk_acd is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_walk_acd, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_walk_fps is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_walk_fps, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_run_acd is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_run_acd, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_run_fps is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_run_fps, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_bound_gr_acd is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_bound_gr_acd, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_bound_gr_fps is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_bound_gr_fps, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } if (!(eva.st_bound_fl is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_bound_fl, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } //********************* //***Turn to Heading*** if (!(eva.st_heading_acquire is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_heading_acquire, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.PreOnFixedUpdate += ApplyModifiedDeltaHeading; st.Override_OnFixedUpdate = true; } //******************* //***Idle Grounded*** if (!(eva.st_idle_gr is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_idle_gr, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetJetpackManualControls; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetTurningBasisVector; st.PreOnFixedUpdate += ApplyNoForwardTarget; st.PreOnFixedUpdate += GroundedJetpackCheck_PreFixedUpdate; st.Override_OnFixedUpdate = true; } //************* //***Jumping*** if (!(eva.st_jump is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_jump, IsThisEVAIVA); st.Hook(eva); st.PreOnUpdate += Replacement_CorrectGroundedRotation; st.PreOnUpdate += Replacement_UpdateMovement; st.PreOnUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.Override_OnUpdate = true; st.Override_OnFixedUpdate = true; } //************** //***Swimming*** if (!(eva.st_swim_fwd is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_swim_fwd, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetTurningBasisVector; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetControlOrientation; st.PreOnFixedUpdate += ApplyKerbalForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.Override_OnFixedUpdate = true; } if (!(eva.st_swim_idle is HookedKerbalFSMState)) { HookedKerbalFSMState st = new HookedKerbalFSMState(eva.st_swim_idle, IsThisEVAIVA); st.Hook(eva); st.PreOnEnter += ResetJetpackManualControls; st.PreOnFixedUpdate += ForceArcadeMode; st.PreOnFixedUpdate += ResetTurningBasisVector; st.PreOnFixedUpdate += ApplyNoForwardTarget; st.PreOnFixedUpdate += Replacement_CorrectGroundedRotation; st.PreOnFixedUpdate += Replacement_UpdateMovement; st.PreOnFixedUpdate += Replacement_UpdateHeading; st.PreOnFixedUpdate += Replacement_UpdateRagdollVelocities; st.Override_OnFixedUpdate = true; } walk_start_fwd = eva.transform.forward; //directionkeypresscount = 0; //h_integral = 0f; //h_previouserror = 0f; }