raze/wadsrc/static/zscript/games/duke/actors/gamblingmachine.zs
Christoph Oelckers a6a4e628df - scriptified RRRA's gambling machines.
These were fallout from the generic destructibles because the code to destroy them was removed along with that.
2022-12-11 19:43:46 +01:00

132 lines
2.3 KiB
Text

class RedneckGamblingMachine : DukeActor
{
default
{
statnum STAT_ACTOR;
lotag 1;
clipdist 0;
extra 0;
spriteset "GAMBLINGMACHINE2", "GAMBLINGMACHINE3", "GAMBLINGMACHINE4", "GAMBLINGMACHINE5", "GAMBLINGMACHINE6", "GAMBLINGMACHINE7", "GAMBLINGMACHINE8", "GAMBLINGMACHINEBROKE";
spritesetindex 3;
}
Sound winsound;
override void Initialize()
{
winsound = "COW3";
}
override void Tick()
{
int spriteindex;
if (self.extra && self.spritesetindex < 7)
{
let pl = Duke.GetViewPlayer();
if (self.spritesetindex != 0)
spriteindex = 0;
self.extra--;
if (self.extra == 0)
{
int rvar = random(0, 127);
if (rvar < 96)
{
spriteindex = 3;
}
else if (rvar < 112)
{
if (pl.SlotWin & 1)
{
spriteindex = 3;
}
else
{
spriteindex = 2;
self.spawn("DukeBatteryAmmo");
pl.SlotWin |= 1;
self.PlayActorSound(winsound);
}
}
else if (rvar < 120)
{
if (pl.SlotWin & 2)
{
spriteindex = 3;
}
else
{
spriteindex = 6;
self.spawn("RedneckDynamite");
pl.SlotWin |= 2;
self.PlayActorSound(winsound);
}
}
else if (rvar < 126)
{
if (pl.SlotWin & 4)
{
spriteindex = 3;
}
else
{
spriteindex = 5;
self.spawn("DukeSixpak");
pl.SlotWin |= 4;
self.PlayActorSound(winsound);
}
}
else
{
if (pl.SlotWin & 8)
{
spriteindex = 3;
}
else
{
spriteindex = 4;
spawn("DukeAtomicHealth");
pl.SlotWin |= 8;
self.PlayActorSound(winsound);
}
}
}
self.setSpriteSetImage(spriteindex);
}
}
override void OnHit(DukeActor proj)
{
if (self.spritesetindex < 7)
{
self.SetSpriteSetImage(7);
self.PlayActorSound("GLASS_HEAVYBREAK");
}
}
override bool OnUse(DukePlayer p)
{
if (self.spritesetindex > 1 && self.spritesetindex < 7)
{
self.extra = 60;
self.PlayActorSound("SLOTS");
return true;
}
return false;
}
}
class RedneckGamblingMachine2 : RedneckGamblingMachine
{
default
{
spriteset "GAMBLINGMACHINE2_2", "GAMBLINGMACHINE2_3", "GAMBLINGMACHINE2_4", "GAMBLINGMACHINE2_5", "GAMBLINGMACHINE2_6", "GAMBLINGMACHINE2_7", "GAMBLINGMACHINE2_8", "GAMBLINGMACHINE2_BROKE";
}
override void Initialize()
{
winsound = "VX_TPIN2";
}
}