Major code refactoring. SWWMHandler could still use some more, though.
This commit is contained in:
parent
0eec40e723
commit
c5abe83831
94 changed files with 17859 additions and 17678 deletions
82
zscript/handler/swwm_handler_iwantdie.zsc
Normal file
82
zscript/handler/swwm_handler_iwantdie.zsc
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
// I WANT DIE
|
||||
|
||||
// fuck
|
||||
Class DontDuplicate : Inventory {}
|
||||
Class DontDuplicate2 : Inventory {}
|
||||
Class HOLYCOWIMTOTALLYGOINGSOFASTOHFUCK : Inventory
|
||||
{
|
||||
override void DoEffect()
|
||||
{
|
||||
Super.DoEffect();
|
||||
if ( !Owner || (Owner.Health <= 0) ) return;
|
||||
if ( (Owner.tics > 1) && (Owner.tics > max(1,Owner.CurState.tics/2)) )
|
||||
Owner.tics = max(1,Owner.CurState.tics/2);
|
||||
}
|
||||
}
|
||||
|
||||
extend Class SWWMHandler
|
||||
{
|
||||
private void IWantDieSpawn( WorldEvent e )
|
||||
{
|
||||
if ( iwantdie == -1 ) iwantdie = (G_SkillName() == StringTable.Localize("$SWWM_SKLUNATIC"));
|
||||
if ( iwantdie )
|
||||
{
|
||||
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;
|
||||
double ang = e.Thing.target.target?e.Thing.AngleTo(e.Thing.target.target):e.Thing.angle;
|
||||
double pt = e.Thing.target.target?SWWMUtility.PitchTo(e.Thing,e.Thing.target.target,.5):e.Thing.pitch;
|
||||
[x, y, z] = swwm_CoordUtil.GetAxes(pt,ang,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.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++ )
|
||||
{
|
||||
// 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.GiveInventory("DontDuplicate",1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue