Remove 2x speed mult from hardest skill(s) (causes glitches). Allow moths to still attack while following the lamp. (Still do not know what causes moths to print "asin domain error" to terminal).
76 lines
2.5 KiB
Text
76 lines
2.5 KiB
Text
// I WANT DIE
|
|
|
|
// tokens
|
|
Class DontDuplicate : Inventory {}
|
|
Class DontDuplicate2 : Inventory {}
|
|
|
|
extend Class SWWMHandler
|
|
{
|
|
double smult;
|
|
int dmult;
|
|
|
|
private void IWantDieSpawn( WorldEvent e )
|
|
{
|
|
if ( iwantdie == -1 )
|
|
{
|
|
int acsre = G_SkillPropertyInt(SKILLP_ACSReturn);
|
|
iwantdie = (acsre >= 5);
|
|
smult = 2.-(acsre-5)*.5; // reduced in Kynikoss skill because it'd stack with FastMonsters
|
|
dmult = acsre-3;
|
|
}
|
|
if ( iwantdie <= 0 ) return;
|
|
if ( SWWMUtility.ValidProjectile(e.Thing) && !e.Thing.FindInventory("DontDuplicate") && (e.Thing.target && e.Thing.target.bISMONSTER && !e.Thing.target.player) )
|
|
{
|
|
e.Thing.speed *= smult;
|
|
e.Thing.vel *= smult;
|
|
double ang = e.Thing.target.target?e.Thing.AngleTo(e.Thing.target.target):e.Thing.angle;
|
|
double pt = e.Thing.target.target?e.Thing.PitchTo(e.Thing.target.target,e.Thing.target.missileheight,e.Thing.target.target.Height/2.):e.Thing.pitch;
|
|
let [x, y, z] = SWWMUtility.GetAxes(ang,pt,e.Thing.roll);
|
|
int numpt = Random[ExtraMissiles](1,dmult);
|
|
for ( int i=0; i<numpt; i++ )
|
|
{
|
|
double a = FRandom[ExtraMissiles](0,360);
|
|
double s = FRandom[ExtraMissiles](0,.1);
|
|
Vector3 dir = SWWMUtility.ConeSpread(x,y,z,a,s);
|
|
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.bISMONSTER || (e.Thing is 'PlayerPawn') ) return;
|
|
// avoid if it has some sort of special handling
|
|
if ( e.Thing.special || e.Thing.tid || e.Thing.bDORMANT ) return;
|
|
// random chance to spawn doubles
|
|
if ( e.Thing.FindInventory("DontDuplicate") || Random[ExtraMissiles](0,2) ) return;
|
|
int numpt = Random[ExtraMissiles](1,dmult);
|
|
for ( int i=0; i<numpt; i++ )
|
|
{
|
|
// three attempts for each
|
|
for ( int j=0; j<3; j++ )
|
|
{
|
|
let x = Actor.Spawn(e.Thing.GetClass(),e.Thing.Vec3Angle(e.Thing.Radius*FRandom[ExtraMissiles](1.5,4.),FRandom[ExtraMissiles](0,360)));
|
|
if ( x.pos.z+x.height > x.ceilingz ) x.SetZ(x.ceilingz-x.height);
|
|
if ( x.pos.z < x.floorz ) x.SetZ(x.floorz);
|
|
if ( !x.TestMobjLocation() || !x.TestMobjZ() || !level.IsPointInLevel(x.pos) )
|
|
{
|
|
x.ClearCounters();
|
|
x.Destroy();
|
|
}
|
|
else
|
|
{
|
|
x.angle = e.Thing.angle;
|
|
x.bAMBUSH = e.Thing.bAMBUSH;
|
|
x.GiveInventory("DontDuplicate",1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|