-
Notifications
You must be signed in to change notification settings - Fork 8
Migrating
(For reference, this repository is for smashline-2)
As a measure of comparison, let's list the features from smashline-1 to smashline-2:
Guide:
- β - Integrated
- β - Removed/Doesn't Exist
- π - Planned
| Feature Name | Smashline 1 | Smashline 2 |
|---|---|---|
| Plugin Hot Reloading | β | β |
| Priority-based script replacement | β | β |
| ACMD Asset Format | β | β |
| ACMD Function Replacements | β | β |
| Status Function Replacements | β | β |
| OPFF Code | β | β |
| Init/Reset Callbacks | β | β |
| ACMD Language Macro | β | β |
| Adding ACMD to weapons without it | β | β |
| Adding Status to weapons without it | β | β |
call_original in ACMD/Status |
β | β |
| Article/Weapon Cloning | β | β |
Adding new param objects to vl.prc
|
β | β |
| Transplanting effects between fighters | β | β |
| Symbol Hooks | β | β (was poorly supported anyways) |
In smashline-1, an ACMD script consisted of a few parts:
- Function attribute
- Function (script)
- Install macro
Here is an example:
#[smashline::acmd(agent = "mario", script = "game_attacks4", category = ACMD_GAME)]
unsafe fn mario_game_attacks4(fighter: &mut L2CAgentBase) {
// insert script here
}
#[smashline::acmd(agent = "mario", script = "effect_attacks4", category = ACMD_EFFECT)]
unsafe fn mario_effect_attacks4(fighter: &mut L2CAgentBase) {
// insert script here
}
#[smashline::acmd(agent = "mario", script = "game_attackairhi", category = ACMD_GAME)]
unsafe fn mario_game_attackairhi(fighter: &mut L2CAgentBase) {
// insert script here
}
#[skyline::main(name = "smashline-plugin")]
pub fn main() {
smashline::install_acmd_scripts!(
mario_game_attacks4,
mario_effect_attacks4,
mario_game_attackairhi,
);
}Migration:
- Declare the functions as
unsafe extern "C" fninstead ofunsafe fn - Remove the function attributes
- Replace the
smashline::install_acmd_scripts!(...)with:
Agent::new("mario")
.game_acmd("game_attacks4", mario_game_attacks4, Priority::Default)
.effect_acmd("effect_attacks4", mario_effect_attacks4, Priority::Default)
.game_acmd("game_attackairhi", mario_game_attackairhi, Priority::Default)
.install();Status scripts in smashline-1 functioned very similar to ACMD scripts, so the replacement is also very similar
Example:
#[smashline::status_script(agent = "mario", status = FIGHTER_STATUS_KIND_SPECIAL_HI, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_PRE)]
unsafe fn mario_pre_specialhi(fighter: &mut L2CFighterCommon) -> L2CValue {
// script impl
}
pub fn main() {
smashline::install_status_script!(mario_pre_specialhi);
}Migration:
- Declare the functions as
unsafe extern "C" fninstead ofunsafe fn - Remove the function attributes
- Replace the
smashline::install_status_script!(...)with:
use smashline::Pre;
Agent::new("mario")
.status(Pre, *FIGHTER_STATUS_KIND_SPECIAL_HI, mario_pre_specialhi)
.install()Previously, in smashline-1 there were two ways to declare OPFF code:
- As a "replacement", via
#[smashline::fighter_frame] - As a callback, via
#[smashline::fighter_frame_callback]
In smashline-2, there is only one way and it's a blend between replacements and callbacks.
#[smashline::fighter_frame(agent = FIGHTER_KIND_MARIO)]
fn mario_frame(fighter: &mut L2CFighterCommon) {
// fighter frame
}
pub fn main() {
smashline::install_agent_frame!(mario_frame);
}Migration:
- Declare the functions as
unsafe extern "C" fn - Remove the function attributes
- Replace the
smashline::install_agent_frame!(...)with:
use smashline::Main;
Agent::new("mario")
.on_line(Main, mario_frame)
.install();It's worth noting that default OPFF behavior in smashline-1 was on the exec status, which is no longer supported as it is not inherently called every frame. Use Main instead.
Init/reset callbacks are not 1-1 with their previous counterparts, and might require some code changes to adapt.
Migration:
- Declare the functions as
unsafe extern "C" fn - Remove the function attributes
- Install with:
Agent::new("mario")
.on_start(init_callback)
.on_start(reset_callback)
.install();Note that Init/Reset callbacks in smashline-1 are both suited to be used with on_start in smashline-2.