raze/wadsrc/static/zscript/games/duke/actors/toilet.zs

95 lines
1.7 KiB
Text
Raw Normal View History

2022-12-02 23:42:42 +00:00
class DukeStall : DukeActor
{
default
{
spriteset "STALL", "STALLBROKE";
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
self.OwnerActor = self;
self.lotag = 1;
self.clipdist = 2;
2022-12-02 23:42:42 +00:00
}
override bool OnUse(DukePlayer p)
{
if (self.spritesetindex == 0)
{
let pact = p.actor;
if (p.last_pissed_time == 0)
{
pact.PlayActorSound("PLAYER_URINATE");
p.last_pissed_time = 26 * 220;
p.transporter_hold = 29 * 2;
if (p.holster_weapon == 0)
{
p.holster_weapon = 1;
p.weapon_pos = -1;
}
if (pact.extra <= (gs.max_player_health - (gs.max_player_health / 10)))
{
pact.extra += gs.max_player_health / 10;
p.last_extra = pact.extra;
}
else if (pact.extra < gs.max_player_health)
pact.extra = gs.max_player_health;
}
else if (self.CheckSoundPlaying("FLUSH_TOILET") == 0)
self.PlayActorSound("FLUSH_TOILET");
return true;
}
return false;
}
override void OnHit(DukeActor proj)
{
if (self.getSpritesetSize() > 1)
{
self.setSpriteSetImage(1);
if (random(0, 1)) self.cstat |= CSTAT_SPRITE_XFLIP;
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
self.spawn("DukeToiletWater");
self.PlayActorSound("GLASS_BREAKING");
}
}
}
class DukeToilet : DukeStall
{
default
{
spriteset "TOILET", "TOILETBROKE";
}
override void StandingOn(DukePlayer p)
{
if (Raze.isRR() && p.PlayerInput(Duke.SB_CROUCH) && !p.OnMotorcycle)
{
p.actor.PlayActorSound("CRAP");
p.last_pissed_time = 4000;
p.eat = 0;
}
}
}
class RedneckToilet2 : DukeToilet
{
default
{
spriteset "TOILET2";
}
}
class RedneckToiletSeat : DukeToilet
{
default
{
spriteset "TOILETSEAT";
}
}