raze/wadsrc/static/zscript/games/duke/actors/dukecstuff/nukebutton.zs

46 lines
856 B
Text
Raw Normal View History

2022-12-01 19:11:38 +00:00
class DukeNukeButton : DukeActor
{
default
{
spriteset "NUKEBUTTON", "NUKEBUTTON1", "NUKEBUTTON2", "NUKEBUTTON3";
}
override void Initialize(DukeActor spawner)
{
self.ChangeStat(STAT_MISC);
2022-12-01 19:11:38 +00:00
}
override void Tick()
{
if (self.counter)
2022-12-01 19:11:38 +00:00
{
self.counter++;
2022-12-01 19:11:38 +00:00
let Owner = self.ownerActor;
if (self.counter == 8) self.setSpritesetImage(1);
else if (self.counter == 16 && Owner)
2022-12-01 19:11:38 +00:00
{
self.setSpritesetImage(2);
Owner.GetPlayer().fist_incs = 1;
}
if (Owner && Owner.GetPlayer().fist_incs == 26)
self.setSpritesetImage(3);
}
}
override bool OnUse(DukePlayer p)
{
if (self.counter == 0 && !p.hitablockingwall())
2022-12-01 19:11:38 +00:00
{
self.counter = 1;
2022-12-01 19:11:38 +00:00
self.ownerActor = p.actor;
p.buttonpalette = self.pal;
if (p.buttonpalette)
ud.secretlevel = self.lotag;
else ud.secretlevel = 0;
}
return true;
}
}