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

Increase magazine spawns #15472

Merged
merged 6 commits into from Feb 21, 2016

Conversation

Projects
None yet
3 participants
@mugling
Copy link
Contributor

commented Feb 19, 2016

Starts work on #15443

Extends item_group to support magazine and ammo fields specifying percentage chance to spawn reloadable items with a default magazine and/or default ammo. These fields have similar semantics to those provided in the new mapgen function from #15341. Deprecates the now redundant guns_with_ammo field.

Most monster drops that include gun drops now have a 100% chance of including a matching magazine and a 30% chance of matching ammo. A further PR will extend this to include optional randomisation of the quantity of ammo.

@@ -1424,7 +1424,6 @@ void Item_factory::load_item_group(JsonObject &jsobj, const Group_tag &group_id,
Item_group *ig = dynamic_cast<Item_group *>(isd);
if (subtype == "old") {
ig = make_group_or_throw(isd, Item_group::G_DISTRIBUTION);
ig->with_ammo = jsobj.get_bool("guns_with_ammo", ig->with_ammo);

This comment has been minimized.

Copy link
@mugling

mugling Feb 19, 2016

Author Contributor

Previously not applied to all item_groups

@@ -1433,6 +1432,9 @@ void Item_factory::load_item_group(JsonObject &jsobj, const Group_tag &group_id,
jsobj.throw_error("unknown item group type", "subtype");
}

ig->with_ammo = jsobj.get_int( "ammo", ig->with_ammo );

This comment has been minimized.

Copy link
@mugling

mugling Feb 19, 2016

Author Contributor

ammo and magazine apply to both collections and distributions

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Feb 19, 2016

Very nice!

@Coolthulhu Coolthulhu self-assigned this Feb 21, 2016

Coolthulhu added a commit that referenced this pull request Feb 21, 2016

@Coolthulhu Coolthulhu merged commit 2225523 into CleverRaven:master Feb 21, 2016

1 check passed

default This has been rescheduled for testing as the 'master' branch has been updated.
@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2016

The ammo spawns could be more random. Currently it's all or nothing. While it makes a lot of sense for someone to die after running out of ammo, those who die from other causes (infection) would probably have less than full magazine too.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Feb 21, 2016

Yes, this is an intended extension. I also want to eventually update mapgen so that it spawns an equivalent number of empty casings to match the rounds missing from the magazine

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.