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

64 lines
1.2 KiB
Text
Raw Normal View History

2022-11-15 09:17:23 +00:00
class DukeCactusBroke : DukeActor
{
default
{
clipdist 8;
statnum STAT_ACTOR;
pic "CACTUSBROKE";
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
}
}
class DukeCactus : DukeCactusBroke
{
default
{
clipdist 8;
statnum STAT_ACTOR;
spriteset "CACTUS", "CACTUSBROKE";
}
override void onHit(DukeActor hitter)
{
if (self.spritesetindex == 0 && hitter.actorflag1(SFLAG_INFLAME))
{
let scrap = Raze.isRR()? DukeScrap.Scrap6 : DukeScrap.Scrap3;
for (int k = 0; k < 64; k++)
{
double ang = frandom(0, 360);
double vel = frandom(4, 8);
double zvel = -frandom(0, 16) - self.vel.Z * 0.25;
let spawned = dlevel.SpawnActor(self.sector, self.pos.plusZ(-48), "DukeScrap", -8, (0.75, 0.75), ang, vel, zvel, self);
if (spawned)
{
spawned.spriteextra = DukeScrap.Scrap3 + random(0, 3);
spawned.pal = 6;
}
}
2022-12-01 12:58:18 +00:00
self.setSpritesetImage(1);
2022-11-15 09:17:23 +00:00
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
}
}
override void onHurt(DukePlayer p)
{
if (self.spritesetindex == 0 && p.hurt_delay < 8)
{
p.actor.extra -= 5;
p.hurt_delay = 16;
p.pals = Color(32, 32, 0, 0);
p.actor.PlayActorSound("PLAYER_LONGTERM_PAIN");
2022-11-15 09:17:23 +00:00
}
}
}