optimised weapon code a little
[k8zan.git] / decorate / Weapons / FragfireGun.txt
blobde2a65a08421eaba1a31fe850352a8bef6a7ec61
1 ACTOR FragfireCan : Ammo {
2   Radius 12
3   Height 14
4   Scale 0.60
5   Inventory.Amount 80
6   Inventory.MaxAmount 240
7   Ammo.BackpackAmount 160
8   Ammo.BackpackMaxAmount 400
9   Inventory.Icon "AFRAA0"
10   Inventory.PickupMessage "Picked up a Fragfire Can."
11   Inventory.PickupSound "Ammo/FragfireCanPick"
15 ACTOR FragfireCanBox : FragfireCan replaces ShellBox {
16   Inventory.Amount 80
17   Inventory.PickupMessage "Picked up a Fragfire Can."
18   Inventory.PickupSound "Ammo/FragfireCanPick"
20   States {
21   Spawn:
22     AFRA A -1
23     Stop
24   }
28 Actor FragfireCanHalf : FragfireCan replaces Shell {
29   Inventory.Amount 40
30   Inventory.PickupMessage "Picked up a half full Fragfire Can."
32   States {
33   Spawn:
34     AFRA D -1
35     Stop
36   }
40 ACTOR FragfireCanDropped {
41   Radius 1
42   Height 1
43   Scale 0.60
44   Gravity 0.85
45   +MOVEWITHSECTOR
46   +MISSILE
47   +NOBLOCKMAP
48   +BOUNCEONFLOORS
49   +BOUNCEONWALLS
50   +BOUNCEONCEILINGS
51   +ALLOWBOUNCEONACTORS
52   +BOUNCEONACTORS
53   +NoTeleport
54   +k8AllowSimpleTick
55   BounceType Doom
56   BounceFactor 0.7
57   BounceCount 3
58   BounceSound "Ammo/FragfireCanBounce"
60   States {
61   Spawn:
62     AFRA B 16
63     AFRA C 1000
64     Stop
66   Death:
67     AFRA C -1
68     Stop
69   }
73 ACTOR FragfireGunLoaded : Ammo {
74   Inventory.Amount 0
75   Inventory.MaxAmount 80
76   Ammo.BackpackAmount 0
77   Ammo.BackpackMaxAmount 80
78   +INVENTORY.IGNORESKILL
82 ACTOR FragfireGun : Weapon replaces Shotgun {
83   Xscale 0.45
84   Yscale 0.40
85   Radius 25
86   Height 18
87   +INVENTORY.UNDROPPABLE
88   +WEAPON.NOALERT
89   //+WEAPON.NO_AUTO_SWITCH
90   +WEAPON.AMMO_OPTIONAL
91   //+WEAPON.ALT_USES_BOTH
92   Inventory.PickupMessage "Got a Fragfire Gun."
93   Inventory.PickupSound "Ammo/FragfireGunPick"
94   //Inventory.Icon "WFRAA0"
95   Tag "Fragfire Gun"
96   Weapon.SelectionOrder 1
97   //Weapon.MinSelectionAmmo1 0
98   //Weapon.MinSelectionAmmo2 1
99   Weapon.AmmoType1 "FragfireGunLoaded"
100   Weapon.AmmoGive1 0
101   Weapon.AmmoUse1 1
102   Weapon.AmmoType2 "FragfireCan"
103   Weapon.AmmoGive2 40
104   Weapon.AmmoUse2 0
105   Weapon.SlotNumber 3
107   var int user_lowPauseCount;
108   // temps
109   var int user_LoadCount;
110   var int user_ClipCount;
112   States {
113   Spawn:
114     WFRA B -1
115     Stop
117   PickupWeapon:
118     // always has some loaded ammo on first pickup
119     TNT1 A 0 A_GiveInventory("FragfireGunLoaded", random(1, 6)*10)
120     Stop
122   Select:
123     stateinclude "decorate/Weapons/QuickKick/QuickKickOnSelectDeselect.txt"
124     TNT1 A 0
125       {
126         A_GiveInventory("HoldingFragfireGun", 1);
127         if (GetCVarB('k8ZanMod_CustomCrosshairs')) A_SetCrosshair(4);
128       }
129     TNT1 A 0 A_Raise(666)
130     Goto Ready
132   Deselect:
133     stateinclude "decorate/Weapons/QuickKick/QuickKickOnSelectDeselect.txt"
134     WFRR A 1 Offset(-15, 40)
135     WFRR A 1 Offset(-30, 50)
136     WFRR A 1 Offset(-50, 65)
137     WFRR A 1 Offset(-70, 80)
138     Goto DeselectLoop
140   DeselectLoop:
141     TNT1 A 0 A_TakeInventory("HoldingFragfireGun", 1)
142     TNT1 A 1 A_Lower(666)  // was zero duration
143     Loop
145   Ready:
146     TNT1 A 8
147     TNT1 A 0 A_PlaySound("Ammo/FragfireGunPick", CHAN_WEAPON, 0.6)
148     WFRR A 1 Offset(-70, 80)
149     WFRR A 1 Offset(-50, 65)
150     WFRR A 1 Offset(-30, 50)
151     WFRR A 1 Offset(-15, 40)
152     TNT1 A 0 A_TakeInventory("QuickKickDisabled")
153     Goto ReadyIdle
155   ReadyIdle:
156     TNT1 A 0
157       {
158         // low ammo sound
159         if (CountInv("FragfireGunLoaded") <= 3*8) {
160           user_lowPauseCount -= 1;
161           if (user_lowPauseCount < 1) {
162             if (GetCVarB("k8ZanMod_WarnLowAmmo")) {
163               A_PlaySound("weapons/zanweapon/lowammo", CHAN_VOICE, 1.0);
164             }
165                  if (CountInv("FragfireGunLoaded") > 2*8) user_lowPauseCount = 40/8;
166             else if (CountInv("FragfireGunLoaded") > 1*8) user_lowPauseCount = 30/8;
167             else if (CountInv("FragfireGunLoaded") > 0*8) user_lowPauseCount = 20/8;
168             else user_lowPauseCount = 10; // one frame
169           }
170         }
171       }
172     TNT1 A 0 Offset(-15, 40) A_JumpIf(CountInv("FragfireGunLoaded")==0, "ReadyEmptyGun")
173     WFRR AA 4 A_WeaponReady(WRF_ALLOWRELOAD)
174     Loop
176   ReadyEmptyGun:
177     WFRR B 1 Offset(-15, 40) A_WeaponReady(WRF_ALLOWRELOAD)
178     //Loop
179     Goto ReadyIdle  // for sound
181   Fire:
182     TNT1 A 0 A_JumpIfNoAmmo("Reload")
183     TNT1 A 0 A_JumpIf(waterlevel==3, "UnderwaterDryFire")
184     SPGH A 0
185       {
186         A_GunFlash("Flash");
187         A_PlaySound("Weapons/FragfireGunFire", CHAN_WEAPON);
188         A_SetPitch(-1.0+pitch);
189         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(-1, 3));
190       }
191     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
192     TNT1 A 0
193       {
194         A_SetPitch(-1.0+pitch);
195         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(0, 4));
196       }
197     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
198     TNT1 A 0
199       {
200         A_SetPitch(-1.0+pitch);
201         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(1, 5));
202       }
203     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
204     TNT1 A 0
205       {
206         A_SetPitch(-1.0+pitch);
207         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(2, 6));
208       }
209     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
210     TNT1 A 0
211       {
212         A_SetPitch(-1.0+pitch);
213         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(3, 7));
214       }
215     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
216     TNT1 A 0
217       {
218         A_SetPitch(-1.0+pitch);
219         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(4, 8));
220       }
221     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
222     TNT1 A 0
223       {
224         A_SetPitch(-1.0+pitch);
225         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(5, 9));
226       }
227     TNT1 A 0 A_JumpIfNoAmmo("OutOfPellets")
228     TNT1 A 0
229       {
230         A_SetPitch(-1.0+pitch);
231         A_FireProjectile("FragShot", frandom(-2.5, 2.5), 1, /*3*/0, 0, FPF_NOAUTOAIM, frandom(6, 10));
232       }
233     WFRR A 8 //Offset(0, 33)
234     WFRR A 2 A_SetPitch(1.50+pitch)
235     WFRF A 1 //A_PlaySound("Weapons/FragfireGunPump", CHAN_WEAPON)
236     WFRF A 1 A_SetPitch(1.50+pitch)
237     WFRF B 2 A_SetPitch(1.50+pitch)
238     WFRF C 2 A_SetPitch(1.50+pitch)
239     WFRF D 2 A_PlaySound("Weapons/FragfireGunPump", CHAN_WEAPON)
240     WFRF C 2 A_SetPitch(1.00+pitch)
241     WFRF B 2 A_SetPitch(1.00+pitch)
242     WFRF A 2 A_AlertMonsters
243     Goto ReadyIdle
245   OutofPellets:
246     WFRR B 1 A_SetPitch(1.00+pitch)
247     WFRR B 1 A_SetPitch(1.00+pitch)
248     WFRR B 1 A_SetPitch(1.00+pitch)
249     Goto ReadyIdle
251   Altfire:
252     //TNT1 A 0 A_JumpIfNoAmmo("Reload")
253     TNT1 A 0 A_JumpIf(CountInv("FragfireGunLoaded")==0, "Reload")
254     TNT1 A 0 A_JumpIf(waterlevel==3, "UnderwaterDryFire")
255     TNT1 A 0
256       {
257         A_TakeInventory("FragfireGunLoaded", 1);
258         A_GunFlash("Flash");
259         A_SetPitch(-0.3+pitch);
260         A_FireCustomMissile("FlameShot", frandom(-3, 3), 0, 4, -3, FPF_NOAUTOAIM, frandom(-3, 3));
261       }
262     WFRR A 2 //Offset(0, 33)
263     TNT1 A 0
264       {
265         A_SetPitch(0.15+pitch);
266         A_AlertMonsters;
267       }
268     WFRR A 1 A_SetPitch(0.15+pitch)
269     TNT1 A 0 A_ReFire
270     Goto ReadyIdle
272   UnderwaterDryFire:
273     TNT1 A 0 A_PlaySound("Ammo/SpikeGunPick", CHAN_WEAPON, 0.4)
274     WFRR A 24
275     Goto ReadyIdle
277   DryFire:
278     TNT1 A 0 A_PlaySound("Ammo/SpikeGunPick", CHAN_WEAPON, 0.2)
279     WFRR B 16
280     Goto ReadyIdle
282   Flash:
283     WFRH B 1 A_Light2
284     WFRH A 1 A_Light2
285     WFRH B 1 A_Light1
286     TNT1 A 0 A_Light0
287     Goto LightDone
289   Reload:
290     WFRR A 0 A_JumpIfInventory("FragfireGunLoaded", 80, "ReloadFinish")
291     WFRR A 0 A_JumpIfInventory("FragfireCan", 1, "ReloadWork")
292     TNT1 A 0 A_JumpIfNoAmmo("DryFire")
293     //WFRR B 1 A_JumpIf(CountInv("FragfireCan")==0, "ReadyIdle")
294     Goto ReadyIdle
296   ReloadWork:
297     WFRF B 2 A_PlaySound("Weapons/FragReloadA", CHAN_WEAPON);
298     WFRF C 2
299     WFRF D 2
300     WFRL A 3
301     WFRL B 3
302     WFRL C 3 A_SpawnItem("FragfireCanDropped", -1, 16, 0)
303     WFRL C 7
304     WFRL D 3 A_PlaySound("Weapons/FragReloadB", CHAN_WEAPON)
305     WFRL E 2
306     WFRL F 2
307     WFRL G 3
308     WFRF A 4
309     WFRF B 2 A_PlaySound("Weapons/FragfireGunPump", CHAN_WEAPON)
310     WFRF C 2
311     WFRF D 2
312     WFRF C 2
313     WFRF B 2
314     //Goto ReloadLoop
316   ReloadLoop:
317     TNT1 A 0
318       {
319         // if reload in not cheating, drop unused ammo
320         if (!GetCVar("k8ZanMod_CheatReload")) {
321           A_TakeInventory("FragfireGunLoaded", 666);
322         }
323         user_ClipCount = CountInv("FragfireCan");
324         user_LoadCount = 80-CountInv("FragfireGunLoaded");
325         if (user_LoadCount > 0) {
326           if (user_LoadCount > user_ClipCount) user_LoadCount = user_ClipCount;
327           A_TakeInventory("FragfireCan", user_LoadCount);
328           A_GiveInventory("FragfireGunLoaded", user_LoadCount);
329         }
330         user_lowPauseCount = 0;
331       }
333   ReloadFinish:
334     TNT1 A 0
335     Goto ReadyIdle
337     stateinclude "decorate/Weapons/QuickKick/QuickKickInclude.txt"
338   }
342 ACTOR FragShot : FastProjectile {
343   Scale 0.7
344   Radius 5
345   //Height 10
346   //k8: i set it to 8
347   Height 8
348   Speed 120
349   Projectile
350   ProjectileKickBack 280
351   Damage(12*random(1, 1))
352   DamageType "FragfireGun"
353   +k8MissileHeadshots
354   +THRUGHOST
355   +NOBLOCKMAP
356   +BLOODSPLATTER
357   //+EXTREMEDEATH
358   DeathSound "Weapons/SpikeShotDeath"
359   //SeeSound "Weapons/FragfireGunFire"
360   Obituary "%o was turned into a charred pile of gore by %k's frag shot."
361   Decal "FragDecalHot"
363   States {
364   Spawn:
365     PFRA A 1 bright A_SpawnItemEx("ProjectileFragShotTrail", Random(-24, -8), 0, 0, random(1, 4), 0, 0, 0, SXF_TRANSFERPITCH, 0)
366     Loop
368   Death:
369     TNT1 A 0 A_SpawnItemEx("SparkDie", 0, 0, 0, Random(-4, 4), Random(-4, 4), Random(-3, 5), 0, 0, 100)
370     TNT1 A 0 A_SpawnItemEx("SparkDie", 0, 0, 0, Random(-5, 5), Random(-5, 5), Random(-2, 6), 0, 0, 200)
371     Stop
372   }
376 ACTOR FlameShot /*: FastProjectile*/ {
377   Radius 12
378   Height 8
379   Speed 25
380   Mass 5
381   Scale 0.7
382   Damage (1*random(2, 6))
383   DamageType "Fire"
384   Projectile
385   ProjectileKickBack 0
386   //+RIPPER
387   +DONTREFLECT
388   +DONTTHRUST
389   +NOEXTREMEDEATH
390   +RANDOMIZE
391   //+PAINLESS
392   -BLOODSPLATTER
393   +BLOODLESSIMPACT
394   +NOBLOOD
395   +BLOODLESSIMPACT
396   +DONTSPLASH
397   +NOBLOCKMAP
398   -ACTIVATEIMPACT
399   SeeSound "Weapons/FlameShot"
400   DeathSound "Weapons/FlameDeath"
401   Obituary "%o got roasted by %k."
402   Decal "BurnDecalHot"
404   States {
405   Spawn:
406     PFRA B 3 bright
407     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
408     PFRA C 3 bright
409     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
410     PFRA D 3 bright
411     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
412     PFRA E 3 bright
413     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
414     PFRA F 3 bright
415     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
416     PFRA G 3 bright
417     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
418     PFRA H 3 bright
419     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
420     PFRA I 2 bright
421     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
422     PFRA J 2 bright
423     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
424     PFRA K 2 bright
425     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
426     PFRA L 2 bright
427     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
428     PFRA M 2 bright
429     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
430     PFRA N 2 bright
431     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
432     PFRA O 2 bright
433     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
434     PFRA P 2 bright
435     TNT1 A 0 A_JumpIf(waterlevel>=1, "WaterDeath")
436     PFRA Q 2 bright
437     Stop
439   Death:
440     TNT1 A 0 A_SpawnItemEx("FireTinyDie1", 0, 0, 1, 0, 0, 0, 0, 0, 190)
441     TNT1 A 0 A_SpawnItemEx("FireTinyDie2", 0, 0, 1, 0, 0, 0, 0, 0, 180)
442     TNT1 A 0 A_SpawnItemEx("FireTinyDie3", 0, 0, 1, 0, 0, 0, 0, 0, 170)
443     TNT1 A 0 A_SpawnItemEx("SteamPuffMedium", 0, 0, -25)
444     TNT1 A 0 A_PlaySound("Weapons/FlameDeath", CHAN_WEAPON)
445     PFRA M 2 bright A_Explode(random(8, 12), 160, false, 80, 0, 0)
446     PFRA NOPQ 2 bright
447     Stop
449   WaterDeath:
450     PFRA Q 2 bright A_PlaySound("Weapons/SteamHiss", CHAN_WEAPON)
451     TNT1 A 0 A_SpawnItemEx("SteamPuffSmall")
452     TNT1 A 0 A_SpawnItemEx("SteamPuffMedium")
453     //TNT1 A 0 A_PlaySound("Weapons/SteamHiss", CHAN_WEAPON)
454     Stop
455   }
459 ACTOR ProjectileFragShotTrail {
460   Radius 5
461   Height 5
462   Scale 0.1
463   +DONTSPLASH
464   +NOGRAVITY
465   +NoTeleport
466   +k8AllowSimpleTick
468   States {
469   Spawn:
470     TNT1 A 0 A_JumpIf(waterlevel>1, "WaterDeath")
471     PFRA B 3 bright
472     Stop
474   WaterDeath:
475     TNT1 A -1
476     Stop
477   }
482 actor (optional) ZanSSGReplacer : RandomSpawner replaces SuperShotgun {
483   DropItem "FragfireGun"
488 // heretic
489 Actor (optional) Zan_CrossbowFragfireCan : FragfireCanBox Replaces CrossbowAmmo {}
490 Actor (optional) Zan_CrossbowFragfireCanBox : FragfireCanBox Replaces CrossbowHefty {}
492 Actor (optional) Zan_CrossbowFragfireGun : FragfireGun Replaces Crossbow {}
493 Actor (optional) Zan_CrossbowPoweredFragfireGun : FragfireGun Replaces CrossbowPowered {}
496 // hexen
497 Actor (optional) Zan_Mana2FragfireCan : FragfireCanBox Replaces Mana2 {}
499 Actor (optional) Zan_TPH_AmmoShotgun : FragfireCanBox Replaces AmmoShotgun {}
500 //Actor (optional) Zan_TPH_TPHShotgun : FragfireGun Replaces TPHShotgun {} //SSG
501 Actor (optional) Zan_TPH_TPHRifle : FragfireGun Replaces TPHRifle {}