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

Move ammo effects to JSON #36919

Merged
merged 12 commits into from
Jan 17, 2020
Merged

Move ammo effects to JSON #36919

merged 12 commits into from
Jan 17, 2020

Conversation

ymber
Copy link
Member

@ymber ymber commented Jan 11, 2020

Summary

SUMMARY: Infrastructure "Move ammo effects to JSON"

Purpose of change

Hardcoded ammo effects were restrictive. Now explosive projectiles can define explosion objects and they won't all behave the same.

Describe the solution

Hijack Serg's code from last October to use generic factory for ammo_effect objects. Made some updates to that, removed hardcoded behaviors for FLAME and NO_BOOM.

Testing

Ammo effects behave as expected in game.

Additional context

We should allow defining ammo effect objects in the effects array of an ammo item. There are also some hardcoded behaviors left for some ammo effects that should be removed at a later date. This doesn't change the behavior of any ammo effects except FLAME so we'll need to do a content pass to make sure grenades and such are behaving as they should.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Jan 11, 2020
@ZhilkinSerg
Copy link
Contributor

I won't review my own code :D

@tenmillimaster
Copy link
Member

Erm... you're axing the Raufoss explosion?

src/projectile.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg
Copy link
Contributor

Erm... you're axing the Raufoss explosion?

Original branch was created when EXPLOSIVE_RAUFOSS was not in the game yet. It should be moved to json now.

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Jan 12, 2020

PR is already pretty big now, so notes for the future:

  1. We need to jsonize cookoff and special_cookoff too (they are hardcoded now in item_factory.cpp).
  2. There are more ammo effects which are actually applied to weapon/gunmod instead of ammunition (e.g. DRAW_AS_LINE, DRAW_LASER_BEAM, NEVER_MISFIRES, etc) - we need to jsonize them too.
  3. After all these effects are jsonized we need to store and read ammo effects as collection of dedicated type instead of collection of tags/strings.

P.S.: Whole map::shoot is good candidate for moving various effects to json as properties of materials, terrains, ammo effects, etc.

@kevingranade
Copy link
Member

Pretty sure this is caused by this PR
13:07:06.502 ERROR : src/ammo_effect.cpp:104 [void ammo_effect::check() const] Field chance must be between 0 and 1

src/ammo_effect.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves [JSON] Changes (can be) made in JSON
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants