mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-14 14:41:21 +00:00
513de38723
Using ownerActor is not robust, for some actors this will have unwanted side effects.
53 lines
974 B
Text
53 lines
974 B
Text
|
|
|
|
class DukeRat : DukeActor
|
|
{
|
|
default
|
|
{
|
|
pic "RAT";
|
|
+INTERNAL_BADGUY;
|
|
+ALWAYSROTATE1;
|
|
}
|
|
|
|
override void Initialize(DukeActor spawner)
|
|
{
|
|
if (!self.mapSpawned) self.lotag = 0;
|
|
|
|
self.makeitfall();
|
|
self.angle = frandom(0, 360);
|
|
self.cstat = 0;
|
|
|
|
if (spawner)
|
|
{
|
|
self.timetosleep = 0;
|
|
self.ChangeStat(STAT_ACTOR);
|
|
if (isRR()) self.shade = spawner.shade;
|
|
}
|
|
else self.ChangeStat(STAT_ZOMBIEACTOR);
|
|
self. clipdist = 10;
|
|
self. scale = (0.75, 0.75);
|
|
}
|
|
|
|
override void Tick()
|
|
{
|
|
self.makeitfall();
|
|
if (self.DoMove(CLIPMASK0))
|
|
{
|
|
if (!isRRRA() && random(0, 255) == 0) self.PlayActorSound("RATTY");
|
|
self.angle += Raze.BAngToDegree * (random(-15, 15) + Raze.BobVal(self.counter << 8) * 8);
|
|
}
|
|
else
|
|
{
|
|
self.counter++;
|
|
if (self.counter > 1)
|
|
{
|
|
self.Destroy();
|
|
return;
|
|
}
|
|
else self.angle = frandom(0, 360);
|
|
}
|
|
if (self.vel.X < 8)
|
|
self.vel.X += 1/8.;
|
|
self.angle += Raze.BAngToDegree * (random(0, 3) - 6);
|
|
}
|
|
}
|