Advertisement
Guest User

Pickup Silly Armor Shard

a guest
Oct 9th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. // Silly_Warlock: Made with advice from Iron Curtain code.
  2. class PickupSillyArmorShard extends PickupArmorShard;
  3.  
  4. var float ArmorMultiplier;
  5.  
  6.  
  7. //S_W: Don't know what this one is about
  8. simulated static function UpdateHUD(HUD H)
  9. {
  10. H.LastPickupTime = H.Level.TimeSeconds;
  11. H.LastHealthPickupTime = H.LastPickupTime;
  12. }
  13.  
  14. function bool UpgradeVehicle (Vehicle ToModify)
  15. {
  16. local InvVehicleNfo Nfo;
  17. local Inventory Inv;
  18. local int HpChange;
  19. local Controller C;
  20.  
  21.  
  22. //log(ToModify$" ArmorShard Hi ");
  23.  
  24. if (ToModify == None)
  25. return false;
  26.  
  27. Inv = ToModify.FindInventoryType(class'InvVehicleNfo');
  28. if (Inv == None)
  29. {
  30. //log(ToModify$" Making Nfo ");
  31. Nfo = ToModify.Spawn(class'InvVehicleNfo', ToModify,,,rot(0,0,0));
  32. //if (Nfo == None)
  33. //log(ToModify$" No Nfo -1 ");
  34. Nfo.GiveTo(ToModify);
  35. //if (Nfo == None)
  36. //log(ToModify$" No Nfo 0 ");
  37. }
  38. else
  39. {
  40. //log(ToModify$" Nfo already done "$Inv);
  41. Nfo = InvVehicleNfo(Inv);
  42. }
  43. if (Nfo == None)
  44. {
  45. log(ToModify$" Nfo lacking ");
  46. }
  47.  
  48.  
  49. HpChange = float(ArmorStrength) * ArmorMultiplier;
  50. ToModify.HealthMax += HpChange;
  51. ToModify.Health += HpChange;
  52.  
  53. if (Nfo != None)
  54. {
  55. Nfo.CurrHpMax = ToModify.HealthMax;
  56. Nfo.ArmorBonus += HpChange;
  57. Nfo.PermaBonusHp += HpChange;
  58. }
  59.  
  60.  
  61. //If someone else is picking this up, then give threat to the crafter
  62. if (Crafter != None && Crafter.Pawn != None && ToModify.Controller != Crafter && Crafter.Pawn.Health > 0)
  63. {
  64. for (C = Level.ControllerList; C != None; C = C.NextController)
  65. {
  66. if (DWScriptedMonster(C.Pawn) == None || C.Pawn.Health <= 0)
  67. continue;
  68.  
  69. C.Pawn.ModifyThreat(Threat, Crafter.Pawn);
  70. }
  71. }
  72.  
  73.  
  74. //log(ToModify$" "$ToModify.HealthMax);
  75. return true;
  76. }
  77.  
  78.  
  79. auto state Pickup
  80. {
  81. function bool ReadyToPickup(float MaxWait)
  82. {
  83. return true;
  84. }
  85.  
  86. //ValidTouch()
  87. //Validate touch (if valid return true to let other pick me up and trigger event).
  88.  
  89. function bool ValidTouch( actor Other )
  90. {
  91. // make sure its a live player
  92. if ( (Pawn(Other) == None) || (!Pawn(Other).bCanPickupInventory && (Vehicle(Other) == None || Vehicle(Other).Driver == None ) ) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) )
  93. return false;
  94.  
  95. // make sure not touching through wall
  96. if ( !FastTrace(Other.Location, Location) )
  97. return false;
  98.  
  99. // make sure game will let player pick me up
  100. if( Level.Game.PickupQuery(Pawn(Other), self) )
  101. {
  102. TriggerEvent(Event, self, Pawn(Other));
  103. if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle == None )
  104. return CanPickupArmor(Pawn(Other));
  105.  
  106. return true;
  107. }
  108. return false;
  109. }
  110.  
  111. // When touched by an actor.
  112. function Touch( actor Other )
  113. {
  114. local Actor DrivenVehicle;
  115.  
  116. if( ValidTouch(Other) )
  117. {
  118. DrivenVehicle = Other;
  119. //MutVehiclePickups workaround
  120. if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle != None )
  121. DrivenVehicle = Pawn(Other).DrivenVehicle;
  122. if( Vehicle(DrivenVehicle) != None )
  123. {
  124. if ( UpgradeVehicle (Vehicle(DrivenVehicle)) )
  125. {
  126. AnnouncePickup(Pawn(DrivenVehicle));
  127. SetRespawn();
  128. }
  129. }
  130.  
  131. else if (GiveArmorTo(Pawn(Other)))
  132. {
  133. AnnouncePickup(Pawn(Other));
  134. SetRespawn();
  135. }
  136. }
  137. }
  138.  
  139. // Make sure no pawn already touching (while touch was disabled in sleep).
  140. function CheckTouching()
  141. {
  142. local Pawn P;
  143.  
  144. ForEach TouchingActors(class'Pawn', P)
  145. Touch(P);
  146. }
  147.  
  148. function Timer()
  149. {
  150. if ( bDropped )
  151. GotoState('FadeOut');
  152. }
  153.  
  154. function BeginState()
  155. {
  156. UntriggerEvent(Event, self, None);
  157. if ( bDropped )
  158. {
  159. AddToNavigation();
  160. //SetTimer(LifeTime, false);
  161. }
  162. }
  163.  
  164. function EndState()
  165. {
  166. if ( bDropped )
  167. RemoveFromNavigation();
  168. }
  169.  
  170. Begin:
  171. CheckTouching();
  172. }
  173.  
  174.  
  175. state FallingPickup
  176. {
  177. function CheckTouching()
  178. {
  179. }
  180.  
  181. function bool ValidTouch( actor Other )
  182. {
  183. // make sure its a live player
  184. if ( (Pawn(Other) == None) || (!Pawn(Other).bCanPickupInventory && (Vehicle(Other) == None || Vehicle(Other).Driver == None ) ) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) )
  185. return false;
  186.  
  187. // make sure not touching through wall
  188. if ( !FastTrace(Other.Location, Location) )
  189. return false;
  190.  
  191. // make sure game will let player pick me up
  192. if( Level.Game.PickupQuery(Pawn(Other), self) )
  193. {
  194. TriggerEvent(Event, self, Pawn(Other));
  195. if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle == None )
  196. return CanPickupArmor(Pawn(Other));
  197.  
  198. return true;
  199. }
  200. return false;
  201. }
  202.  
  203. // When touched by an actor.
  204. function Touch( actor Other )
  205. {
  206. local Actor DrivenVehicle;
  207.  
  208. if( ValidTouch(Other) )
  209. {
  210. DrivenVehicle = Other;
  211. //MutVehiclePickups workaround
  212. if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle != None )
  213. DrivenVehicle = Pawn(Other).DrivenVehicle;
  214. if( Vehicle(DrivenVehicle) != None )
  215. {
  216. if ( UpgradeVehicle (Vehicle(DrivenVehicle)) )
  217. {
  218. AnnouncePickup(Pawn(DrivenVehicle));
  219. SetRespawn();
  220. }
  221. }
  222.  
  223. else if (GiveArmorTo(Pawn(Other)))
  224. {
  225. AnnouncePickup(Pawn(Other));
  226. SetRespawn();
  227. }
  228. }
  229. }
  230.  
  231. function Timer()
  232. {
  233. GotoState('FadeOut');
  234. }
  235.  
  236. function BeginState()
  237. {
  238. //SetTimer(LifeTime, false);
  239. }
  240.  
  241. function EndState()
  242. {
  243. SetPhysics(PHYS_Rotating);
  244. }
  245. }
  246.  
  247.  
  248. defaultproperties
  249. {
  250. ArmorMultiplier=1.0
  251. ArmorStrength=1
  252. MaxDesireability=1.250000
  253. PickupMessage="You found an armor shard."
  254. PickupSound=Sound'CicadaSnds.Missile.MissileEject'
  255. DrawType=DT_StaticMesh
  256. StaticMesh=StaticMesh'ME_RPGExpansionMeshes.Pickups.ArmorShard'
  257. Physics=PHYS_Rotating
  258. LifeSpan=300.000000
  259. RotationRate=(Yaw=24000)
  260. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement