raze/wadsrc/static/zscript/games/duke/actors/firefly.zs

91 lines
1.3 KiB
Text
Raw Normal View History

class DukeFireflyShrinkEffect : DukeActor
{
default
{
pic "FIREFLYSHRINKEFFECT";
}
}
class DukeFireflyGrowEffect : DukeActor
{
default
{
pic "FIREFLYGROWEFFECT";
}
}
class DukeFireflyFlyingEffect : DukeActor
{
default
{
pic "FIREFLYFLYINGEFFECT";
+FORCERUNCON;
}
override void Initialize()
{
self.scale = (0.25, 0.25);
self.ChangeStat(STAT_MISC);
}
override void Tick()
{
Super.Tick();
if (bDestroyed) return; // killed by script.
let Owner = self.ownerActor;
2022-12-14 21:21:51 +00:00
if (!Owner || !(Owner is 'DukeFirefly'))
{
self.Destroy();
return;
}
if (Owner.scale.X >= 0.375 || Owner.pal == 1)
self.cstat |= CSTAT_SPRITE_INVISIBLE;
else
self.cstat &= ~CSTAT_SPRITE_INVISIBLE;
let p = self.findplayer();
let dvec = Owner.pos.XY - p.actor.pos.XY;
double dist = dvec.Length();
if (dist != 0.0) dvec /= dist;
self.pos = Owner.pos + (dvec.X * -0.625, dvec.Y * -0.625, 8);
if (Owner.extra <= 0)
{
self.Destroy();
}
}
}
2022-12-14 13:38:09 +00:00
class DukeFirefly : DukeActor
{
default
{
pic "FIREFLY";
+INTERNAL_BADGUY;
+KILLCOUNT;
2022-12-14 13:38:09 +00:00
}
override bool ShootThis(DukeActor shooter, DukePlayer p, Vector3 spos, double sang) const
2022-12-14 13:38:09 +00:00
{
let k = shooter.spawn("DukeFirefly");
if (k)
{
k.sector = shooter.sector;
k.pos = spos;
k.Angle = sang;
k.vel.X = 500 / 16.;
k.vel.Z = 0;
}
return true;
}
}