I WANT DIE overhaul, suffer.

Fix Silver Bullet ammo autoswitch on reload.
This commit is contained in:
Mari the Deer 2021-01-03 01:51:12 +01:00
commit 7260fd4140
4 changed files with 78 additions and 3 deletions

View file

@ -1,2 +1,2 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r727 \cu(Sat 2 Jan 23:26:14 CET 2021)";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r729 \cu(Sun 3 Jan 01:51:49 CET 2021)";

View file

@ -113,9 +113,9 @@ Skill lunatic
FastMonsters
DisableCheats
Aggressiveness = 1.0
MonsterHealth = 2.0
DamageFactor = 2.0
SpawnFilter = nightmare
SpawnMulti
TotalInfighting
ACSReturn = 4
Name = "$SWWM_SKLUNATIC"
MustConfirm = "$SWWM_SKLUNATICCONFIRM"

View file

@ -173,6 +173,20 @@ Class SWWMStaticHandler : StaticEventHandler
}
}
// fuck
Class DontDuplicate : Inventory {}
Class DontDuplicate2 : Inventory {}
Class HOLYCOWIMTOTALLYGOINGSOFASTOHFUCK : Inventory
{
override void DoEffect()
{
Super.DoEffect();
if ( !Owner ) return;
if ( (Owner.tics > 1) && (Owner.tics > max(1,Owner.CurState.tics/2)) )
Owner.tics = max(1,Owner.CurState.tics/2);
}
}
// Handler responsible for item replacements and whatever else
Class SWWMHandler : EventHandler
{
@ -1687,6 +1701,65 @@ Class SWWMHandler : EventHandler
override void WorldThingSpawned( WorldEvent e )
{
// I WANT DIE
if ( G_SkillPropertyInt(SKILLP_ACSReturn) >= 4 )
{
if ( e.Thing.bMISSILE && !e.Thing.FindInventory("DontDuplicate") && !e.Thing.IsZeroDamage() && (e.Thing.target && e.Thing.target.bISMONSTER && !e.Thing.target.player) )
{
e.Thing.speed *= 2;
e.Thing.vel *= 2;
Vector3 x, y, z;
[x, y, z] = swwm_CoordUtil.GetAxes(e.Thing.pitch,e.Thing.angle,e.Thing.roll);
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
double a = FRandom[ExtraMissiles](0,360);
double s = FRandom[ExtraMissiles](0,.1);
Vector3 dir = (x+y*cos(a)*s+z*sin(a)*s).unit();
let p = Actor.Spawn(e.Thing.GetClass(),e.Thing.pos);
p.GiveInventory("DontDuplicate",1);
p.target = e.Thing.target;
p.tracer = e.Thing.tracer;
p.master = e.Thing.master;
p.speed *= FRandom[ExtraMissiles](1.,3.);
p.vel = dir*p.speed;
p.angle = atan2(dir.y,dir.x);
p.pitch = asin(-dir.z);
p.roll = e.Thing.roll;
}
}
if ( e.Thing is 'BulletPuff' )
{
let s = Actor.Spawn("ExplodiumMagTrail",e.Thing.pos);
s.Scale *= .4;
Actor.Spawn("ExploLight",e.Thing.pos);
e.Thing.A_StartSound("explodium/hit",CHAN_WEAPON,CHANF_OVERLAP,pitch:1.5);
SWWMUtility.DoExplosion(e.Thing,10,7000,80);
}
if ( e.Thing.bISMONSTER && !(e.Thing is 'PlayerPawn') )
{
e.Thing.GiveInventory("HOLYCOWIMTOTALLYGOINGSOFASTOHFUCK",1);
// random chance to spawn doubles
if ( !e.Thing.FindInventory("DontDuplicate") && !Random[ExtraMissiles](0,2) )
{
int numpt = Random[ExtraMissiles](1,2);
for ( int i=0; i<numpt; i++ )
{
let x = Actor.Spawn(e.Thing.GetClass(),e.Thing.Vec3Angle(e.Thing.Radius*FRandom[ExtraMissiles](1.5,4.),FRandom[ExtraMissiles](0,360)));
if ( !x.TestMobjLocation() || !level.IsPointInLevel(x.pos) )
{
x.ClearCounters();
x.Destroy();
}
else
{
x.angle = e.Thing.angle;
x.GiveInventory("DontDuplicate",1);
}
}
}
}
}
if ( e.Thing is 'Inventory' )
CopyFloatBob(e.Thing);
if ( swwm_doomfall && e.Thing.bISMONSTER )

View file

@ -1456,6 +1456,8 @@ Class SilverBullet : SWWMWeapon
Reload:
XZW2 A 0
{
// autoswitch if needed
A_SwitchAmmoType(true);
if ( ((invoker.clipcount >= invoker.default.clipcount) && (invoker.fcbselected == invoker.fcbloaded)) || (!sv_infiniteammo && !FindInventory('PowerInfiniteAmmo',true) && (invoker.Ammo1.Amount <= 0) && (invoker.Ammo2.Amount <= 0) && (CountInv("SilverBullets") <= 0) && (CountInv("SilverBullets2") <= 0)) )
return ResolveState("Idle");
if ( invoker.zoomed )