Allow embiggener to give mag ammo like in the sidemods.

This commit is contained in:
Mari the Deer 2022-09-15 13:46:46 +02:00
commit 6baa8b8215
8 changed files with 127 additions and 75 deletions

View file

@ -350,16 +350,16 @@ Note that going prone *(crouching)* will automatically disable the recoil compen
### 1.150 XSB Bullets ~ Replaces Cells, Runes
![](docimg/xsbbullet.png)
The 1.150 caliber **eXplosive Super Burst** bullets employ an **Explodium** shaped charge to be shot with enough energy to reach a relatively high velocity, allowing their massive bulk to penetrate several targets including walls. They are hard to come by, so spawns are scarce, and they won't even pop up in **Hammerspace Embiggeners**, and in **Hexen** only on the highest tier **Fabricators**.
The 1.150 caliber **eXplosive Super Burst** bullets employ an **Explodium** shaped charge to be shot with enough energy to reach a relatively high velocity, allowing their massive bulk to penetrate several targets including walls.
In the world, they may pop up as spare bullets or full mags. Each five bullets picked up will be automatically converted to a full mag in your inventory.
In the world, they may pop up as spare bullets or full mags. Each five bullets picked up will be automatically converted to a full mag in your inventory. They are hard to come by as full mags, so expect to be finding singular rounds more often than not.
### 1.150 FCB Bullets ~ Replaces Cells, Runes
![](docimg/fcbbullet.png)
The more directly explosive counterpart of the **XSB**. Personally baptized by **Blackmann Arms** CEO **Hermann E. Ischer** himself as ***"Fat Chode Bombs"***, these **High-Explosive Squash Head** rounds will blast through walls on impact, hitting anything standing behind them, and in some cases, tearing down the wall itself too.
Same spawn conditions as the standard bullets.
These are a bit more rare than the standard rounds. You won't even get them from **Embiggeners**.
### Ray-Khom *(slot 8)* ~ Replaces Plasma Rifle, Hellstaff, Arc of Death
![](docimg/raykhom.png)
@ -379,7 +379,7 @@ By the way, those sharp claws aren't just for show, they hurt real bad when you
### Ray-Khom Bolts ~ Replaces Cells, Runes
![](docimg/raybolt.png)
40mm magnetized bolts with a plasma payload. They're basically just grenades, really.
40mm magnetized bolts with a plasma payload. They're basically just grenades, really. Fairly uncommon, but very rewarding to find.
### Candy Gun *(slot 9)* ~ Replaces BFG9000, Firemace, Bloodscourge (stub)
![](docimg/candygun.png)
@ -419,12 +419,12 @@ Don't rely too much on this thing, the ammo tends to be scarce, and it might pot
### Mortal Bullets ~ Replaces Cells, Runes
![](docimg/mrbullet.png)
These 4.44x44.4mm, square-shaped telescoped rounds have a lot of *"fours"* in them for sure. You can find 'em as-is in bundless or rarely in full 12-round mags.
These 4.44x44.4mm, square-shaped telescoped rounds have a lot of *"fours"* in them for sure. You can sometimes find 'em as-is in bundless or very rarely in full 12-round mags.
### Mortal Grenades ~ Replaces Cells, Runes
![](docimg/mrgrenade.png)
44.4mm grenades that burst into target-seeking micro-bombs. That sure is a thing, yes. They're more rare than the standard ammo, however.
44.4mm grenades that burst into target-seeking micro-bombs. That sure is a thing, yes. They're even more rare than the standard ammo, however.
### Ynykron Artifact *(slot 0)* ~ Replaces BFG9000, Firemace, Wraithverge (arc)
![](docimg/ynykron.png)
@ -565,14 +565,14 @@ You're fucking invincible for a total of 20 seconds.
### Hammerspace Embiggener ~ Replaces Backpack, Bag of Holding, Dragonskin Bracers
![](docimg/embiggener.png)
Each of these you pick up increases your ammo capacity *(not necessarily doubling it)*, stacking up to 8 times. They also give you some extra ammo, like a vanilla backpack would *(though not for all weapons)*.
Each of these you pick up increases your ammo capacity *(not necessarily doubling it)*, stacking up to 8 times. They also give you some extra ammo, like a vanilla backpack would *(though not for ALL ammo types)*.
In some special cases you may find *"Bulk"* versions. These generally only pop up if the mapper decided to spawn several overlapping backpacks in one spot, as they result from all of those items merging together.
### Universal Ammo Fabricator ~ Replaces Mana / Krater of Might
![](docimg/fabricator.png)
Separated into four tiers, they work pretty much like the ammo cubes in **Doom Tournament**, except they try to *"balance"* the total ammo given. The max tier fabricator is the only one capable of producing ammo for all weapons *(excluding the **Ynykron Artifact**)*. Due to some unspecified reasons, they cannot be held in your inventory, something to do with their nature conflicting with **Hammerspace**.
Separated into four tiers, they work pretty much like the ammo cubes in **Doom Tournament**, except they try to *"balance"* the total ammo given. The max tier fabricator is the only one capable of producing ammo for all weapons, as long as it can be bought at the store *(so this excludes slot 0 weapons, for example)*. Due to some unspecified reasons, they cannot be held in your inventory, something to do with their nature conflicting with **Hammerspace**.
### Lamp ~ Replaces Lite-Amp, Torch
![](docimg/lamp.png)

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r459 \cu(Thu 15 Sep 01:59:10 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r459 \cu(2022-09-15 01:59:10)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r460 \cu(Thu 15 Sep 13:46:46 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r460 \cu(2022-09-15 13:46:46)\c-";

View file

@ -239,6 +239,7 @@ Class RayBolt : MagAmmo
Stamina -8000;
MagAmmo.ParentAmmo "RayAmmo";
MagAmmo.ClipSize 10;
MagAmmo.BackpackAmount 2;
Inventory.MaxAmount 10;
+FLOATBOB;
FloatBobStrength 0.25;
@ -299,6 +300,7 @@ Class MisterRound : MagAmmo
Stamina -16000;
MagAmmo.ParentAmmo "MisterAmmo";
MagAmmo.ClipSize 12;
MagAmmo.BackpackAmount 1;
Inventory.MaxAmount 12;
+FLOATBOB;
FloatBobStrength 0.25;

View file

@ -354,6 +354,59 @@ Class HammerspaceEmbiggener : Inventory
}
}
}
// do the same for mag ammo, in a separate loop
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<MagAmmo>)(AllActorClasses[i]);
if ( !type || (type.GetParentClass() != 'MagAmmo') ) continue;
let magitem = MagAmmo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount*self.Amount;
if ( traded ) amount = 0;
if ( amount < 0 ) amount = 0;
int mags = amount/GetDefaultByType(type).ClipSize;
amount = amount%GetDefaultByType(type).ClipSize;
if ( !magitem )
{
// The player did not have the magitem. Add it.
magitem = MagAmmo(Spawn(type));
magitem.Amount = amount;
magitem.AttachToOwner(other);
// by this point, we assume that the parent ammo pointer is valid, so...
let ammoitem = magitem.pamo;
// append some mags to it
if ( ammoitem.Amount < ammoitem.MaxAmount )
{
if ( (ammoitem.Amount > 0) && (ammoitem.Amount+mags < 0) )
ammoitem.Amount = int.max;
else ammoitem.Amount += mags;
if ( (ammoitem.Amount > ammoitem.MaxAmount) && !sv_unlimited_pickup )
ammoitem.Amount = ammoitem.MaxAmount;
}
// we can't add extra mags, just max out the spare ammo
else if ( mags > 0 ) magitem.Amount = min(magitem.MaxAmount,magitem.Amount+magitem.ClipSize);
}
else
{
if ( magitem.Amount+amount >= magitem.MaxAmount )
{
mags++;
amount -= magitem.MaxAmount;
}
magitem.Amount += amount;
let ammoitem = magitem.pamo;
// append some mags to it
if ( ammoitem.Amount < ammoitem.MaxAmount )
{
if ( (ammoitem.Amount > 0) && (ammoitem.Amount+mags < 0) )
ammoitem.Amount = int.max;
else ammoitem.Amount += mags;
if ( (ammoitem.Amount > ammoitem.MaxAmount) && !sv_unlimited_pickup )
ammoitem.Amount = ammoitem.MaxAmount;
}
// we can't add extra mags, just max out the spare ammo
else if ( mags > 0 ) magitem.Amount = min(magitem.MaxAmount,magitem.Amount+magitem.ClipSize);
}
}
self.Amount = min(self.Amount,MaxAmount);
if ( GetParentClass() == 'HammerspaceEmbiggener' )
{
@ -403,6 +456,31 @@ Class HammerspaceEmbiggener : Inventory
if ( (i.Amount > i.MaxAmount) && !sv_unlimited_pickup )
i.Amount = i.MaxAmount;
}
if ( traded ) return true;
// give spare mag ammo separately
for ( Inventory i=Owner.Inv; i; i=i.Inv )
{
if ( !(i is 'MagAmmo') ) continue;
int amount = MagAmmo(i).BackpackAmount*item.Amount;
int mags = amount/MagAmmo(i).ClipSize;
amount = amount%MagAmmo(i).ClipSize;
if ( i.Amount+amount >= MagAmmo(i).ClipSize )
{
mags++;
amount -= MagAmmo(i).ClipSize;
}
i.Amount += amount;
Ammo a = MagAmmo(i).pamo;
if ( a.Amount < a.MaxAmount )
{
if ( (a.Amount > 0) && (a.Amount+mags < 0) )
a.Amount = int.max;
else a.Amount += mags;
if ( (a.Amount > a.MaxAmount) && !sv_unlimited_pickup )
a.Amount = a.MaxAmount;
}
else if ( mags > 0 ) i.Amount = min(i.MaxAmount,i.Amount+MagAmmo(i).ClipSize);
}
return true;
}
// new ammo suddenly added? upgrade it (this shouldn't happen unless fucky scripting has been involved)

View file

@ -644,6 +644,7 @@ Class SilverBullets : MagAmmo
Stamina -12000;
MagAmmo.ParentAmmo "SilverBulletAmmo";
MagAmmo.ClipSize 5;
MagAmmo.BackpackAmount 2;
Inventory.MaxAmount 5;
+FLOATBOB;
FloatBobStrength 0.25;
@ -756,6 +757,7 @@ Class CandyGunBullets : MagAmmo
Stamina -14000;
MagAmmo.ParentAmmo "CandyGunAmmo";
MagAmmo.ClipSize 7;
MagAmmo.BackpackAmount 1;
Inventory.MaxAmount 7;
+FLOATBOB;
FloatBobStrength 0.25;

View file

@ -148,7 +148,7 @@ Class SWWMClipAmmoMed : SWWMAmmoSpawner
bex = SWWMUtility.ItemExists('HeavyMahSheenGun',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) )
return 'SheenSmallAmmo';
return Random[Replacements](0,1)?'EvisceratorShell2':'EvisceratorShell';
return Random[Replacements](0,2)?'EvisceratorShell':'EvisceratorShell2';
}
}
Class SWWMClipAmmoBig : SWWMAmmoSpawner
@ -159,7 +159,7 @@ Class SWWMClipAmmoBig : SWWMAmmoSpawner
bex = SWWMUtility.ItemExists('HeavyMahSheenGun',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) )
return 'SheenBigAmmo';
return Random[Replacements](0,1)?'EvisceratorShell2':'EvisceratorShell3';
return Random[Replacements](0,2)?'EvisceratorShell2':'EvisceratorShell3';
}
}
Class SWWMBlastAmmoSmall : SWWMAmmoSpawner
@ -181,7 +181,7 @@ Class SWWMBlastAmmoBig : SWWMAmmoSpawner
bex = SWWMUtility.ItemExists('HeavyMahSheenGun',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) )
return 'SheenBigAmmo';
return Random[Replacements](0,2)?'EvisceratorShell3':'EvisceratorShell2';
return Random[Replacements](0,2)?'EvisceratorShell2':'EvisceratorShell3';
}
}
Class SWWMRocketAmmoSmall : SWWMAmmoSpawner
@ -201,7 +201,7 @@ Class SWWMRocketAmmoBig : SWWMAmmoSpawner
bool aex = SWWMUtility.ItemExists('Hellblazer',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('Quadravol',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) )
return Random[Replacements](0,4)?'QuadravolAmmo2':'QuadravolAmmo3';
return Random[Replacements](0,3)?'QuadravolAmmo2':'QuadravolAmmo3';
switch ( Random[Replacements](0,11) )
{
case 0:
@ -209,12 +209,12 @@ Class SWWMRocketAmmoBig : SWWMAmmoSpawner
case 2:
case 3:
case 4:
return Random[Replacements](0,4)?'HellblazerMissiles':'HellblazerMissiles2';
return Random[Replacements](0,3)?'HellblazerMissiles':'HellblazerMissiles2';
case 5:
case 6:
case 7:
case 8:
return Random[Replacements](0,7)?'HellblazerCrackshots':'HellblazerCrackshots2';
return Random[Replacements](0,5)?'HellblazerCrackshots':'HellblazerCrackshots2';
case 9:
case 10:
return 'HellblazerRavagers';
@ -229,13 +229,13 @@ Class SWWMCellAmmoSmall : SWWMAmmoSpawner
{
if ( !Random[Replacements](0,2) )
{
if ( !Random[Replacements](0,3) )
{
bool aex = SWWMUtility.ItemExists('CandyGun',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('MisterRifle',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) ) return !Random[Replacements](0,2)?'MisterGAmmo':Random[Replacements](0,2)?'MisterRound':'MisterRound2';
if ( aex ) return 'CandyGunBullets';
}
bool aex = SWWMUtility.ItemExists('CandyGun',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('MisterRifle',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) ) return !Random[Replacements](0,2)?'MisterGAmmo':Random[Replacements](0,2)?'MisterRound':'MisterRound2';
if ( aex ) return 'CandyGunBullets';
}
if ( Random[Replacements](0,1) )
{
bool aex = SWWMUtility.ItemExists('SilverBullet',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('RayKhom',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) ) return 'RayBolt2';
@ -258,6 +258,13 @@ Class SWWMCellAmmoBig : SWWMAmmoSpawner
if ( (SWWMUtility.ItemExists('Ynykron')) && SWWMUtility.CheckNeedsItem('YnykronAmmo',true) && !SWWMUtility.ItemExists('YnykronAmmo',worldonly:true) && !SWWMUtility.ItemExists('Ynykron',worldonly:true) )
return 'YnykronAmmo';
}
if ( !Random[Replacements](0,2) )
{
bool aex = SWWMUtility.ItemExists('CandyGun',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('MisterRifle',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) ) return !Random[Replacements](0,2)?'MisterGAmmo2':Random[Replacements](0,2)?'MisterRound5':'MisterAmmo';
if ( aex ) return Random[Replacements](0,2)?'CandyGunBullets3':'CandyGunAmmo';
}
if ( Random[Replacements](0,1) )
{
bool aex = SWWMUtility.ItemExists('SilverBullet',ownedonly:enemydrop),
@ -269,13 +276,6 @@ Class SWWMCellAmmoBig : SWWMAmmoSpawner
return Random[Replacements](0,2)?'SilverBulletAmmo':'SilverBulletAmmo2';
}
}
if ( !Random[Replacements](0,2) )
{
bool aex = SWWMUtility.ItemExists('CandyGun',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('MisterRifle',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) ) return !Random[Replacements](0,2)?'MisterGAmmo2':Random[Replacements](0,2)?'MisterRound5':'MisterAmmo';
if ( aex ) return Random[Replacements](0,3)?'CandyGunBullets3':'CandyGunAmmo';
}
bool aex = SWWMUtility.ItemExists('Sparkster',ownedonly:enemydrop),
bex = SWWMUtility.ItemExists('ModernSparkster',ownedonly:enemydrop);
if ( (!aex && bex) || (Random[Replacements](0,1) && bex) )

View file

@ -236,30 +236,6 @@ Class SWWMAmmo : Ammo
return Super.HandlePickup(item);
}
override bool CanPickup( Actor toucher )
{
// don't allow picking up ammo for weapons we can't pick up
if ( !Super.CanPickup(toucher) ) return false;
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let w = (Class<Weapon>)(AllActorClasses[i]);
if ( !w ) continue;
if ( w is 'SWWMWeapon' )
{
let def = GetDefaultByType((Class<SWWMWeapon>)(w));
if ( !def.UsesAmmo(GetClass()) ) continue;
if ( !def.CanPickup(toucher) ) return false;
}
else
{
let def = GetDefaultByType(w);
if ( (def.AmmoType1 != GetClass()) && (def.AmmoType2 != GetClass()) ) continue;
if ( !def.CanPickup(toucher) ) return false;
}
}
return true;
}
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
@ -310,6 +286,7 @@ Class MagAmmo : Inventory abstract
Property ParentAmmo : ParentAmmo;
Property ClipSize : ClipSize;
Property PickupTag : PickupTag;
Property BackpackAmount : BackpackAmount;
default
{
@ -378,17 +355,6 @@ Class MagAmmo : Inventory abstract
// drop excess mag ammo
if ( (item is 'MagAmmo') && (MagAmmo(item).GetParentMagAmmo() == GetClass()) )
{
// can somehow happen
if ( !pamo )
{
pamo = Ammo(Owner.FindInventory(ParentAmmo));
if ( !pamo )
{
pamo = Ammo(Spawn(ParentAmmo));
pamo.AttachToOwner(Owner);
pamo.Amount = 0;
}
}
if ( bUNDROPPABLE || bUNTOSSABLE )
{
// undroppable mag ammo only drops full mags.
@ -503,14 +469,6 @@ Class MagAmmo : Inventory abstract
return copy;
}
override bool CanPickup( Actor toucher )
{
// don't allow picking up ammo for weapons we can't pick up
if ( !Super.CanPickup(toucher) ) return false;
let def = GetDefaultByType(ParentAmmo);
return def.CanPickup(toucher);
}
private Inventory DoDrop( Class<Inventory> type )
{
let copy = Inventory(Spawn(type,Owner.Pos,NO_REPLACE));
@ -564,6 +522,18 @@ Class MagAmmo : Inventory abstract
MagFill();
}
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
pamo = Ammo(other.FindInventory(ParentAmmo));
if ( !pamo )
{
pamo = Ammo(Spawn(ParentAmmo));
pamo.AttachToOwner(other);
pamo.Amount = 0;
}
}
bool MagFill()
{
// double-check that parent ammo exists

View file

@ -2236,8 +2236,8 @@ Class SWWMUtility
// first bfg spawn
static Class<Weapon> PickSWWMSlot9()
{
// 33% chance to still drop another candy gun if it's not at max capacity
if ( !Random[Replacements](0,2) && ItemExists('CandyGun') && CheckNeedsItem('CandyGunSpares',true) )
// 25% chance to still drop another candy gun if it's not at max capacity
if ( !Random[Replacements](0,3) && ItemExists('CandyGun') && CheckNeedsItem('CandyGunSpares',true) )
return 'CandyGun';
return PickPair('CandyGun','MisterRifle');
}