HDR-Development / smashline

31 stars 7 forks source link

Article Updates #40

Closed WuBoytH closed 2 months ago

WuBoytH commented 2 months ago

Changelog

On_Start

On_Start now runs at the end of the BattleObjectModuleAccessor::start function instead of specifically while starting LuaModule. This allows WorkModule to be started, letting you set flags, ints, and floats in an on_start.

Update Weapon Count

Allows you to update how many of a specific article the fighter is allowed to have.

smashline::update_weapon_count(*WEAPON_KIND_MARIO_FIREBALL, 1);
// This would change how many fireballs Mario is allowed to just a single fireball.

Weapon Cloning Bugfix

Currently, the way that weapon cloning works is such:

smashline::clone_weapon(
    /* original owner */,
    original article name,
    /* new owner */,
    /* new article name */,
    /* use original code */
);

original article name would be passed into a StaticArrayAccessor, which then spits out an article index. However, this doesn't account for articles with the same name, such as Mario and Luigi's Fireball. If you tried cloning Luigi's Fireball, for example, the game would assign the new article Mario's fireball weapon ID, which would cause the game to crash.

Weapon cloning will now work by directly passing in the article's ID:


smashline::clone_weapon(
    /* original owner */,
    *WEAPON_KIND_OWNER_ARTICLENAME,
    /* new owner */,
    /* new article name */,
    /* use original code */
);