raze/wadsrc/static/zscript/games/duke/actors/waterdrip.zs
Christoph Oelckers f103e33300 - fixed code up to the point where everything compiles again. Duke sounds are currently non-functional.
All Duke script code has been changed to use strings as sound names now, just like GZDoom these will be looked up at compile time.
Original Duke sound indices still exist but are now being managed as resource IDs, not sound engine indices anymore.
2022-12-11 18:41:51 +01:00

74 lines
1.3 KiB
Text

class DukeWaterDrip : DukeActor
{
default
{
ScaleX 0.375;
ScaleY 0.375;
statnum STAT_STANDABLE;
pic "WATERDRIP";
}
override void Initialize()
{
let owner = self.ownerActor;
if (owner && (owner.statnum == STAT_PLAYER || owner.statnum == STAT_ACTOR))
{
self.shade = 32;
if (owner.pal != 1)
{
self.pal = 2;
self.pos.Z -= 18;
}
else self.pos.Z -= 13;
self.angle = (Duke.GetViewPlayer().actor.pos.XY - self.pos.XY).Angle();
self.vel.X = frandom(1, 3);
self.DoMove(CLIPMASK0);
}
else if (owner == self)
{
self.pos.Z += 4;
self.temp_pos.Z = self.pos.Z;
self.temp_data[1] = random(0, 127);
}
}
override void Tick()
{
if (self.temp_data[1])
{
self.temp_data[1]--;
if (self.temp_data[1] == 0)
self.cstat &= ~CSTAT_SPRITE_INVISIBLE;
}
else
{
self.makeitfall();
self.DoMove(CLIPMASK0);
if(self.vel.X > 0) self.vel.X -= 1/8.;
if (self.vel.Z == 0)
{
self.cstat |= CSTAT_SPRITE_INVISIBLE;
if (self.pal != 2 && (self.hitag == 0 || Raze.isRR()))
self.PlayActorSound("SOMETHING_DRIPPING");
if (self.ownerActor != self)
{
self.Destroy();
}
else
{
self.pos.Z = self.temp_pos.Z;
self.backuppos();
self.temp_data[1] = random(48, 79);
}
}
}
}
}