As part of creating a stealth system, I've decided to place volumes over light sources as a first step. The idea being that when a pawn walks into one of those volumes, it will be logged. This is not happening.
The relevant code is located below, and represents my experimentation. It seemed like the best way to create new lights was to modify some code I already had been using. In addition to having a fire spread (really more move in a line very slowly), it would also create my test objects.
The log also informs me that my volumes are being created. What am I doing wrong?
Fire.uc
class Fire extends Actor;
//DecalActors may or may not be something fires should deal with.
//var DecalActor DecalActor;
var FlambergeLight FlambergeLight;
//This is just to make the thing compile. It might not be needed
var Object.Vector LocationNormal;
//The System Component for this particular fire. This is likely something that we will want to change after it is created.
var ParticleSystemComponent FireSystemComponent;
//Here's some stuff related to doing damage
var float BaseDamage;
var float DamageRadius;
var class<DamageType> DamageType;
var float Momentum;
var Object.Vector HurtOrigin;
event PostBeginPlay ()
{
OGawdStart();
}
//Really this should just be given a Location, not a Location and a Normal. But this is a minimal implementation and a work in progress.
//Maybe at some point we do want to have an EffectAttachActor, and not just set it to none. Needs investigation!
function InitializeFire(ParticleSystem FireSystem, WorldInfo FireWorldInfo, Object.Vector FireLocation, Object.Vector FireLocationNormal, Actor FireEffectAttachActor)
{
HurtOrigin = FireLocation;
LocationNormal = FireLocationNormal;
`log(" Fir Loc:" $ FireLocation $ " FirNormal " $ FireLocationNormal);
//DecalActor = DecalActor.Spawn(class'DecalActor',,, FireLocation);
FlambergeLight = Spawn(class'FlambergeLight',,, FireLocation);
FlambergeLight.InitializeLight(FireLocation); <- Probably the only relevant line in this file.
FireSystemComponent = FireWorldInfo.MyEmitterPool.SpawnEmitter(FireSystem, FireLocation, rotator(FireLocationNormal), FireEffectAttachActor);
FireSystemComponent.ActivateSystem();
}
function Spread()
{
local Object.vector newLoc;
local Fire fir;
newLoc.x = Location.x+50;
newLoc.y = Location.y+50;
newLoc.z = Location.z;
//`log(" Loc:" $ Location $ " newLoc" $ newLoc);
Fir = Spawn(class'Fire',,, newLoc);
Fir.InitializeFire(ParticleSystem'WP_Fireball.Effects.newfire', WorldInfo, newLoc, LocationNormal, None);
}
function OGawdStart()
{
//`log("OGawdStart");
SetTimer(1,true, 'OGawd');
SetTimer(10,false, 'Spread');
SetTimer(15,false, 'GoOut');
}
function OGawd()
{
//`log("OGawd");
HurtRadius(BaseDamage, DamageRadius, DamageType, Momentum, HurtOrigin);
}
function GoOut()
{
FireSystemComponent.DeactivateSystem();
Destroy();
FlambergeLight.Destroy();
}
defaultproperties
{
BaseDamage = 50;
DamageRadius = 50;
//We will likely want our own damage type
DamageType = class'UTDmgType_Burning';
Momentum = 0;
}
FlambergeLightVolume.uc
class FlambergeLightVolume extends BlockingVolume;
simulated event Touch (Actor Other, PrimitiveComponent OtherComp, Object.Vector HitLocation, Object.Vector HitNormal)
{
Super.Touch(Other, OtherComp, HitLocation, HitNormal);
`log("Volume Touch");
}
simulated event Untouch (Actor Other)
{
Super.untouch(Other);
`log("Volume UnTouch");
}
simulated event PostBeginPlay ()
{
Super.PostBeginPlay();
`log("PostBeginPlay");
}
simulated event ProcessActorSetVolume (Actor Other)
{
Super.ProcessActorSetVolume(Other);
`log("ProcessActorSetVolume");
}
simulated event CollisionChanged ()
{
Super.CollisionChanged();
`log("CollisionChanged");
}
defaultproperties
{
bStatic = false;
bNoDelete = false;
}
FlambergeLight.uc
class FlambergeLight extends PointLight
placeable
ClassGroup(Lights);
var FlambergeLightVolume Volume;
function InitializeLight(Object.Vector CreateLocation)
{
`log("About to spawn at" $ CreateLocation);
Volume = Spawn(class'FlambergeLightVolume',,, CreateLocation);
Volume.AssociatedActor = Self;
Volume.GotoState('AssociatedTouch');
}
event Touch (Actor Other, PrimitiveComponent OtherComp, Object.Vector HitLocation, Object.Vector HitNormal)
{
Super.Touch(Other, OtherComp, HitLocation, HitNormal);
`log("Touch");
}
event Untouch (Actor Other)
{
Super.untouch(Other);
`log("UnTouch");
}
event Bump (Actor Other, PrimitiveComponent OtherComp, Object.Vector HitNormal)
{
Super.Bump(Other, OtherComp, HitNormal);
`log("Bump");
}
event RanInto (Actor Other)
{
Super.RanInto(Other);
`log("RanInto");
}
defaultproperties
{
bStatic = false;
bNoDelete = false;
}