public LauncherArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("damage_per_fire")) { DamagePerFire = sec.GetSetting("damage_per_fire").Float(0); } if (sec.SettingExists("power_usage")) { PowerUsage = sec.GetSetting("power_usage").Float(0); } if (sec.SettingExists("refire_delay")) { RefireDelay = sec.GetSetting("refire_delay").Float(0); } if (sec.SettingExists("muzzle_velocity")) { MuzzleVelocity = new Vector(0, 0, -sec.GetSetting("muzzle_velocity").Float(0)); } if (sec.SettingExists("projectile_archetype")) { uint projectileArchID = FLUtility.CreateID(sec.GetSetting("projectile_archetype").Str(0)); ProjectileArch = ArchetypeDB.Find(projectileArchID) as ProjectileArchetype; if (ProjectileArch == null) { log.AddLog(LogType.ERROR, "error: projectile not found: " + sec.Desc); } } }
public ThrusterArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("max_force")) { MaxForce = sec.GetSetting("max_force").Float(0); } if (sec.SettingExists("power_usage")) { PowerUsage = sec.GetSetting("power_usage").Float(0); } }
public GunArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("dispersion_angle")) { DispersionAngle = sec.GetSetting("dispersion_angle").Float(0); } if (sec.SettingExists("turn_rate")) { TurnRate = sec.GetSetting("turn_rate").Float(0); } }
public ScannerArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("range")) { ScanRange = sec.GetSetting("range").UInt(0); } if (sec.SettingExists("cargo_scan_range")) { CargoRange = sec.GetSetting("cargo_scan_range").UInt(0); } }
public EquipmentArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("volume")) { Volume = sec.GetSetting("volume").Float(0); } if (sec.SettingExists("units_per_container")) { UnitsPerContainer = sec.GetSetting("units_per_container").Float(0); } if (sec.SettingExists("lootable")) { Lootable = sec.GetSetting("lootable").Str(0) == "true"; } }
public CounterMeasureArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("linear_drag")) { LinearDrag = sec.GetSetting("linear_drag").Float(0); } if (sec.SettingExists("range")) { Range = sec.GetSetting("range").Float(0); } if (sec.SettingExists("diversion_pctg")) { DiversionPctg = sec.GetSetting("diversion_pctg").Float(0); } }
public ShipArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("steering_torque")) { SteeringTorque = sec.GetSetting("steering_torque").Vector(); } if (sec.SettingExists("angular_drag")) { AngularDrag = sec.GetSetting("angular_drag").Vector(); } if (sec.SettingExists("rotation_inertia")) { RotationInertia = sec.GetSetting("rotation_inertia").Vector(); } if (sec.SettingExists("nudge_force")) { NudgeForce = sec.GetSetting("nudge_force").Float(0); } if (sec.SettingExists("linear_drag")) { LinearDrag = sec.GetSetting("linear_drag").Float(0); } if (sec.SettingExists("hold_size")) { HoldSize = sec.GetSetting("hold_size").Float(0); } if (sec.SettingExists("strafe_force")) { StrafeForce = sec.GetSetting("strafe_force").Float(0); } if (sec.SettingExists("nanobot_limit")) { NanobotLimit = sec.GetSetting("nanobot_limit").UInt(0); } if (sec.SettingExists("shield_battery_limit")) { ShieldBatteryLimit = sec.GetSetting("shield_battery_limit").UInt(0); } if (sec.SettingExists("mission_property")) { mission_property = (MissionProperty) Enum.Parse(typeof(MissionProperty), sec.GetSetting("mission_property").Str(0).ToUpperInvariant()); } }
public CounterMeasureDropperArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("ai_range")) { AiRange = sec.GetSetting("ai_range").Float(0); } }
public ArmorArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("hit_pts_scale")) { HitPtsScale = sec.GetSetting("hit_pts_scale").Float(0); } }
public PowerArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("capacity")) { Capacity = sec.GetSetting("capacity").Float(0); } if (sec.SettingExists("charge_rate")) { ChargeRate = sec.GetSetting("charge_rate").Float(0); } if (sec.SettingExists("thrust_capacity")) { ThrustCapacity = sec.GetSetting("thrust_capacity").Float(0); } if (sec.SettingExists("thrust_charge_rate")) { ThrustChargeRate = sec.GetSetting("thrust_charge_rate").Float(0); } }
public MotorArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("ai_range")) { AiRange = sec.GetSetting("ai_range").Float(0); } if (sec.SettingExists("lifetime")) { Lifetime = sec.GetSetting("lifetime").Float(0); } if (sec.SettingExists("accel")) { Accel = sec.GetSetting("accel").Float(0); } if (sec.SettingExists("delay")) { Delay = sec.GetSetting("delay").Float(0); } }
public ProjectileArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("lifetime")) { Lifetime = sec.GetSetting("lifetime").Float(0); } if (sec.SettingExists("owner_safe_time")) { OwnerSafeTime = sec.GetSetting("owner_safe_time").Float(0); } if (sec.SettingExists("requires_ammo")) { RequiresAmmo = sec.GetSetting("requires_ammo").Str(0) == "true"; } if (sec.SettingExists("force_gun_ori")) { ForceGunOri = sec.GetSetting("force_gun_ori").Str(0) == "true"; } }
public ShieldGeneratorArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("regeneration_rate")) { RegenerationRate = sec.GetSetting("regeneration_rate").Float(0); } if (sec.SettingExists("max_capacity")) { MaxCapacity = sec.GetSetting("max_capacity").Float(0); } if (sec.SettingExists("offline_rebuild_time")) { OfflineRebuildTime = sec.GetSetting("offline_rebuild_time").Float(0); } if (sec.SettingExists("offline_threshold")) { OfflineThreshold = sec.GetSetting("offline_threshold").Float(0); } if (sec.SettingExists("constant_power_draw")) { ConstantPowerDraw = sec.GetSetting("constant_power_draw").Float(0); } if (sec.SettingExists("rebuild_power_draw")) { RebuildPowerDraw = sec.GetSetting("rebuild_power_draw").Float(0); } }
public EngineArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("max_force")) { MaxForce = sec.GetSetting("max_force").Float(0); } if (sec.SettingExists("linear_drag")) { LinearDrag = sec.GetSetting("linear_drag").Float(0); } if (sec.SettingExists("power_usage")) { PowerUsage = sec.GetSetting("power_usage").Float(0); } if (sec.SettingExists("reverse_fraction")) { ReverseFraction = sec.GetSetting("reverse_fraction").Float(0); } if (sec.SettingExists("cruise_charge_time")) { CruiseChargeTime = sec.GetSetting("cruise_charge_time").Float(0); } if (sec.SettingExists("cruise_power_usage")) { CruisePowerUsage = sec.GetSetting("cruise_power_usage").Float(0); } }
public MineArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("linear_drag")) { LinearDrag = sec.GetSetting("linear_drag").Float(0); } if (sec.SettingExists("detonation_dist")) { DetonationDist = sec.GetSetting("detonation_dist").Float(0); } if (sec.SettingExists("seeker_dist")) { SeekerDist = sec.GetSetting("seeker_dist").Float(0); } if (sec.SettingExists("acceleration")) { Acceleration = sec.GetSetting("acceleration").Float(0); } if (sec.SettingExists("top_speed")) { TopSpeed = sec.GetSetting("top_speed").Float(0); } }
public Archetype(string datapath, FLDataFile.Section sec) { Nickname = sec.GetFirstOf("nickname")[0]; ArchetypeID = Utilities.CreateID(Nickname); // Load the hardpoints and animation data for the model Hardpoints = new Dictionary <string, HardpointData>(); if (sec.ContainsAnyOf("loot_appearance")) { LootAppearance = sec.GetFirstOf("loot_appearance")[0]; } if (sec.ContainsAnyOf("pod_appearance")) { PodAppearance = sec.GetFirstOf("pod_appearance")[0]; } if (sec.ContainsAnyOf("DA_archetype")) { ModelPath = datapath + Path.DirectorySeparatorChar + sec.GetFirstOf("DA_archetype")[0]; var utf = new UTFFile(); TreeNode root = utf.LoadUTFFile(ModelPath); CmpFixData fix; CmpRevData rev; CmpPrisData pris; CmpSphereData sphere; var file_to_object = new Dictionary <string, string>(); var cons_parent = new Dictionary <string, string>(); var cons_position = new Dictionary <string, Vector>(); var cons_orientation = new Dictionary <string, Matrix>(); if (root.Nodes.ContainsKey("Cmpnd")) { TreeNode cmpnd = root.Nodes["Cmpnd"]; foreach (TreeNode n in cmpnd.Nodes) { if (n.Name == "Cons") { TreeNode cons = n; if (cons.Nodes.ContainsKey("Fix")) { TreeNode fixNode = cons.Nodes["Fix"]; try { fix = new CmpFixData(fixNode.Tag as byte[]); foreach (CmpFixData.Part p in fix.Parts) { cons_parent[p.ChildName] = p.ParentName; cons_position[p.ChildName] = new Vector(p.OriginX, p.OriginY, p.OriginZ); var m = new Matrix { M00 = p.RotMatXX, M01 = p.RotMatXY, M02 = p.RotMatXZ, M10 = p.RotMatYX, M11 = p.RotMatYY, M12 = p.RotMatYZ, M20 = p.RotMatZX, M21 = p.RotMatZY, M22 = p.RotMatZZ }; cons_orientation[p.ChildName] = m; } } catch (Exception) { fix = null; } } if (cons.ContainsKey("Pris")) { TreeNode prisNode = cons["Pris"]; try { pris = new CmpPrisData(prisNode.Tag as byte[]); foreach (CmpPrisData.Part p in pris.Parts) { cons_parent[p.ChildName] = p.ParentName; cons_position[p.ChildName] = new Vector(p.OriginX, p.OriginY, p.OriginZ); var m = new Matrix { M00 = p.RotMatXX, M01 = p.RotMatXY, M02 = p.RotMatXZ, M10 = p.RotMatYX, M11 = p.RotMatYY, M12 = p.RotMatYZ, M20 = p.RotMatZX, M21 = p.RotMatZY, M22 = p.RotMatZZ }; cons_orientation[p.ChildName] = m; } } catch (Exception) { pris = null; } } if (cons.Nodes.ContainsKey("Rev")) { TreeNode revNode = cons.Nodes["Rev"]; try { rev = new CmpRevData(revNode.Tag as byte[]); foreach (CmpRevData.Part p in rev.Parts) { cons_parent[p.ChildName] = p.ParentName; cons_position[p.ChildName] = new Vector(p.OriginX, p.OriginY, p.OriginZ); var m = new Matrix { M00 = p.RotMatXX, M01 = p.RotMatXY, M02 = p.RotMatXZ, M10 = p.RotMatYX, M11 = p.RotMatYY, M12 = p.RotMatYZ, M20 = p.RotMatZX, M21 = p.RotMatZY, M22 = p.RotMatZZ }; cons_orientation[p.ChildName] = m; } } catch (Exception) { rev = null; } } if (cons.Nodes.ContainsKey("Sphere")) { TreeNode sphereNode = cons.Nodes["Sphere"]; try { sphere = new CmpSphereData(sphereNode.Tag as byte[]); foreach (CmpSphereData.Part p in sphere.Parts) { cons_parent[p.ChildName] = p.ParentName; cons_position[p.ChildName] = new Vector(p.OriginX, p.OriginY, p.OriginZ); var m = new Matrix { M00 = p.RotMatXX, M01 = p.RotMatXY, M02 = p.RotMatXZ, M10 = p.RotMatYX, M11 = p.RotMatYY, M12 = p.RotMatYZ, M20 = p.RotMatZX, M21 = p.RotMatZY, M22 = p.RotMatZZ }; cons_orientation[p.ChildName] = m; } } catch (Exception) { sphere = null; } } } else { if (n.Nodes.ContainsKey("Object name") && n.Nodes.ContainsKey("File name")) { file_to_object.Add(Utilities.GetString(n.Nodes["File name"]), Utilities.GetString(n.Nodes["Object name"])); } } } } foreach (TreeNode hp in utf.Hardpoints.Nodes) { TreeNode hpnode = null, parentnode = null; TreeNode[] matches = root.Nodes.Find(hp.Name, true); foreach (TreeNode m in matches) { hpnode = m; parentnode = hpnode.Parent.Parent.Parent; if (file_to_object.ContainsKey(parentnode.Name)) { break; } } if (hpnode == null) { continue; } var hpd = new HardpointData(hpnode); if (parentnode != root) { string consName = file_to_object[parentnode.Name]; var positionOffset = new Vector(); var rotationOffset = new Matrix(); while (consName.ToLowerInvariant() != "root") { positionOffset += cons_position[consName]; rotationOffset *= cons_orientation[consName]; consName = cons_parent[consName]; } hpd.Position += positionOffset; hpd.Rotation *= rotationOffset; } Hardpoints[hpd.Name.ToLowerInvariant()] = hpd; if (hpd.Name.ToLowerInvariant() == "hpmount") { HpMount = hpd; } } } if (ModelPath != null) { string surPath = Path.ChangeExtension(ModelPath, ".sur"); if (File.Exists(surPath)) { try { new SurFile(surPath); } catch { log.AddLog(LogType.ERROR, "sur load failed for " + surPath); } } } if (sec.SettingExists("mass")) { Mass = sec.GetSetting("mass").Float(0); } if (sec.SettingExists("hit_pts")) { HitPts = sec.GetSetting("hit_pts").Float(0); } if (sec.SettingExists("type")) { try { Type = (ObjectType)Enum.Parse(typeof(ObjectType), sec.GetSetting("type").Str(0).ToUpperInvariant()); } catch (Exception) { Type = ObjectType.NONE; } } // Load the docking points for the model foreach (FLDataFile.Setting set in sec.Settings) { if (set.SettingName == "docking_sphere") { string moortype = set.Str(0).ToLowerInvariant(); string hpname = set.Str(1).ToLowerInvariant(); float dockingRadius = set.Float(2); AddDockingPoint(moortype, hpname, dockingRadius, Hardpoints, log); } } if (sec.SettingExists("loadout")) { Loadout = sec.GetSetting("loadout").Str(0); } // If this is a tradelane ring, load the docking points for it if (Type == ObjectType.TRADELANE_RING) { AddDockingPoint("tradelane_ring", "hpleftlane", 0, Hardpoints, log); AddDockingPoint("tradelane_ring", "hprightlane", 0, Hardpoints, log); } // FIXME: Load or build and surface used for collision detection for this model. }
public MunitionArchetype(string datapath, FLDataFile.Section sec, ILogController log) : base(datapath, sec, log) { if (sec.SettingExists("hull_damage")) { HullDamage = sec.GetSetting("hull_damage").Float(0); } if (sec.SettingExists("energy_damage")) { EnergyDamage = sec.GetSetting("energy_damage").Float(0); } if (sec.SettingExists("weapon_type")) { WeaponType = ArchetypeDB.FindWeaponType(sec.GetSetting("weapon_type").Str(0)); if (WeaponType == null) { log.AddLog(LogType.ERROR, "error: weapon_type not found " + sec.Desc); } } if (sec.SettingExists("seeker")) { Seeker = sec.GetSetting("seeker").Str(0); } if (sec.SettingExists("time_to_lock")) { TimeToLock = sec.GetSetting("time_to_lock").Float(0); } if (sec.SettingExists("seeker_range")) { SeekerRange = sec.GetSetting("seeker_range").Float(0); } if (sec.SettingExists("seeker_fov_deg")) { SeekerFovDeg = sec.GetSetting("seeker_fov_deg").Float(0); } if (sec.SettingExists("detonation_dist")) { DetonationDist = sec.GetSetting("detonation_dist").Float(0); } if (sec.SettingExists("cruise_disruptor")) { CruiseDisruptor = sec.GetSetting("cruise_disruptor").Str(0) == "true"; } if (sec.SettingExists("max_angular_velocity")) { MaxAngularVelocity = sec.GetSetting("max_angular_velocity").Float(0); } if (sec.SettingExists("motor")) { uint motorID = FLUtility.CreateID(sec.GetSetting("motor").Str(0)); MotorArch = ArchetypeDB.Find(motorID) as MotorArchetype; if (MotorArch == null) { log.AddLog(LogType.ERROR, "error: motor not found " + sec.Desc); } } }