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

Fix reloading of tools with liquids. #6668

Merged
merged 5 commits into from Mar 15, 2014

Conversation

Projects
None yet
2 participants
@BevapDin
Copy link
Contributor

commented Mar 15, 2014

The previous code would only consider containers if the ammo type is gasoline. No it considers all contents of all containers.

Tested with shotgun + rail-mounted crossbow + aux flamethrower and oil lamp + oil in main inventory without container + oil in container.

Works if the ammo is wielded, too.

Reported here: http://www.bay12forums.com/smf/index.php?topic=121194.msg5090405#msg5090405

BevapDin added some commits Mar 15, 2014

Add function to item to check if type of item or type of any of its c…
…ontents matches.

Same for ammo type:
item::is_of_ammo_type_or_contains_it
item::is_of_type_or_contains_it
Both function return true if either the item itself is of the given type / of the given ammo type,
or if the functions return true for any of its contents (recursive!).
extend player::has_ammo to check for wielded and worn ammo (containers)
This moves the chunk of code from item, which was not consistent with the above checks for ammo for the gunmods and the already loaded ammo.
Allow item::pick_reload_ammo to handle ammo in containers.
Changed the ui menu invocation to expect ammo in containers.
Rewrite some of the logic when to accept only exact item types as ammo, instead ammo type. This should no be much cleaner and easier to read
removed the indentation of the menu related code in item::pick_reload…
…_ammo

Just moved the special cases of no available ammo or only one available ammo or not interactive in front of the code.
The code that creates and shows the menu is now the last part.

@kevingranade kevingranade merged commit b6d30e1 into CleverRaven:master Mar 15, 2014

1 check passed

default
Details

@BevapDin BevapDin deleted the BevapDin:fix-reloading branch Mar 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.