Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace XRL.World.Parts
  5. {
  6.     [Serializable]
  7.     public class AmmoSlug : IPart
  8.     {
  9.         public string ProjectileObject;
  10.  
  11.         public AmmoSlug()
  12.         {
  13. //            Name = "AmmoSlug";
  14.         }
  15.  
  16.         public override bool SameAs(IPart p)
  17.         {
  18.             return true;
  19.         }
  20.  
  21.         public override bool AllowStaticRegistration()
  22.         {
  23.             return true;
  24.         }
  25.  
  26.         public override void Register(GameObject Object)
  27.         {
  28.             Object.RegisterPartEvent(this, "QueryEquippableList");
  29.             Object.RegisterPartEvent(this, "GetProjectileObject");
  30.         }
  31.  
  32.         public override bool FireEvent(Event E)
  33.         {
  34.             if (E.ID == "GetProjectileObject")
  35.             {
  36.                 E.AddParameter("Projectile", GameObjectFactory.Factory.CreateObject(ProjectileObject));
  37.                 return true;
  38.             }
  39.  
  40.             if (E.ID == "QueryEquippableList")
  41.             {
  42.                 if ((E.GetParameter("EquippableList") as List<GameObject>).CleanContains(ParentObject)) return true;
  43.                 if ((E.GetParameter("SlotType") as string).Contains("AmmoSlug"))
  44.                 {
  45.                     (E.GetParameter("EquippableList") as List<GameObject>).Add(ParentObject);
  46.                     return true;
  47.                 }
  48.                 else
  49.                 {
  50.                     return true;
  51.                 }
  52.             }
  53.  
  54.             return true;
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement