1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-04-26 23:49:18 +00:00

Make changes to satisfy clippy; add cargo clippy PR commenter (#223)

* raygun print frame advantage

* Don't release, but allow action for raygun-print branch

* Add as menu option, only print in that case

* revert change to workflow file

* fixes

* add workflow clippy spec
This commit is contained in:
jugeeya 2021-08-14 19:06:25 -07:00 committed by GitHub
parent d8ea6eb0ae
commit 46484bafff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 100 additions and 92 deletions

View file

@ -13,6 +13,19 @@ jobs:
image: jugeeya/cargo-skyline:2.1.0 image: jugeeya/cargo-skyline:2.1.0
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install minimal nightly rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2021-06-01
components: rustfmt, clippy
default: true
target: x86_64-unknown-linux-gnu
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
toolchain: nightly-2021-06-01
args: --all-features --target=x86_64-unknown-linux-gnu
- name: Build release NRO - name: Build release NRO
run: | run: |
PATH=$PATH:/root/.cargo/bin /root/.cargo/bin/cargo-skyline skyline build --release PATH=$PATH:/root/.cargo/bin /root/.cargo/bin/cargo-skyline skyline build --release
@ -55,29 +68,17 @@ jobs:
mkdir -p ${{env.SKYLINE_DIR}} mkdir -p ${{env.SKYLINE_DIR}}
mkdir -p ${{env.SMASH_PLUGIN_DIR}} mkdir -p ${{env.SMASH_PLUGIN_DIR}}
mkdir -p ${{env.SMASH_WEB_DIR}} mkdir -p ${{env.SMASH_WEB_DIR}}
wget https://github.com/skyline-dev/skyline/releases/download/beta/skyline.zip wget https://github.com/skyline-dev/skyline/releases/download/beta/skyline.zip
unzip skyline.zip unzip skyline.zip
mv exefs ${{env.SKYLINE_DIR}} mv exefs ${{env.SKYLINE_DIR}}
cp plugin/libtraining_modpack.nro ${{env.SMASH_PLUGIN_DIR}}/libtraining_modpack.nro cp plugin/libtraining_modpack.nro ${{env.SMASH_PLUGIN_DIR}}/libtraining_modpack.nro
wget https://github.com/ultimate-research/params-hook-plugin/releases/download/v0.1.1/libparam_hook.nro wget https://github.com/ultimate-research/params-hook-plugin/releases/download/v0.1.1/libparam_hook.nro
wget https://github.com/ultimate-research/nro-hook-plugin/releases/download/v0.1.1/libnro_hook.nro wget https://github.com/ultimate-research/nro-hook-plugin/releases/download/v0.1.1/libnro_hook.nro
cp libparam_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libparam_hook.nro cp libparam_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libparam_hook.nro
cp libnro_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnro_hook.nro cp libnro_hook.nro ${{env.SMASH_PLUGIN_DIR}}/libnro_hook.nro
cp svg/check.svg ${{env.SMASH_WEB_DIR}}/check.svg cp svg/check.svg ${{env.SMASH_WEB_DIR}}/check.svg
zip -r training_modpack_beta.zip atmosphere zip -r training_modpack_beta.zip atmosphere
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
if: github.ref == 'refs/heads/master'
with:
delete_release: true
tag_name: beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Release - name: Update Release
if: github.ref == 'refs/heads/master'
uses: meeDamian/github-release@2.0 uses: meeDamian/github-release@2.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@ -96,4 +97,4 @@ jobs:
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: full_build name: full_build
path: training_modpack_beta.zip path: training_modpack_beta.zip

View file

@ -23,6 +23,8 @@ num = "0.3.0"
num-derive = "0.3" num-derive = "0.3"
num-traits = "0.2" num-traits = "0.2"
wsl = "0.1.0" wsl = "0.1.0"
strum = "0.21.0"
strum_macros = "0.21.0"
[profile.dev] [profile.dev]
panic = "abort" panic = "abort"

View file

@ -1,6 +1,8 @@
use crate::common::get_random_int; use crate::common::get_random_int;
use core::f64::consts::PI; use core::f64::consts::PI;
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
// bitflag helper function macro // bitflag helper function macro
macro_rules! extra_bitflag_impls { macro_rules! extra_bitflag_impls {
@ -523,7 +525,7 @@ impl Delay {
} }
pub fn into_delay(&self) -> u32 { pub fn into_delay(&self) -> u32 {
return self.to_index() self.to_index()
} }
} }
@ -604,7 +606,7 @@ impl LongDelay {
} }
pub fn into_longdelay(&self) -> u32 { pub fn into_longdelay(&self) -> u32 {
return self.to_index() * 10 self.to_index() * 10
} }
} }
@ -621,10 +623,7 @@ extra_bitflag_impls! {BoolFlag}
impl BoolFlag { impl BoolFlag {
pub fn into_bool(self) -> bool { pub fn into_bool(self) -> bool {
match self { matches!(self, BoolFlag::TRUE)
BoolFlag::TRUE => true,
_ => false,
}
} }
pub fn into_string(self) -> String { pub fn into_string(self) -> String {
@ -637,8 +636,7 @@ impl BoolFlag {
#[repr(u32)] #[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, FromPrimitive)] #[derive(Debug, Clone, Copy, PartialEq, Eq, FromPrimitive, EnumIter)]
#[allow(dead_code)]
pub enum SdiStrength { pub enum SdiStrength {
Normal = 0, Normal = 0,
Medium = 1, Medium = 1,
@ -672,11 +670,11 @@ impl SdiStrength {
} }
// For input delay // For input delay
trait to_url_param { trait ToUrlParam {
fn to_url_param(&self) -> String; fn to_url_param(&self) -> String;
} }
impl to_url_param for i32 { impl ToUrlParam for i32 {
fn to_url_param(&self) -> String { fn to_url_param(&self) -> String {
self.to_string() self.to_string()
} }

View file

@ -1,12 +1,11 @@
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use crate::common::*; use crate::common::*;
use skyline::info::get_program_id; use skyline::info::get_program_id;
use skyline::nn::hid::NpadHandheldState;
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use skyline_web::{Background, BootDisplay, Webpage}; use skyline_web::{Background, BootDisplay, Webpage};
use ramhorns::{Template, Content}; use ramhorns::{Template, Content};
use strum::IntoEnumIterator;
#[derive(Content)] #[derive(Content)]
struct Slider { struct Slider {
@ -28,7 +27,7 @@ struct Toggle<'a> {
impl<'a> Toggle<'a> { impl<'a> Toggle<'a> {
pub fn new(title: &'a str, checked: bool, value: usize) -> Toggle<'a> { pub fn new(title: &'a str, checked: bool, value: usize) -> Toggle<'a> {
Toggle{ Toggle{
title: title, title,
checked: if checked { "is-appear"} else { "is-hidden" }, checked: if checked { "is-appear"} else { "is-hidden" },
index: 0, index: 0,
value, value,
@ -47,7 +46,7 @@ struct OnOffSelector<'a> {
impl <'a>OnOffSelector<'a> { impl <'a>OnOffSelector<'a> {
pub fn new(title: &'a str, checked: bool) -> OnOffSelector<'a> { pub fn new(title: &'a str, checked: bool) -> OnOffSelector<'a> {
OnOffSelector { OnOffSelector {
title: title, title,
checked: if checked { "is-appear"} else { "is-hidden" }, checked: if checked { "is-appear"} else { "is-hidden" },
default: if checked { "is-appear"} else { "is-hidden" }, default: if checked { "is-appear"} else { "is-hidden" },
} }
@ -76,7 +75,7 @@ impl<'a> SubMenu<'a> {
pub fn add_toggle(&mut self, title: &'a str, checked: bool, value: usize, default: bool) { pub fn add_toggle(&mut self, title: &'a str, checked: bool, value: usize, default: bool) {
self.toggles.push(Toggle{ self.toggles.push(Toggle{
title: title, title,
checked: if checked { "is-appear"} else { "is-hidden" }, checked: if checked { "is-appear"} else { "is-hidden" },
index: self.max_idx() + 1, index: self.max_idx() + 1,
value, value,
@ -97,7 +96,7 @@ impl<'a> SubMenu<'a> {
// TODO: Is there a more elegant way to do this? // TODO: Is there a more elegant way to do this?
// The HTML only supports a single onoffselector but the SubMenu stores it as a Vec // The HTML only supports a single onoffselector but the SubMenu stores it as a Vec
self.onoffselector.push(OnOffSelector{ self.onoffselector.push(OnOffSelector{
title: title, title,
checked: if checked { "is-appear"} else { "is-hidden" }, checked: if checked { "is-appear"} else { "is-hidden" },
default: if default { "is-appear"} else { "is-hidden" }, default: if default { "is-appear"} else { "is-hidden" },
}); });
@ -120,13 +119,13 @@ impl<'a> Menu<'a> {
pub fn add_sub_menu(&mut self, title: &'a str, id: &'a str, check_against: usize, toggles: Vec<(&'a str, usize)>, sliders: Vec<(usize,usize,usize)>, defaults: usize) { pub fn add_sub_menu(&mut self, title: &'a str, id: &'a str, check_against: usize, toggles: Vec<(&'a str, usize)>, sliders: Vec<(usize,usize,usize)>, defaults: usize) {
let mut sub_menu = SubMenu { let mut sub_menu = SubMenu {
title: title, title,
id: id, id,
toggles: Vec::new(), toggles: Vec::new(),
sliders: Vec::new(), sliders: Vec::new(),
onoffselector: Vec::new(), onoffselector: Vec::new(),
index: self.max_idx() + 1, index: self.max_idx() + 1,
check_against: check_against check_against
}; };
for toggle in toggles { for toggle in toggles {
@ -142,13 +141,13 @@ impl<'a> Menu<'a> {
pub fn add_sub_menu_sep(&mut self, title: &'a str, id: &'a str, check_against: usize, strs: Vec<&'a str>, vals: Vec<usize>, defaults: usize) { pub fn add_sub_menu_sep(&mut self, title: &'a str, id: &'a str, check_against: usize, strs: Vec<&'a str>, vals: Vec<usize>, defaults: usize) {
let mut sub_menu = SubMenu { let mut sub_menu = SubMenu {
title: title, title,
id: id, id,
toggles: Vec::new(), toggles: Vec::new(),
sliders: Vec::new(), sliders: Vec::new(),
onoffselector: Vec::new(), onoffselector: Vec::new(),
index: self.max_idx() + 1, index: self.max_idx() + 1,
check_against: check_against check_against
}; };
for i in 0..strs.len() { for i in 0..strs.len() {
@ -162,13 +161,13 @@ impl<'a> Menu<'a> {
pub fn add_sub_menu_onoff(&mut self, title: &'a str, id: &'a str, check_against: usize, checked: bool, default: usize) { pub fn add_sub_menu_onoff(&mut self, title: &'a str, id: &'a str, check_against: usize, checked: bool, default: usize) {
let mut sub_menu = SubMenu { let mut sub_menu = SubMenu {
title: title, title,
id: id, id,
toggles: Vec::new(), toggles: Vec::new(),
sliders: Vec::new(), sliders: Vec::new(),
onoffselector: Vec::new(), onoffselector: Vec::new(),
index: self.max_idx() + 1, index: self.max_idx() + 1,
check_against: check_against check_against
}; };
sub_menu.add_onoffselector(title, checked, (default & OnOff::On as usize) != 0); sub_menu.add_onoffselector(title, checked, (default & OnOff::On as usize) != 0);
@ -194,25 +193,44 @@ macro_rules! add_bitflag_submenu {
} }
} }
macro_rules! add_single_option_submenu {
($menu:ident, $title:literal, $id:ident, $e:ty) => {
paste::paste!{
let [<$id _toggles>] = Vec::new();
for val in [<$e>]::iter() {
[<$id _toggles>].push((val.into_string().as_str(), val as usize));
}
$menu.add_sub_menu(
$title,
stringify!($id),
MENU.$id as usize,
[<$id _toggles>],
[].to_vec()
);
}
}
}
pub fn set_menu_from_url(s: &str) { pub fn set_menu_from_url(s: &str) {
let base_url_len = "http://localhost/?".len(); let base_url_len = "http://localhost/?".len();
let total_len = s.len(); let total_len = s.len();
let ss: String = s.chars().skip(base_url_len).take(total_len - base_url_len).collect(); let ss: String = s.chars().skip(base_url_len).take(total_len - base_url_len).collect();
for toggle_values in ss.split("&") { for toggle_values in ss.split('&') {
let toggle_value_split = toggle_values.split("=").collect::<Vec<&str>>(); let toggle_value_split = toggle_values.split('=').collect::<Vec<&str>>();
let toggle = toggle_value_split[0]; let toggle = toggle_value_split[0];
if toggle == "" { continue; } if toggle.is_empty() { continue; }
let toggle_vals = toggle_value_split[1]; let toggle_vals = toggle_value_split[1];
let mut bits = 0; let mut bits = 0;
for toggle_val in toggle_vals.split(",") { for toggle_val in toggle_vals.split(',') {
if toggle_val == "" { continue; } if toggle_val.is_empty() { continue; }
let val = toggle_val.parse::<u32>().unwrap(); let val = toggle_val.parse::<u32>().unwrap();
bits = bits | val; bits |= val;
} }

View file

@ -13,7 +13,7 @@ pub static RAYGUN_HORIZ_OFFSET : f32 = 2.0;
|_| /|\ |_| /|\
*/ */
pub static segment_dict: [[f32; 5]; 15] = [ pub static SEGMENT_DICT: [[f32; 5]; 15] = [
[0.0, RAYGUN_HEIGHT*2.0, 0.0, 0.0, 0.25], // a [0.0, RAYGUN_HEIGHT*2.0, 0.0, 0.0, 0.25], // a
[0.0, RAYGUN_HEIGHT, RAYGUN_LENGTH, 90.0, 0.25], // b [0.0, RAYGUN_HEIGHT, RAYGUN_LENGTH, 90.0, 0.25], // b
[0.0, 0.0, RAYGUN_LENGTH, 90.0, 0.25], // c [0.0, 0.0, RAYGUN_LENGTH, 90.0, 0.25], // c
@ -35,7 +35,7 @@ pub static segment_dict: [[f32; 5]; 15] = [
Segments making up each character, each index corresponding to: Segments making up each character, each index corresponding to:
'A' through 'Z', '0' through '9', ' ', '-', '+', '#' (where '#' is all segments) 'A' through 'Z', '0' through '9', ' ', '-', '+', '#' (where '#' is all segments)
*/ */
pub static alphabet: [&str; 40] = [ pub static ALPHABET: [&str; 40] = [
"abcefg", "abcefg",
"adefijn", "adefijn",
"adef", "adef",
@ -79,7 +79,7 @@ pub static alphabet: [&str; 40] = [
]; ];
// Each index is a segment's corresponding flipped segment, for when facing left // Each index is a segment's corresponding flipped segment, for when facing left
pub static segment_rev: [char; 15] = [ pub static SEGMENT_REV: [char; 15] = [
'a', 'a',
'f', 'f',
'e', 'e',
@ -98,7 +98,7 @@ pub static segment_rev: [char; 15] = [
]; ];
fn show_segment(module_accessor: &mut app::BattleObjectModuleAccessor, z: f32, y: f32, x: f32, zrot: f32, size: f32) { fn show_segment(module_accessor: &mut app::BattleObjectModuleAccessor, z: f32, y: f32, x: f32, zrot: f32, size: f32) {
let pos = Vector3f{x : x, y : y, z : z}; let pos = Vector3f{x, y, z};
let rot = Vector3f{x : 0.0, y : 90.0, z : zrot}; let rot = Vector3f{x : 0.0, y : 90.0, z : zrot};
let random = Vector3f{x : 0.0, y : 0.0, z : 0.0}; let random = Vector3f{x : 0.0, y : 0.0, z : 0.0};
@ -126,14 +126,13 @@ fn print_char(module_accessor: &mut app::BattleObjectModuleAccessor,
to_print: char, to_print: char,
line_num: i32, line_num: i32,
horiz_offset: f32, horiz_offset: f32,
facing_left: f32) facing_left: i32)
{ {
let alph_index = alphabet_index(to_print); let alph_index = alphabet_index(to_print);
if (alph_index < 0 || alph_index >= 40) { if !(0..40).contains(&alph_index) {
return; return;
} }
let segment_str = alphabet[alph_index as usize]; let segment_str = ALPHABET[alph_index as usize];
let num_segments = segment_str.len();
let line_offset = 40.0 - ((line_num as f32) * 16.0); let line_offset = 40.0 - ((line_num as f32) * 16.0);
@ -141,10 +140,10 @@ fn print_char(module_accessor: &mut app::BattleObjectModuleAccessor,
let mut index = segment_char as i32 - 'a' as i32; let mut index = segment_char as i32 - 'a' as i32;
let segment: [f32; 5]; let segment: [f32; 5];
if facing_left == -1.0 { if facing_left == -1 {
index = segment_rev[index as usize] as i32 - 'a' as i32; index = SEGMENT_REV[index as usize] as i32 - 'a' as i32;
} }
segment = segment_dict[index as usize]; segment = SEGMENT_DICT[index as usize];
let size_mult : f32 = 0.5; let size_mult : f32 = 0.5;
@ -153,14 +152,14 @@ fn print_char(module_accessor: &mut app::BattleObjectModuleAccessor,
let mut x = segment[2] + horiz_offset; let mut x = segment[2] + horiz_offset;
let mut zrot = segment[3]; let mut zrot = segment[3];
if facing_left == -1.0 { if facing_left == -1 {
zrot *= -1.0; zrot *= -1.0;
} }
let mut size = segment[4]; let mut size = segment[4];
x *= size_mult; x *= size_mult;
x += facing_left * 5.0; x += facing_left as f32 * 5.0;
y *= size_mult; y *= size_mult;
y += 5.0; y += 5.0;
z *= size_mult; z *= size_mult;
@ -179,12 +178,12 @@ pub fn print_string(module_accessor: &mut app::BattleObjectModuleAccessor, to_wr
let mut horiz_offset = 0.0; let mut horiz_offset = 0.0;
let mut char_num = 0; let mut char_num = 0;
let mut facing_left: f32 = 1.0; let facing_left: i32;
unsafe { unsafe {
facing_left = app::lua_bind::PostureModule::lr(module_accessor); facing_left = app::lua_bind::PostureModule::lr(module_accessor) as i32;
} }
if (to_write.len() <= 8 && !to_write.contains("\n")) { if to_write.len() <= 8 && !to_write.contains('\n') {
line_num = 1; line_num = 1;
} }
for curr_char in to_write.chars() { for curr_char in to_write.chars() {
@ -200,12 +199,12 @@ pub fn print_string(module_accessor: &mut app::BattleObjectModuleAccessor, to_wr
char_num += 1; char_num += 1;
// short characters // short characters
if curr_char == 'D' || curr_char == '1' { if curr_char == 'D' || curr_char == '1' {
horiz_offset += facing_left * (RAYGUN_LENGTH/2.0 + 3.0); horiz_offset += facing_left as f32 * (RAYGUN_LENGTH/2.0 + 3.0);
} else { } else {
horiz_offset += facing_left * (RAYGUN_LENGTH + 3.0); horiz_offset += facing_left as f32 * (RAYGUN_LENGTH + 3.0);
} }
if (char_num > 8) { if char_num > 8 {
horiz_offset = 0.0; horiz_offset = 0.0;
char_num = 0; char_num = 0;
line_num += 1; line_num += 1;

View file

@ -1,7 +1,7 @@
use std::fs; use std::fs;
use std::io::Write; use std::io::Write;
use skyline_web::DialogOk; use skyline_web::DialogOk;
const CURRENT_VERSION: &'static str = env!("CARGO_PKG_VERSION"); const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
const VERSION_FILE_PATH: &str = "sd:/TrainingModpack/version.txt"; const VERSION_FILE_PATH: &str = "sd:/TrainingModpack/version.txt";
fn is_current_version(fpath: &str) -> bool { fn is_current_version(fpath: &str) -> bool {
@ -9,7 +9,7 @@ fn is_current_version(fpath: &str) -> bool {
if fs::metadata(fpath).is_err() { if fs::metadata(fpath).is_err() {
let _ = fs::File::create(fpath).expect("Could not create version file!"); let _ = fs::File::create(fpath).expect("Could not create version file!");
} }
let content = fs::read_to_string(fpath).unwrap_or("".to_string()); let content = fs::read_to_string(fpath).unwrap_or_else(|_| "".to_string());
content == CURRENT_VERSION content == CURRENT_VERSION
} }

View file

@ -216,11 +216,10 @@ unsafe fn mod_handle_attack(lua_state: u64) {
// necessary if param object fails // necessary if param object fails
// hacky way of forcing no shield damage on all hitboxes // hacky way of forcing no shield damage on all hitboxes
if MENU.shield_state == Shield::Infinite { if MENU.shield_state == Shield::Infinite {
let hitbox_params: Vec<L2CValue> = let mut hitbox_params: Vec<L2CValue> =
(0..36).map(|i| l2c_agent.pop_lua_stack(i + 1)).collect(); (0..36).map(|i| l2c_agent.pop_lua_stack(i + 1)).collect();
l2c_agent.clear_lua_stack(); l2c_agent.clear_lua_stack();
for i in 0..36 { for (i, mut x) in hitbox_params.iter_mut().enumerate().take(36) {
let mut x = hitbox_params[i];
if i == 20 { if i == 20 {
l2c_agent.push_lua_stack(&mut L2CValue::new_num(-999.0)); l2c_agent.push_lua_stack(&mut L2CValue::new_num(-999.0));
} else { } else {

View file

@ -2,6 +2,7 @@
#![feature(with_options)] #![feature(with_options)]
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(exclusive_range_pattern)] #![feature(exclusive_range_pattern)]
#![allow(clippy::borrow_interior_mutable_const, clippy::not_unsafe_ptr_arg_deref, clippy::missing_safety_doc, clippy::wrong_self_convention)]
pub mod common; pub mod common;
mod hazard_manager; mod hazard_manager;
@ -103,7 +104,7 @@ pub fn main() {
} }
let ovl_path = "sd:/switch/.overlays/ovlTrainingModpack.ovl"; let ovl_path = "sd:/switch/.overlays/ovlTrainingModpack.ovl";
if !fs::metadata(ovl_path).is_err() { if fs::metadata(ovl_path).is_ok() {
log!("Removing ovlTrainingModpack.ovl..."); log!("Removing ovlTrainingModpack.ovl...");
fs::remove_file(ovl_path).unwrap(); fs::remove_file(ovl_path).unwrap();
} }

View file

@ -110,12 +110,11 @@ pub unsafe fn is_enable_transition_term(
} }
// Disallow the default cliff-climb if we are waiting // Disallow the default cliff-climb if we are waiting
if LEDGE_CASE == LedgeOption::WAIT || frame_counter::get_frame_count(LEDGE_DELAY_COUNTER) < LEDGE_DELAY { if (LEDGE_CASE == LedgeOption::WAIT || frame_counter::get_frame_count(LEDGE_DELAY_COUNTER) < LEDGE_DELAY) &&
if term == *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CLIFF_CLIMB { term == *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CLIFF_CLIMB {
return Some(false); return Some(false);
}
} }
return None None
} }
pub fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) { pub fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) {

View file

@ -115,7 +115,7 @@ pub unsafe fn get_param_float(
handle_oos_offset(module_accessor); handle_oos_offset(module_accessor);
} }
return handle_shield_decay(param_type, param_hash); handle_shield_decay(param_type, param_hash)
} }
// Shield Decay//Recovery // Shield Decay//Recovery
@ -144,7 +144,7 @@ fn handle_shield_decay(param_type: u64, param_hash: u64) -> Option<f32> {
return Some(999.0); return Some(999.0);
} }
return None; None
} }
pub unsafe fn param_installer() { pub unsafe fn param_installer() {
@ -323,10 +323,7 @@ fn needs_oos_handling_drop_shield() -> bool {
} }
pub fn is_aerial(action: Action) -> bool { pub fn is_aerial(action: Action) -> bool {
match action { matches!(action, Action::NAIR | Action::FAIR | Action::BAIR | Action::UAIR | Action::DAIR)
Action::NAIR | Action::FAIR | Action::BAIR | Action::UAIR | Action::DAIR => true,
_ => false,
}
} }
// Needed for shield drop options // Needed for shield drop options

View file

@ -43,20 +43,15 @@ unsafe fn mod_handle_change_status(
let state: TechFlags = MENU.tech_state.get_random(); let state: TechFlags = MENU.tech_state.get_random();
let grnd_teched = handle_grnd_tech(module_accessor, status_kind, unk, status_kind_int, state); if handle_grnd_tech(module_accessor, status_kind, unk, status_kind_int, state) {
if grnd_teched {
return; return;
} }
let wall_teched = handle_wall_tech(module_accessor, status_kind, unk, status_kind_int, state); if handle_wall_tech(module_accessor, status_kind, unk, status_kind_int, state) {
if wall_teched {
return; return;
} }
let ceil_teched = handle_ceil_tech(module_accessor, status_kind, unk, status_kind_int, state); handle_ceil_tech(module_accessor, status_kind, unk, status_kind_int, state);
if ceil_teched {
return;
}
} }
fn handle_grnd_tech( fn handle_grnd_tech(
module_accessor: &mut app::BattleObjectModuleAccessor, module_accessor: &mut app::BattleObjectModuleAccessor,
@ -109,7 +104,7 @@ fn handle_grnd_tech(
_ => (), _ => (),
} }
return true; true
} }
fn handle_wall_tech( fn handle_wall_tech(
@ -152,7 +147,7 @@ fn handle_wall_tech(
_ => (), _ => (),
} }
return true; true
} }
fn handle_ceil_tech( fn handle_ceil_tech(
@ -185,7 +180,7 @@ fn handle_ceil_tech(
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_CEIL.as_lua_int(); *status_kind = FIGHTER_STATUS_KIND_PASSIVE_CEIL.as_lua_int();
*unk = LUA_TRUE; *unk = LUA_TRUE;
return true; true
} }
pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) { pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) {
@ -222,7 +217,6 @@ pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModule
StatusModule::change_status_request_from_script(module_accessor, status, false); StatusModule::change_status_request_from_script(module_accessor, status, false);
mash::perform_defensive_option(); mash::perform_defensive_option();
return;
} }
} }