Skip to content

Barrel launcher ammo lost and fire mode reset when mounting/detaching scope [Possible solution inside] #401

@tomilovsenya

Description

@tomilovsenya

As far as I'm concerned, this happens because try_to_clone_object in alife_simulator_script.cpp (traced it all the way from item_weapon.attach_scope function) doesn't also try to clone fire mode and grenades count. There are some mods that try to fix this the script way but I'm pretty sure this issue has to be fixed on engine's level.

Pretty sure the fix should be like this in alife_simulator_script.cpp:

clone->wpn_flags = wpnmag->wpn_flags;
clone->m_addon_flags = wpnmag->m_addon_flags;
clone->m_fCondition = wpnmag->m_fCondition;
clone->ammo_type = wpnmag->ammo_type;
clone->m_upgrades = wpnmag->m_upgrades;
clone->set_ammo_elapsed(wpnmag->get_ammo_elapsed());
// Fix start
clone->m_iCurFireMode = wpnmag->m_iCurFireMode;
clone->a_elapsed_grenades.grenades_count = wpnmag->a_elapsed_grenades.grenades_count;
// Fix end

Might need some additional checks or syntax check but I hope you get the idea. Sadly can't be too bothered to compile it and test myself as well as create a PR. Hopefully it doesn't take more than 5 minutes to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions