Allow Candy Gun to perform special fire without spares.

This commit is contained in:
Mari the Deer 2021-09-22 16:50:24 +02:00
commit 164ff261f4
10 changed files with 70 additions and 36 deletions

View file

@ -254,7 +254,7 @@ Coming from an old unreleased weapon mini-mod, the **Candy Gun** is like an **Ex
**Reload:** Does what you'd expect.
Holding primary fire during the first few moments of alt fire will throw the weapon itself, armed and ready to explode if it hits anyone or anything. The blast area for this is pretty ridiculous. You can hold spare guns, by the way (up to four).
Holding secondary fire and primary fire (in that order) will throw the weapon itself, armed and ready to explode if it hits anyone or anything. The blast area for this is pretty ridiculous. You can hold spare guns, by the way (up to four).
### Candy Gun Bullets ~ Replaces Cells, Runes
![](docimg/candybullet.png)

View file

@ -408,7 +408,7 @@ SWWM_LORETXT_CANDYGUN =
"\n"
"\cfSecondary Fire:\c- Perform an \"explosive reload\", just like with a standard Explodium Gun. Note that unlike its weaker counterpart, the yield is much more extreme. It is best practice to always have one spare magazine at the ready for the reload, so you aren't left with an unusable weapon should your throw miss the target.\n"
"\n"
"\cfCombo Fire:\c- During the first moments of preparing an explosive reload, you can opt to, instead, leave the magazine in the gun, armed and ready, then throw the whole weapon as a grenade, for the ultimate destruction. As always, make sure you have a fully loaded spare around, or you'll be left with nothing. Due to this disposable nature, you're allowed to carry up to 4 spares in your inventory. Use them well.\n"
"\cfCombo Fire:\c- By holding secondary and primary fire (in that order) you can opt to, instead of performing the usual explosive reload, leave the magazine in the gun, armed and ready, then throw the whole weapon as a grenade, for the ultimate destruction. As always, make sure you at least have a spare and more ammo, or you'll be left with nothing. Due to this disposable nature, you're allowed to carry up to 4 spares in your inventory. Use them well.\n"
"\n"
"\cxSaya's Notes:\c-\n"
"\cfI don't get it, really don't. How is it that mixing that exploding shit with candy does this? Oh, whatever, I still love every second of it, but the pretty fireworks make me really nostalgic, for some reason...\c-\n"

View file

@ -381,7 +381,7 @@ SWWM_LORETXT_CANDYGUN =
"\n"
"\cfFuego Secundario:\c- Realiza una \"recarga explosiva\", al igual que la Pistola de Explodium estándar. Ten en cuenta que a diferencia de su débil homóloga, la carga explosiva es mucho más extrema. Se recomienda tener siempre un cargador de repuesto listo para la recarga, para no acabar con un arma inútil si el que has lanzado no alcanza su objetivo.\n"
"\n"
"\cfFuego Combinado:\c- Durante los primeros momentos de preparar una recarga explosiva, también puedes, en su lugar, dejar el cargador dentro de la pistola, armado y listo, y entonces lanzar el arma entera como una granada, para una destrucción total. Como siempre, asegúrate de tener una de repuesto cargada, o acabarás con las manos vacías. Dada esta naturaleza desechable, se te permite llevar hasta 4 repuestos en tu inventario. Úsalos bien.\n"
"\cfFuego Combinado:\c- Manteniendo el fuego secundario y primario pulsados (en ese orden) puedes optar por, en lugar de realizar la típica recarga explosiva, dejar el cargador dentro de la pistola, armado y listo, y entonces lanzar el arma entera como una granada, para una destrucción total. Como siempre, asegúrate de tener al menos un repuesto y más munición, o acabarás con las manos vacías. Dada esta naturaleza desechable, se te permite llevar hasta 4 repuestos en tu inventario. Úsalos bien.\n"
"\n"
"\cxNotas de Saya:\c-\n"
"\cfNo lo pillo, en serio que no. ¿Como es que mezclando toda esa mierda explosiva con caramelo hace esto? Oh, es igual, me sigue molando mucho cada momento, pero los bonitos fuegos artificiales me dan como nostalgia, no sé por qué...\c-\n"

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.7 r3 \cu(Wed 22 Sep 00:41:28 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.1.7 r3 \cu(2021-09-22 00:41:28)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.7 r4 \cu(Wed 22 Sep 16:50:24 CEST 2021)\c-";
SWWM_SHORTVER="\cw1.1.7 r4 \cu(2021-09-22 16:50:24)\c-";

View file

@ -18,7 +18,7 @@ A highly boosted variant of the standard **Explodium Gun**. Its magenta tint com
\cfSecondary Fire:\c- Perform an "explosive reload", just like with a standard Explodium Gun. Note that unlike its weaker counterpart, the yield is much more extreme. It is best practice to always have one spare magazine at the ready for the reload, so you aren't left with an unusable weapon should your throw miss the target.
\cfCombo Fire:\c- During the first moments of preparing an explosive reload, you can opt to, instead, leave the magazine in the gun, armed and ready, then throw the whole weapon as a grenade, for the ultimate destruction. As always, make sure you have a fully loaded spare around, or you'll be left with nothing. Due to this disposable nature, you're allowed to carry up to 4 spares in your inventory. Use them well.
\cfCombo Fire:\c- By holding secondary and primary fire (in that order) you can opt to, instead of performing the usual explosive reload, leave the magazine in the gun, armed and ready, then throw the whole weapon as a grenade, for the ultimate destruction. As always, make sure you at least have a spare and more ammo, or you'll be left with nothing. Due to this disposable nature, you're allowed to carry up to 4 spares in your inventory. Use them well.
\cxSaya's Notes:\c-
\cfI don't get it, really don't. How is it that mixing that exploding shit with candy does this? Oh, whatever, I still love every second of it, but the pretty fireworks make me really nostalgic, for some reason...\c-

View file

@ -14,7 +14,7 @@ Una variante altamente potenciada de la **Pistola de Explodium** estándar. Su c
\cfFuego Secundario:\c- Realiza una "recarga explosiva", al igual que la Pistola de Explodium estándar. Ten en cuenta que a diferencia de su débil homóloga, la carga explosiva es mucho más extrema. Se recomienda tener siempre un cargador de repuesto listo para la recarga, para no acabar con un arma inútil si el que has lanzado no alcanza su objetivo.
\cfFuego Combinado:\c- Durante los primeros momentos de preparar una recarga explosiva, también puedes, en su lugar, dejar el cargador dentro de la pistola, armado y listo, y entonces lanzar el arma entera como una granada, para una destrucción total. Como siempre, asegúrate de tener una de repuesto cargada, o acabarás con las manos vacías. Dada esta naturaleza desechable, se te permite llevar hasta 4 repuestos en tu inventario. Úsalos bien.
\cfFuego Combinado:\c- Manteniendo el fuego secundario y primario pulsados (en ese orden) puedes optar por, en lugar de realizar la típica recarga explosiva, dejar el cargador dentro de la pistola, armado y listo, y entonces lanzar el arma entera como una granada, para una destrucción total. Como siempre, asegúrate de tener al menos un repuesto y más munición, o acabarás con las manos vacías. Dada esta naturaleza desechable, se te permite llevar hasta 4 repuestos en tu inventario. Úsalos bien.
\cxNotas de Saya:\c-
\cfNo lo pillo, en serio que no. ¿Como es que mezclando toda esa mierda explosiva con caramelo hace esto? Oh, es igual, me sigue molando mucho cada momento, pero los bonitos fuegos artificiales me dan como nostalgia, no sé por qué...\c-

View file

@ -196,7 +196,7 @@ Slot 9. Pistol (but very strong).
A tasty treat of sweetness and DEATH. From the lost forever™ Weirdweapons pack.
Primary fire does the thing.
Secondary fire does also the same thing as its slot 2 counterpart.
Holding primary fire after pressing secondary fire will switch to yeeting the
Holding secondary and primary fire (in that order) will switch to yeeting the
entire damn gun, for some absurd reason. It's very effective, though.
Considering that you can dispose of it like that, you can hold some spares.

View file

@ -896,7 +896,7 @@ Class Demolitionist : PlayerPawn
if ( player.onground && (player.jumptics < -18) )
player.jumptics = 0;
}
if ( player.playerstate != PST_DEAD )
if ( (player.playerstate != PST_DEAD) && !ReactionTime )
{
// quick grenade
if ( player.cmd.buttons&BT_USER4 )

View file

@ -185,6 +185,7 @@ Class PusherWeapon : SWWMWeapon
{
// didn't hit anything, randomly slip off
player.SetPSprite(PSP_WEAPON,ResolveState("AltMiss"));
invoker.bNODEATHDESELECT = true; // prevent any glitching that could happen if the sequence is interrupted
A_StopSound(CHAN_WEAPON);
A_StopSound(CHAN_WEAPONEXTRA);
A_StartSound("pusher/miss",CHAN_WEAPON,CHANF_OVERLAP);
@ -357,18 +358,16 @@ Class PusherWeapon : SWWMWeapon
XZW3 QRSTUVW 1;
TNT1 A -1
{
if ( player.PendingWeapon != WP_NOCHANGE )
invoker.bNODEATHDESELECT = false;
let nw = player.mo.PickNextWeapon();
// gross hack (don't prioritize Deep Impact if we have something better than it)
if ( nw is 'DeepImpact' )
{
let nw = player.mo.PickNextWeapon();
// gross hack (don't prioritize Deep Impact if we have something better than it)
if ( nw is 'DeepImpact' )
{
player.ReadyWeapon = nw;
nw = player.mo.PickNextWeapon();
player.ReadyWeapon = invoker;
}
if ( nw != invoker ) player.PendingWeapon = nw;
player.ReadyWeapon = nw;
nw = player.mo.PickNextWeapon();
player.ReadyWeapon = invoker;
}
if ( nw != invoker ) player.PendingWeapon = nw;
RemoveInventory(invoker);
invoker.Destroy();
}

View file

@ -85,6 +85,7 @@ Class CandyGun : SWWMWeapon
override void DrawWeapon( double TicFrac, double bx, double by, Vector2 hs, Vector2 ss )
{
if ( Amount <= 0 ) return;
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/CandygunDisplay.png",TexMan.Type_Any);
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded');
Screen.DrawTexture(WeaponBox,false,bx-51,by-44,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
@ -215,8 +216,12 @@ Class CandyGun : SWWMWeapon
{
let weap = Weapon(invoker);
if ( !weap ) return;
invoker.bNODEATHDESELECT = true; // prevent any glitching that could happen if the sequence is interrupted
if ( !sv_infiniteammo && !FindInventory('PowerInfiniteAmmo',true) )
{
if ( weap.Ammo2.Amount <= 0 ) weap.Amount = 0;
weap.Ammo2.Amount = max(0,weap.Ammo2.Amount-1);
}
Vector3 x, y, z, x2, y2, z2;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-2*y-3*z);
@ -287,6 +292,7 @@ Class CandyGun : SWWMWeapon
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
if ( sv_infiniteammo || Owner.FindInventory('PowerInfiniteAmmo',true) ) return true;
if ( Amount <= 0 ) return false;
if ( fireMode == PrimaryFire ) return (chambered || (clipcount > 0) || (Ammo1.Amount > 0) || (Owner.CountInv("CandyGunBullets") > 0));
if ( fireMode == AltFire ) return ((Ammo1.Amount > 0) || (Owner.CountInv("CandyGunBullets") > 0));
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
@ -294,6 +300,7 @@ Class CandyGun : SWWMWeapon
override bool ReportHUDAmmo()
{
if ( Amount <= 0 ) return false;
if ( chambered || (clipcount > 0) || (Owner.CountInv("CandyGunBullets") > 0) ) return true;
if ( Ammo1.Amount <= 0 ) return false;
return Super.ReportHUDAmmo();
@ -388,9 +395,14 @@ Class CandyGun : SWWMWeapon
int flg = WRF_ALLOWZOOM|WRF_ALLOWUSER1;
if ( sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true) || (invoker.Ammo1.Amount > 0) || invoker.chambered ) flg |= WRF_ALLOWRELOAD;
if ( (invoker.Ammo1.Amount <= 0) && (CountInv("CandyGunBullets") <= 0) && !sv_infiniteammo && !FindInventory('PowerInfiniteAmmo',true) ) flg |= WRF_NOSECONDARY;
A_WeaponReady(flg);
if ( player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK) )
invoker.CheckAmmo(EitherFire,true);
if ( (flg&WRF_NOSECONDARY) && (player.cmd.buttons&BT_ATTACK) && (player.cmd.buttons&BT_ALTATTACK) )
player.SetPSprite(PSP_WEAPON,ResolveState("SpecialFirePre"));
else
{
A_WeaponReady(flg);
if ( player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK) )
invoker.CheckAmmo(EitherFire,true);
}
}
}
Wait;
@ -500,7 +512,7 @@ Class CandyGun : SWWMWeapon
XZW5 Q 1;
XZW5 R 1
{
if ( player.cmd.buttons&BT_ATTACK && ((((invoker.Ammo1.Amount > 0) || (CountInv("CandyGunBullets") > 0)) && (invoker.Ammo2.Amount > 0)) || sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true)) )
if ( player.cmd.buttons&BT_ATTACK )
player.SetPSprite(PSP_WEAPON,ResolveState("SpecialFire"));
}
XZW5 STUVWXYZ 1;
@ -527,6 +539,12 @@ Class CandyGun : SWWMWeapon
XZW6 XY 2;
XZW6 Z 4;
Goto ReloadEnd;
SpecialFirePre:
XZW2 A 2 A_PlayerReload();
XZW5 NO 2;
XZW5 P 1 A_StartSound("explodium/magpin",CHAN_WEAPON,CHANF_OVERLAP);
XZW5 QR 1;
Goto SpecialFire+1;
SpecialFire:
#### # 1;
XZWA Z 1;
@ -539,25 +557,42 @@ Class CandyGun : SWWMWeapon
XZWB EFGHIJKLMNOPQR 1;
XZWB S 1 A_ThrowGun();
XZWB TUVWXYZ 2;
XZW1 B 0
XZW1 B -1
{
invoker.PlayUpSound(self);
if ( sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true) )
invoker.clipcount = invoker.default.clipcount;
else if ( invoker.Ammo1.Amount <= 0 )
invoker.bNODEATHDESELECT = false;
if ( (invoker.Amount > 0) && (invoker.Ammo2.Amount >= 0) )
{
MagAmmo sb = MagAmmo(FindInventory("CandyGunBullets"));
int takeamt = min(sb.Amount,sb.ClipSize);
invoker.clipcount = takeamt;
sb.Amount -= takeamt;
if ( sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true) )
invoker.clipcount = invoker.default.clipcount;
else if ( invoker.Ammo1.Amount <= 0 )
{
MagAmmo sb = MagAmmo(FindInventory("CandyGunBullets"));
int takeamt = min(sb.Amount,sb.ClipSize);
invoker.clipcount = takeamt;
sb.Amount -= takeamt;
}
else
{
invoker.Ammo1.Amount = max(0,invoker.Ammo1.Amount-1);
invoker.clipcount = invoker.default.clipcount;
}
}
else
if ( invoker.clipcount > 0 )
{
invoker.Ammo1.Amount = max(0,invoker.Ammo1.Amount-1);
invoker.clipcount = invoker.default.clipcount;
invoker.PlayUpSound(self);
return ResolveState("Select");
}
let nw = player.mo.PickPrevWeapon();
if ( nw != invoker ) player.PendingWeapon = nw;
if ( invoker.Amount <= 0 )
{
RemoveInventory(invoker);
invoker.Destroy();
}
else A_FullLower(); // this works
return ResolveState(null);
}
Goto Select;
Stop;
Reload:
XZW2 A 1
{