|
| 1 | +// ============================================================ |
| 2 | +// MonsterMessChunks |
| 3 | +// ============================================================ |
| 4 | +// === Monster Hunt === |
| 5 | +// |
| 6 | +// Copyright 2000 - 2022 Kenneth "Shrimp" Watson |
| 7 | +// For more info, https://shrimpworks.za.net |
| 8 | +// ============================================================ |
| 9 | + |
| 10 | +class MonsterMessChunks extends CreatureChunks; |
| 11 | + |
| 12 | +var CreatureChunks orig; // the original chunk we're going to duplicate |
| 13 | +var bool initialised; |
| 14 | + |
| 15 | +simulated function Landed(vector HitNormal) { |
| 16 | + local MonsterMessSplat splat; |
| 17 | + |
| 18 | + super.Landed(HitNormal); |
| 19 | + |
| 20 | + if ((Level.NetMode != NM_DedicatedServer) && !Level.bDropDetail) { |
| 21 | + if (!bGreenBlood) { |
| 22 | + splat = Spawn(class'MonsterMessSplat',,, Location, rotator(HitNormal)); |
| 23 | + if (splat != None) splat.rescale(Self); |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +simulated function HitWall(vector HitNormal, actor Wall) { |
| 29 | + local MonsterMessSplat splat; |
| 30 | + |
| 31 | + super.HitWall(HitNormal, Wall); |
| 32 | + |
| 33 | + if ((Level.NetMode != NM_DedicatedServer)) { |
| 34 | + if (!bGreenBlood && (!Level.bDropDetail || (FRand() < 0.75))) { |
| 35 | + splat = Spawn(class'MonsterMessSplat',,, Location, rotator(HitNormal)); |
| 36 | + if (splat != None) splat.rescale(Self); |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +function Tick(float delta) { |
| 42 | + // we're effectively polling here, until something sets the original chunk |
| 43 | + // once set, we'll replace the original chunk, and destroy it, then the |
| 44 | + // polling will stop |
| 45 | + if (orig == None || initialised) return; |
| 46 | + |
| 47 | + if (orig.velocity != vect(0, 0, 0) || orig.CarcassClass != None) { |
| 48 | + HijackChunk(); |
| 49 | + initialised = true; |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +/* |
| 54 | + Copies the properties of an existing chunk and simulates the calls made to |
| 55 | + CreatureChunks by CreatureCarcass when chunked. |
| 56 | +*/ |
| 57 | +function HijackChunk() { |
| 58 | + // things the carcass sets |
| 59 | + TrailSize = orig.TrailSize; |
| 60 | + Mesh = orig.Mesh; |
| 61 | + bMasterChunk = orig.bMasterChunk; |
| 62 | + |
| 63 | + // things InitFor sets |
| 64 | + PlayerOwner = orig.PlayerOwner; |
| 65 | + bDecorative = false; |
| 66 | + DrawScale = orig.DrawScale; |
| 67 | + SetCollisionSize(orig.CollisionRadius, orig.CollisionHeight); |
| 68 | + RotationRate = orig.RotationRate; |
| 69 | + Velocity = orig.Velocity; |
| 70 | + |
| 71 | + if (bMasterChunk) { |
| 72 | + // stuff from SetAsMaster |
| 73 | + CarcassClass = orig.CarcassClass; |
| 74 | + CarcassAnim = orig.CarcassAnim; |
| 75 | + CarcLocation = orig.CarcLocation; |
| 76 | + CarcHeight = orig.CarcHeight; |
| 77 | + } |
| 78 | + |
| 79 | + bGreenBlood = orig.bGreenBlood; |
| 80 | + Buoyancy = orig.Buoyancy; |
| 81 | + |
| 82 | + Bugs = orig.Bugs; |
| 83 | + if (Bugs != None) Bugs.SetBase(self); |
| 84 | + |
| 85 | + orig.Destroy(); |
| 86 | +} |
| 87 | + |
| 88 | +defaultproperties { |
| 89 | +} |
0 commit comments