raze/wadsrc/static/zscript/games/duke/actors/rrteleport.zs
Christoph Oelckers 3a00480efd - do not use properties to set the sprite fields, part 1.
As soon as default init for CON gets in this won't work right anymore - these must come last, not first.
This commit contains all the trivial cases with no inheritance concerns.
2023-01-08 15:46:23 +01:00

51 lines
1,022 B
Text

class RedneckTeleportDest : DukeActor
{
default
{
pic "RRTELEPORTDEST";
}
override void Initialize()
{
self. Scale = (1, 1);
self.clipdist = 16;
self.ChangeStat(STAT_TELEPORT);
}
}
class RedneckTeleport : RedneckTeleportDest
{
default
{
pic "RRTELEPORT";
}
override void Tick()
{
double xx;
DukePlayer p;
[p, xx] = self.findplayer();
if (xx < 128)
{
DukeStatIterator it;
for(let act2 = it.First(STAT_TELEPORT); act2; act2 = it.Next())
{
if (act2.GetClassName() == 'RedneckTeleportDest')
{
p.setTargetAngle(act2.angle, true);
let pactor = p.actor;
pactor.pos = act2.pos.plusZ(-36 + gs.playerheight);
pactor.backuppos();
p.setbobpos();
pactor.ChangeSector(act2.sector);
p.cursector = pactor.sector;
act2.PlayActorSound("TELEPORTER");
act2.cstat = CSTAT_SPRITE_INVISIBLE;
act2.cstat2 |= CSTAT2_SPRITE_NOFIND;
act2.ChangeStat(STAT_REMOVED); // this is still needed for the sound so don't destroy.
}
}
}
}
}