Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugs] Some info about weapon is losing when it switches offline #7

Closed
FreeZoneMods opened this issue Aug 5, 2017 · 1 comment
Closed

Comments

@FreeZoneMods
Copy link

FreeZoneMods commented Aug 5, 2017

Steps to reproduce:

  1. Attach to the weapon scope which has non-zero index in 'm_scopes'
  2. Drop the weapon and switch it offline by running from it
  3. Return to the weapon and take it into the hands
  4. See MAGIC: the weapon has scope of another type!

Solution:
The problem appears because CSE_ALifeItemWeapon class has no field to store scope type. Gunslinger mod uses bithacking of m_addon_flags field (writing scope index into the left 5 bits of the field in net_Destroy). This way provides best compatibility with original game, but leads to some restrictions (up to 32 types of scopes) and not fully proper.
More correct way is to extend CSE_ALifeItemWeapon with extra field and export/import data from it when the weapon spawns/destroys. The problem is that such fix could conflict with some game's or mod's content.

P.S. The same bug you could see with ammos in the mag (if the weapon has different ammo types loaded). Moreover, info about types is losing during simple game saving and loading! It allows cheating with transformation cartridges from one type to another.

@FreeZoneMods FreeZoneMods changed the title [Bugs] Some info about info is losing when it switches offline [Bugs] Some info about weapon is losing when it switches offline Aug 5, 2017
@revolucas
Copy link
Owner

revolucas commented Sep 14, 2017

I'm closing this because I've added a scripted solution to Call of Chernobyl. I've exported a way to get/set m_cur_scope and use my custom persistent storage system to save this value. https://bitbucket.org/revo_lucas/call-of-chernobyl/commits/618d19495290309cd70c37e135f88a53c60b75bf

& ammo types:
https://bitbucket.org/revo_lucas/call-of-chernobyl/commits/d7bdb065f49ede291bfbdf66a57d7f65fc3da16c

revolucas referenced this issue May 12, 2018
…that weapon attachments can have multiple visuals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants