Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class S7_ThumperGrenadeFlare : S7_ThumperGrenade {
- default {
- damageFunction (fRandom [weaponDamage] (1.0, 6.0) * 5);
- damageType "TH_GrenadeImpact";
- translation "112:127=80:95";
- -noGravity
- }
- bool initialized;
- int maxTime;
- int time;
- PointLight dynLight;
- override void PostBeginPlay () {
- time = maxTime = random [weaponSpc] (1025, 1050);
- if (!dynLight)
- dynLight = PointLight (Spawn ("PointLight")); // Spawn the dynamic light
- dynLight.target = self;
- dynLight.args [DynamicLight.Light_Red] = 114; // Color - Red
- dynLight.args [DynamicLight.Light_Green] = 186; // Color - Green
- dynLight.args [DynamicLight.Light_Blue] = 255; // Color - Blue
- dynLight.args [DynamicLight.Light_Intensity] = 85; // Size
- //dynLight.args [DynamicLight.Light_Secondary_Intensity] = 75; // Secondary size
- //dynLight.angle = 0.72;
- A_PlaySound ("Fire/Flare", CHAN_7, 0.15, TRUE);
- initialized = true;
- }
- states {
- Spawn:
- THGR A 1 {
- if (time <= 0)
- return ResolveState ("RanOut");
- if (dynLight) {
- double mult = 1.0;
- if (time < (maxTime * 0.25))
- mult = Clamp (time / (maxTime * 0.025), 0.05, 1.0);
- dynLight.args [DynamicLight.Light_Intensity] = int (floor (85 * mult));
- //dynLight.args [DynamicLight.Light_Secondary_Intensity] = int (floor (75 * mult));
- } else
- return ResolveState ("RanOut");
- time--;
- return ResolveState (null);
- }
- loop;
- Death:
- TNT1 A 0 {
- if (!initialized)
- PostBeginPlay ();
- vel.x = vel.y = 0;
- A_SetGravity (1.0);
- }
- Loople:
- THGR A 1 {
- if (time <= 0)
- return ResolveState ("RanOut");
- if (dynLight) {
- double mult = 1.0;
- if (time < (maxTime * 0.25))
- mult = Clamp (time / (maxTime * 0.025), 0.05, 1.0);
- dynLight.args [DynamicLight.Light_Intensity] = int (floor (85 * mult));
- //dynLight.args [DynamicLight.Light_Secondary_Intensity] = int (floor (75 * mult));
- } else
- return ResolveState ("RanOut");
- time--;
- return ResolveState (null);
- }
- loop;
- RanOut:
- THGR B 1 {
- if (dynLight)
- dynLight.A_Remove (AAPTR_Default, RMVF_EVERYTHING);
- A_StopSound (CHAN_7);
- A_SpawnItemEx ("S7_Thumper_Used", 0.0, 0.0, 0.0, vel.x, vel.y, vel.z, 0, SXF_NoCheckPosition | SXF_TransferTranslation | SXF_TransferPitch | SXF_TransferPointers | SXF_AbsoluteVelocity);
- }
- stop;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement