1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-20 00:46:34 +00:00

Fix for PT CPU breaks when load state using Mash Triggers #430

This commit is contained in:
jugeeya 2023-02-10 11:31:27 -08:00
parent c1eb6409a4
commit 44aaeec375
3 changed files with 15 additions and 8 deletions

View file

@ -1,6 +1,6 @@
use crate::common::consts::*;
use crate::common::*;
use crate::training::attack_angle;
use crate::training::{attack_angle, save_states};
use crate::training::character_specific;
use crate::training::fast_fall;
use crate::training::frame_counter;
@ -142,6 +142,10 @@ unsafe fn check_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) {
}
unsafe fn should_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
if save_states::is_loading() {
return false;
}
let fighter_distance = get_fighter_distance();
MENU.mash_triggers.contains(MashTrigger::ALWAYS)
|| (MENU.mash_triggers.contains(MashTrigger::HIT) && is_in_hitstun(module_accessor))
@ -158,7 +162,8 @@ unsafe fn should_buffer(module_accessor: &mut app::BattleObjectModuleAccessor) -
|| (MENU.mash_triggers.contains(MashTrigger::GROUNDED) && is_grounded(module_accessor))
|| (MENU.mash_triggers.contains(MashTrigger::AIRBORNE) && is_airborne(module_accessor))
|| (MENU.mash_triggers.contains(MashTrigger::DISTANCE_CLOSE) && fighter_distance < DISTANCE_CLOSE_THRESHOLD)
|| (MENU.mash_triggers.contains(MashTrigger::DISTANCE_MID) && fighter_distance < DISTANCE_MID_THRESHOLD) || (MENU.mash_triggers.contains(MashTrigger::DISTANCE_FAR) && fighter_distance < DISTANCE_FAR_THRESHOLD)
|| (MENU.mash_triggers.contains(MashTrigger::DISTANCE_MID) && fighter_distance < DISTANCE_MID_THRESHOLD)
|| (MENU.mash_triggers.contains(MashTrigger::DISTANCE_FAR) && fighter_distance < DISTANCE_FAR_THRESHOLD)
}
// Temp Translation

View file

@ -95,10 +95,11 @@ static mut MIRROR_STATE: f32 = 1.0;
// MIRROR_STATE == -1 -> Do Mirror
pub unsafe fn is_killing() -> bool {
if SAVE_STATE_PLAYER.state == KillPlayer || SAVE_STATE_CPU.state == KillPlayer {
return true;
}
false
SAVE_STATE_PLAYER.state == KillPlayer || SAVE_STATE_CPU.state == KillPlayer
}
pub unsafe fn is_loading() -> bool {
SAVE_STATE_PLAYER.state != NoAction || SAVE_STATE_CPU.state != NoAction
}
pub unsafe fn should_mirror() -> f32 {

View file

@ -1,6 +1,6 @@
use crate::common::consts::*;
use crate::common::*;
use crate::training::frame_counter;
use crate::training::{frame_counter, save_states};
use crate::training::mash;
use smash::app;
use smash::app::lua_bind::*;
@ -187,7 +187,8 @@ pub fn should_hold_shield(module_accessor: &mut app::BattleObjectModuleAccessor)
}
// We should hold shield if the state requires it
if ![Shield::Hold, Shield::Infinite, Shield::Constant].contains(shield_state) {
if unsafe { save_states::is_loading() } ||
![Shield::Hold, Shield::Infinite, Shield::Constant].contains(shield_state) {
return false;
}