Guest User

mut Auto Turret Rb

a guest
Oct 9th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. // Modified 'mutAMRiL' from MEvo
  2.  
  3. class mutAutoTurretRb extends Mutator;
  4.  
  5. var bool bReplaceAmmo;
  6.  
  7. var string NewAmmoStrClass;
  8. var string OldAmmoStrClass;
  9.  
  10. var class<Weapon> NewWeaponClass;
  11. var class<Weapon> OldWeaponClass;
  12.  
  13. function string GetInventoryClassOverride(string InventoryClassName)
  14. {
  15. if ( InventoryClassName == String(OldWeaponClass) )
  16. InventoryClassName = String(NewWeaponClass);
  17.  
  18. if ( NextMutator != None )
  19. return NextMutator.GetInventoryClassOverride(InventoryClassName);
  20. return InventoryClassName;
  21. }
  22.  
  23. function bool AlwaysKeep(Actor Other)
  24. {
  25.  
  26. if (Other.class == NewWeaponClass)
  27. return true;
  28.  
  29. if ( NextMutator != None )
  30. return ( NextMutator.AlwaysKeep(Other) );
  31.  
  32. return false;
  33. }
  34.  
  35. function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
  36. {
  37. local int i;
  38.  
  39. bSuperRelevant = 0;
  40.  
  41. if ( xWeaponBase(Other) != None)
  42. {
  43. if (xWeaponBase(Other).WeaponType == OldWeaponClass)
  44. xWeaponBase(Other).WeaponType = NewWeaponClass;
  45. }
  46. else if ( WeaponLocker(other) != None)
  47. {
  48. for ( i=0; i < WeaponLocker(other).Weapons.Length; i++ )
  49. if (WeaponLocker(other).Weapons[i].WeaponClass == OldWeaponClass)
  50. {
  51.  
  52. WeaponLocker(other).Weapons[i].WeaponClass = NewWeaponClass;
  53. }
  54. }
  55. else if ( WeaponPickup(Other) != None)
  56. {
  57. if (WeaponPickup(Other).class == OldWeaponClass.default.PickupClass)
  58. {
  59. ReplaceWith( Other, String(NewWeaponClass.default.PickupClass));
  60. return false;
  61. }
  62. }
  63. else if ( Ammo(Other) != None && bReplaceAmmo == true )
  64. {
  65. if(string(Other.Class) == OldAmmoStrClass)
  66. {
  67. ReplaceWith(Other, NewAmmoStrClass);
  68. return false;
  69. }
  70. }
  71. return true;
  72. }
  73.  
  74. //same as Super.ReplaceWith but also sets the pickup's respawn time and ammo amount
  75. function bool ReplaceWith(actor Other, string aClassName)
  76. {
  77. local Actor A;
  78. local class<Actor> aClass;
  79.  
  80. if ( aClassName == "" )
  81. return true;
  82.  
  83. aClass = class<Actor>(DynamicLoadObject(aClassName, class'Class'));
  84. if ( aClass != None )
  85. A = Spawn(aClass,Other.Owner,Other.tag,Other.Location, Other.Rotation);
  86. if ( Other.IsA('Pickup') )
  87. {
  88. if ( Pickup(Other).MyMarker != None )
  89. {
  90. Pickup(Other).MyMarker.markedItem = Pickup(A);
  91. if ( Pickup(A) != None )
  92. {
  93. Pickup(A).MyMarker = Pickup(Other).MyMarker;
  94. A.SetLocation(A.Location
  95. + (A.CollisionHeight - Other.CollisionHeight) * vect(0,0,1));
  96. Pickup(A).RespawnTime = Pickup(Other).RespawnTime; //this is the added line
  97. }
  98. Pickup(Other).MyMarker = None;
  99. }
  100. else if ( A.IsA('Pickup') )
  101. Pickup(A).Respawntime = 0.0;
  102. }
  103. if ( A != None )
  104. {
  105. A.event = Other.event;
  106. A.tag = Other.tag;
  107. return true;
  108. }
  109. return false;
  110. }
  111.  
  112. defaultproperties
  113. {
  114. bReplaceAmmo=false
  115. NewAmmoStrClass="AMRiLME.AMRiLAmmoPickup"
  116. OldAmmoStrClass="Onslaught.ONSAVRiLAmmoPickup"
  117. NewWeaponClass=Class'SillyRPG.AutoTurretDeployRb'
  118. OldWeaponClass=Class'DWU2Weapons.AutoTurretDeploy'
  119. FriendlyName="Auto Turret Rollback Mutator"
  120. Description="Replaces the new Auto Turret with the old Auto Turret"
  121. }
Advertisement
Add Comment
Please, Sign In to add comment