Last active
July 13, 2020 23:44
-
-
Save jugeeya/27b902865408c916b1fcacc486157f79 to your computer and use it in GitHub Desktop.
ACMD Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "acmd_test" | |
version = "0.1.0" | |
authors = ["jam1garner <jam1.mcleod@hotmail.com>"] | |
edition = "2018" | |
[package.metadata.skyline] | |
titleid = "01006A800016E000" | |
[lib] | |
crate-type = ["cdylib"] | |
[dependencies] | |
skyline = { git = "https://github.com/ultimate-research/skyline-rs.git" } | |
skyline_smash = { git = "https://github.com/ultimate-research/skyline-smash.git" } | |
acmd = { git = "https://github.com/ultimate-research/skyline-acmd.git" } | |
[profile.dev] | |
panic = "abort" | |
[profile.release] | |
panic = "abort" | |
lto = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(concat_idents)] | |
#![feature(proc_macro_hygiene)] | |
use smash::hash40; | |
use smash::lib::lua_const::*; | |
use smash::lua2cpp::{L2CFighterCommon, L2CFighterBase}; | |
use acmd::acmd; | |
#[acmd::acmd_func( | |
battle_object_category = BATTLE_OBJECT_CATEGORY_FIGHTER, | |
battle_object_kind = FIGHTER_KIND_MARIO, | |
animation = "attack_air_f", | |
animcmd = "game_attackairf")] | |
pub fn mario_fair(fighter: &mut L2CFighterCommon) { | |
acmd!({ | |
frame(16) | |
AttackModule::clear_all() // clear all previous hitboxes | |
if(is_execute) { | |
ATTACK( | |
ID=0, Part=0, Bone=hash40("arml"), 19.0, 361, 80, 0, 30, 113.0, 3.2, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, | |
ATTACK_SETOFF_KIND_ON, ATTACK_LR_CHECK_F, ATTACK_LR_CHECK_F, ATTACK_LR_CHECK_F, | |
ATTACK_LR_CHECK_F, ATTACK_LR_CHECK_F, false, false, false, false, true, | |
COLLISION_SITUATION_MASK_GA, COLLISION_CATEGORY_MASK_ALL, COLLISION_PART_MASK_ALL, | |
false, hash40("collision_attr_fire"), ATTACK_SOUND_LEVEL_M, COLLISION_SOUND_ATTR_PUNCH, | |
ATTACK_REGION_PUNCH | |
) | |
rust { | |
println!("Fair frame 16"); | |
} | |
} | |
sv_kinetic_energy::add_speed(1.0); | |
}); | |
} | |
#[acmd::acmd_func( | |
battle_object_category = BATTLE_OBJECT_CATEGORY_WEAPON, | |
battle_object_kind = WEAPON_KIND_FALCO_BLASTER_BULLET, | |
animation = "fly", | |
animcmd = "game_fly")] | |
pub fn falco_laser(fighter : &mut L2CFighterBase) { | |
acmd!({ | |
if(is_excute){ | |
ATTACK(ID=0, Part=0, Bone=hash40("top"), Damage=3.0, Angle=361, KBG=100, FKB=20, BKB=0, Size=1.44, X=0.0, Y=0.0, Z=0.8, X2=LUA_VOID, Y2=LUA_VOID, Z2=LUA_VOID, Hitlag=0.1, SDI=1.0, Clang_Rebound=ATTACK_SETOFF_KIND_OFF, FacingRestrict=ATTACK_LR_CHECK_SPEED, SetWeight=false, ShieldDamage=0, Trip=0.0, Rehit=0, Reflectable=true, Absorbable=true, Flinchless=false, DisableHitlag=false, Direct_Hitbox=false, Ground_or_Air=COLLISION_SITUATION_MASK_GA, Hitbits=COLLISION_CATEGORY_MASK_ALL, CollisionPart=COLLISION_PART_MASK_ALL, FriendlyFire=false, | |
Effect=hash40("collision_attr_death"), SFXLevel=ATTACK_SOUND_LEVEL_M, SFXType=COLLISION_SOUND_ATTR_ELEC, Type=ATTACK_REGION_ENERGY) | |
AttackModule::enable_safe_pos() | |
} | |
}); | |
} | |
// Use this for general per-frame fighter-level hooks | |
pub fn once_per_fighter_frame(fighter : &mut L2CFighterCommon) { | |
unsafe { | |
let module_accessor = smash::app::sv_system::battle_object_module_accessor(fighter.lua_state_agent); | |
println!("Frame : {}", smash::app::lua_bind::MotionModule::frame(module_accessor)); | |
} | |
} | |
// Use this for general per-frame weapon-level hooks | |
pub fn once_per_weapon_frame(fighter_base : &mut L2CFighterBase) { | |
unsafe { | |
let module_accessor = smash::app::sv_system::battle_object_module_accessor(fighter_base.lua_state_agent); | |
println!("Frame : {}", smash::app::lua_bind::MotionModule::frame(module_accessor)); | |
} | |
} | |
#[skyline::main(name = "acmd_test")] | |
pub fn main() { | |
acmd::add_hooks!( | |
mario_fair, | |
falco_laser); | |
/* | |
// Uncomment this block if you'd like to use custom per-fighter/weapon hooks. | |
unsafe { | |
acmd::add_acmd_load_hook(once_per_fighter_frame, |_, _| false); | |
acmd::add_acmd_load_hook(once_per_weapon_frame, |_, _| false); | |
} | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment