MissileModManager() { VanillaMissileMaxType = Enum.GetValues(typeof(ETrackerMissileType)).Length; Logger.Info($"MaxTypeint = {VanillaMissileMaxType - 1}"); foreach (PulsarMod mod in ModManager.Instance.GetAllMods()) { Assembly asm = mod.GetType().Assembly; Type MissileMod = typeof(MissileMod); foreach (Type t in asm.GetTypes()) { if (MissileMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract) { Logger.Info("Loading Missile from assembly"); MissileMod MissileModHandler = (MissileMod)Activator.CreateInstance(t); if (GetMissileIDFromName(MissileModHandler.Name) == -1) { MissileTypes.Add(MissileModHandler); Logger.Info($"Added Missile: '{MissileModHandler.Name}' with ID '{GetMissileIDFromName(MissileModHandler.Name)}'"); } else { Logger.Info($"Could not add Missile from {mod.Name} with the duplicate name of '{MissileModHandler.Name}'"); } } } } }
public static PLTrackerMissile CreateMissile(int Subtype, int level, int inSubTypeData = 0) { PLTrackerMissile InMissile; if (Subtype >= Instance.VanillaMissileMaxType) { InMissile = new PLTrackerMissile(ETrackerMissileType.MAX, level, inSubTypeData); int subtypeformodded = Subtype - Instance.VanillaMissileMaxType; if (subtypeformodded <= Instance.MissileTypes.Count && subtypeformodded > -1) { MissileMod MissileType = Instance.MissileTypes[Subtype - Instance.VanillaMissileMaxType]; InMissile.SubType = Subtype; InMissile.Name = MissileType.Name; InMissile.Desc = MissileType.Description; InMissile.m_IconTexture = MissileType.IconTexture; InMissile.Damage = MissileType.Damage; InMissile.Speed = MissileType.Speed; InMissile.DamageType = MissileType.DamageType; InMissile.MissileRefillPrice = MissileType.MissileRefillPrice; InMissile.AmmoCapacity = MissileType.AmmoCapacity; InMissile.PrefabID = MissileType.PrefabID; InMissile.m_MarketPrice = MissileType.MarketPrice; InMissile.CargoVisualPrefabID = MissileType.CargoVisualID; InMissile.CanBeDroppedOnShipDeath = MissileType.CanBeDroppedOnShipDeath; InMissile.Experimental = MissileType.Experimental; InMissile.Unstable = MissileType.Unstable; InMissile.Contraband = MissileType.Contraband; InMissile.Price_LevelMultiplierExponent = MissileType.Price_LevelMultiplierExponent; if (PhotonNetwork.isMasterClient) { InMissile.SubTypeData = (short)InMissile.AmmoCapacity; } } } else { InMissile = new PLTrackerMissile((ETrackerMissileType)Subtype, level, inSubTypeData); } return(InMissile); }