This is pretty much all the code, (except the boring config menu stuff), for the upcoming release of MoreGorePlus, which is a
rewrite of the old MoreGore mutator.
Posting this up both as sort of an example of how to do this sort of thing, and also to try and get any feedback from anybody who
takes the time to look at it and see's anything horribly wrong or out of place. (Seems to be working fine in testing so far....)
I think it is ready now, but figure I might as well see if I can get some input before I finalize things and try to write the readme.txt file
for it. Hope this isnt too much for posting in here. Just 2 classes. Tried to keep em as tight as possible.
Main mutator:
Code: Select all
//=========================================================================================
// MoreGore Plus Mutator by Mr.Loathsome. Based on MoreGore2 by shiftre from Clan 404
//=========================================================================================
class MG expands Mutator;
var int goreLevel;
var float SpawnRate, GibRate;
var bool DigDugMode;
var rotator splatRotator;
var bool bInitialized, bDoSpawn;
function PostBeginPlay()
{
if (bInitialized) return; else bInitialized = true;
bDoSpawn = True;
splatRotator.Pitch = 16384;
Level.Game.RegisterDamageMutator(Self);
goreLevel = class'MoreGore2ClientWindow'.Default.goreLevel;
SpawnRate = class'MoreGore2ClientWindow'.Default.SpawnRate;
GibRate = class'MoreGore2ClientWindow'.Default.GibRate;
DigDugMode = class'MoreGore2ClientWindow'.Default.DigDugMode;
Super.PostBeginPlay();
}
function Timer()
{
bDoSpawn = True;
}
function ScoreKill(Pawn Killer, Pawn Other)
{
local GibSpawn g;
//Set up player explode on death if DigDugMode on
if (DigDugMode)
{
Other.HidePlayer();
Other.Fatness = 128;
Other.Health = -100;
}
//check whether victim is at gib status
if (((bDoSpawn) && (ScriptedPawn(Other) != None)) || ((bDoSpawn) && ((Other.Health < -60) || ((Other.Health < -30) && (Other.FRand() < 0.6)))))
{
g = Spawn(class'GibSpawn', Other);
if (g != None)
{
if ((ScriptedPawn(Other) != None) && (ScriptedPawn(Other).bGreenBlood))
{
g.SetLevel(goreLevel, Other.Location, True, GibRate);
}
else
{
g.SetLevel(goreLevel, Other.Location, False, GibRate);
}
Other.HidePlayer();
SetTimer(SpawnRate, False);
bDoSpawn = False;
}
}
//Call next mutator down the line
if ( NextMutator != None )
NextMutator.ScoreKill(Killer, Other);
}
function MutatorTakeDamage( out int ActualDamage, Pawn Victim, Pawn InstigatedBy, out Vector HitLocation,
out Vector Momentum, name DamageType)
{
local vector Mo;
if ( NextDamageMutator != None)
NextDamageMutator.MutatorTakeDamage( ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType );
//Increase size of victim when hit if DigDugMode on
if (DigDugMode) {
if ((Victim.Fatness+ActualDamage)>255)
Victim.Fatness = 255;
else
Victim.Fatness = Victim.Fatness+ActualDamage;
}
//Drop blood on hit & add more blood spray
// if ((HitLocation.x != 0) && (HitLocation.y != 0) && (HitLocation.z != 0))
if (HitLocation != vect(0,0,0))
{
Mo = Momentum;
if ( Mo.Z > 0 )
Mo.Z *= (0.9);
if ((ScriptedPawn(Victim) != None) && (ScriptedPawn(Victim).bGreenBlood))
{
spawn( class'GreenBloodSpray', , , HitLocation, rotator(Mo));
}
else
{
spawn( class'BloodSpray', , , HitLocation, rotator(Mo));
if (FRand() < 0.25)
spawn( class'BloodSplat', , , Victim.Location, splatRotator);
}
}
}
defaultproperties
{
}
Code: Select all
class GibSpawn extends actor;
var int Ngibs;
var float GRate;
var bool bDoSpawn;
var vector cloc;
var pawn chunky;
var class<Pawn> pClass;
function SetLevel(int GLev, vector L, bool bGb, float GR)
{
Ngibs = GLev;
cloc = L;
GRate = GR;
if (bGb)
{
pClass = class'Unreali.Mercenary';
}
else
{
pClass = class'Unreali.Cow';
}
bDoSpawn = True;
SetTimer(GRate, False);
}
function Timer()
{
chunky = Spawn(pClass,,,cloc);
if (chunky != None)
{
chunky.HidePlayer();
chunky.health = -100;
chunky.GotoState('Waiting');
} else Destroy();
bDoSpawn = True;
}
simulated function tick(float dt)
{
if (bDoSpawn)
{
if (Ngibs <= 0)
{
if (chunky != None)
{
chunky.Destroy();
}
Destroy();
}
else
{
if (chunky != None)
{
chunky.SpawnGibbedCarcass();
chunky.Destroy();
Ngibs--;
SetTimer(GRate, False);
bDoSpawn = False;
}
}
}
}
defaultproperties
{
bHidden=True
}
Green blood support, the GibSpawn class and the timers are the major changes with this.