Skip to content

Commit

Permalink
Merge pull request #75970 from GuardianDll/mags_do_jam
Browse files Browse the repository at this point in the history
Apply mag_jam_mult to helical and drum magazines
  • Loading branch information
Maleclypse authored Aug 29, 2024
2 parents 6eba7a1 + 806ece8 commit 97460ba
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 1 deletion.
4 changes: 4 additions & 0 deletions data/json/items/gun/robofac_gun.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 3,
"flags": [ "MAG_COMPACT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 60 } } ]
},
Expand Down Expand Up @@ -510,6 +511,7 @@
"color": "dark_gray",
"ammo_type": [ "shot" ],
"reload_time": 130,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "shot": 30 } } ]
},
Expand Down Expand Up @@ -547,6 +549,7 @@
"color": "light_gray",
"ammo_type": [ "308" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "308": 50 } } ]
},
{
Expand All @@ -565,6 +568,7 @@
"color": "light_gray",
"ammo_type": [ "223" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "223": 100 } } ]
},
{
Expand Down
6 changes: 6 additions & 0 deletions data/json/items/magazine/223.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
"color": "light_gray",
"ammo_type": [ "223", "300blk" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [
{
Expand Down Expand Up @@ -358,6 +359,7 @@
"color": "light_gray",
"ammo_type": [ "223", "300blk" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [
{
Expand Down Expand Up @@ -386,6 +388,7 @@
"color": "light_gray",
"ammo_type": [ "223", "300blk" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [
{
Expand Down Expand Up @@ -440,6 +443,7 @@
"color": "light_gray",
"ammo_type": [ "223", "300blk" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [
{
Expand All @@ -466,6 +470,7 @@
"color": "light_gray",
"ammo_type": [ "223", "300blk" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [
{
Expand Down Expand Up @@ -535,6 +540,7 @@
"description": "A bulky 100-round double drum magazine for use with the Steyr AUG assault rifle.",
"material": [ "steel", "plastic" ],
"ammo_type": [ "223" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "223": 100 } } ]
},
{
Expand Down
3 changes: 3 additions & 0 deletions data/json/items/magazine/308.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"color": "light_gray",
"ammo_type": [ "308" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "308": 50 } } ]
},
Expand Down Expand Up @@ -233,6 +234,7 @@
"color": "light_gray",
"ammo_type": [ "308" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "308": 50 } } ]
},
Expand Down Expand Up @@ -394,6 +396,7 @@
"color": "light_gray",
"ammo_type": [ "308" ],
"capacity": 50,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "308": 50 } } ]
},
Expand Down
1 change: 1 addition & 0 deletions data/json/items/magazine/410shot.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"color": "dark_gray",
"ammo_type": [ "410shot" ],
"reload_time": 130,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "410shot": 30 } } ]
}
Expand Down
1 change: 1 addition & 0 deletions data/json/items/magazine/45.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"color": "light_gray",
"ammo_type": [ "45" ],
"reload_time": 150,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "45": 50 } } ]
},
Expand Down
1 change: 1 addition & 0 deletions data/json/items/magazine/762.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"color": "light_gray",
"ammo_type": [ "762" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "762": 75 } } ]
},
{
Expand Down
2 changes: 2 additions & 0 deletions data/json/items/magazine/8x40mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"color": "dark_gray",
"ammo_type": [ "8x40mm" ],
"reload_time": 60,
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "8x40mm": 250 } } ]
},
{
Expand Down Expand Up @@ -124,6 +125,7 @@
"symbol": "#",
"color": "dark_gray",
"ammo_type": [ "8x40mm" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "8x40mm": 500 } } ]
},
{
Expand Down
10 changes: 10 additions & 0 deletions data/json/items/magazine/9mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 3,
"flags": [ "MAG_COMPACT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 50 } } ]
},
Expand All @@ -35,6 +36,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 3,
"flags": [ "MAG_COMPACT" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 100 } } ]
},
Expand Down Expand Up @@ -128,6 +130,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 50 } } ]
},
{
Expand All @@ -145,6 +148,7 @@
"symbol": "#",
"color": "light_gray",
"ammo_type": [ "9mm" ],
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 100 } } ]
},
Expand Down Expand Up @@ -313,6 +317,7 @@
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 100 } } ],
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ]
},
{
Expand All @@ -331,6 +336,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 50 } } ]
},
Expand Down Expand Up @@ -495,6 +501,7 @@
"color": "light_gray",
"ammo_type": "9mm",
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 32 } } ]
},
{
Expand Down Expand Up @@ -795,6 +802,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 72 } } ]
},
Expand Down Expand Up @@ -994,6 +1002,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 100 } } ]
},
Expand Down Expand Up @@ -1564,6 +1573,7 @@
"color": "light_gray",
"ammo_type": [ "9mm" ],
"reload_time": 160,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "9mm": 50 } } ]
}
Expand Down
2 changes: 2 additions & 0 deletions data/json/items/magazine/shot.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"color": "dark_gray",
"ammo_type": [ "shot" ],
"reload_time": 130,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "shot": 20 } } ]
},
Expand Down Expand Up @@ -356,6 +357,7 @@
"ammo_type": [ "shot" ],
"flags": [ "MAG_BULKY" ],
"material": [ "lc_steel", "plastic" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "shot": 20 } } ]
}
]
1 change: 1 addition & 0 deletions data/mods/Aftershock/items/magazine/7.50mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"color": "light_gray",
"ammo_type": [ "afs_7.50mm" ],
"reload_time": 200,
"mag_jam_mult": 2,
"flags": [ "MAG_BULKY" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "afs_7.50mm": 100 } } ]
},
Expand Down
2 changes: 2 additions & 0 deletions data/mods/Xedra_Evolved/items/gun_magazine.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"color": "dark_gray",
"ammo_type": [ "shot" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "shot": 32 } } ]
},
{
Expand All @@ -65,6 +66,7 @@
"color": "dark_gray",
"ammo_type": [ "shot" ],
"flags": [ "MAG_BULKY" ],
"mag_jam_mult": 2,
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "shot": 64 } } ]
}
]
3 changes: 3 additions & 0 deletions doc/GAME_BALANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ Increases proportional to capacity and should have a comparable ratio to similar
### Volume
Scaled based upon the capacity relative to the `stack_size` of the ammo. For example 223 has a `stack size` of 20 so for 10 and 30 round magazines the volume would be 1 and 2. Extended magazine should always have larger volume than the standard type and for very large drum magazines consider applying an extra penalty. By default most handgun magazines should be volume 1 and most rifle magazines volume 2. Ammo belts should not specify volume as this will be determined from their length.

### Jam multiplier
`mag_jam_mult` field is used to determine how much the magazine is affected by being damaged. Default rate is described in Character::handle_gun_damage(); at this moment it is roughly: 0.000288% for undamaged magazine, 5% for 1 damage (|\), 24% for 2 damage (|.), 96% for 3 damage (\.), and 250% for 4 damage (XX), then this and gun values are summed up and multiplied by 1.8. Rule of thumb: helical mags should have 3, drum mags should have 2, the rest can be tweaked case by case, but mostly doesn't worth emulating it

### Rarity
Overall balance is that pistol magazines are twice as common as rifle magazines and that for guns that spawn with magazines these are always the standard capacity versions. Consider 9x19mm and .223 to be the defaults with everything else more rare. Some locations have more specific balance requirements:

Expand Down
2 changes: 1 addition & 1 deletion doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3608,7 +3608,7 @@ ammo_effects define what effect the projectile, that you shoot, would have. List
"count" : 0, // Default amount of ammo contained by a magazine (set this for ammo belts)
"default_ammo": "556", // If specified override the default ammo (optionally set this for ammo belts)
"reload_time" : 100, // How long it takes to load each unit of ammo into the magazine
"mag_jam_mult": 1.25 // Multiplier for gun mechanincal malfunctioning from magazine, mostly when it's damaged; Values lesser than 1 reflect better quality of the magazine, that jam less; bigger than 1 result in gun being more prone to malfunction and jam at lesser damage level; zero mag_jam_mult (and zero gun_jam_mult in a gun) would remove any chance for a gun to malfunction. Only works if gun has any fault from gun_mechanical_simple group presented; Jam chances are described in Character::handle_gun_damage(); at this moment it is roughly: 0.000288% for undamaged magazine, 5% for 1 damage (|\), 24% for 2 damage (|.), 96% for 3 damage (\.), and 250% for 4 damage (XX), then this and gun values are summed up and multiplied by 1.8.
"mag_jam_mult": 1.25 // Multiplier for gun mechanincal malfunctioning from magazine, mostly when it's damaged; Values lesser than 1 reflect better quality of the magazine, that jam less; bigger than 1 result in gun being more prone to malfunction and jam at lesser damage level; zero mag_jam_mult (and zero gun_jam_mult in a gun) would remove any chance for a gun to malfunction. Only works if gun has any fault from gun_mechanical_simple group presented; Jam chances are described in Character::handle_gun_damage(); at this moment it is roughly: 0.000288% for undamaged magazine, 5% for 1 damage (|\), 24% for 2 damage (|.), 96% for 3 damage (\.), and 250% for 4 damage (XX), then this and gun values are summed up and multiplied by 1.8. Rule of thumb: helical mags should have 3, drum mags should have 2, the rest can be tweaked case by case, but mostly doesn't worth emulating it
"linkage" : "ammolink" // If set one linkage (of given type) is dropped for each unit of ammo consumed (set for disintegrating ammo belts)
```

Expand Down

0 comments on commit 97460ba

Please sign in to comment.