Skip to content

Commit

Permalink
Ini: Parse more things. Editor: Parts update correctly, fixes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumDev committed Jan 9, 2019
1 parent 8bc3e80 commit 3652cde
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 22 deletions.
6 changes: 6 additions & 0 deletions src/Editor/LancerEdit/Model/ModelViewer.PartEditor.cs
Expand Up @@ -86,7 +86,13 @@ void WriteConstructs()
}
void ReplaceConstruct(ConstructNode c, AbstractConstruct newc)
{

var cmp = (CmpFile)drawable;
foreach(var part in cmp.Parts)
{
if (part.Construct == c.Con)
part.UpdateConstruct(newc);
}
for (int i = 0; i < cmp.Constructs.Count; i++)
{
if (cmp.Constructs[i] == c.Con)
Expand Down
1 change: 1 addition & 0 deletions src/Editor/LancerEdit/Model/ModelViewer.cs
Expand Up @@ -452,6 +452,7 @@ void ConstructContext(ConstructNode con)
Origin = con.Con.Origin,
Rotation = con.Con.Rotation
};
fix.Reset();
ReplaceConstruct(con, fix);
}
if(!(con.Con is RevConstruct) && Theme.IconMenuItem("Rev","rev",Color4.LightCoral,true)) {
Expand Down
2 changes: 2 additions & 0 deletions src/LibreLancer.Data/Effects/Effect.cs
Expand Up @@ -15,6 +15,8 @@ public class Effect
public string VisEffect;
[Entry("vis_beam")]
public string VisBeam;
[Entry("vis_generic")]
public string VisGeneric;
[Entry("snd_effect")]
public string SndEffect;
[Entry("type")]
Expand Down
10 changes: 10 additions & 0 deletions src/LibreLancer.Data/Equipment/AbstractEquipment.cs
Expand Up @@ -12,9 +12,19 @@ public abstract class AbstractEquipment
{
[Entry("nickname")]
public string Nickname;
[Entry("da_archetype")]
public string DaArchetype;
[Entry("material_library")]
public string MaterialLibrary;
[Entry("lodranges")]
public float[] LODRanges;
[Entry("hp_child")]
public string HPChild { get; private set; }
[Entry("ids_name")]
public int IdsName = -1;
[Entry("ids_info")]
public int IdsInfo = -1;
[Entry("lootable")]
public bool Lootable;
}
}
8 changes: 0 additions & 8 deletions src/LibreLancer.Data/Equipment/Gun.cs
Expand Up @@ -8,14 +8,6 @@ namespace LibreLancer.Data.Equipment
{
public class Gun : AbstractEquipment
{
[Entry("da_archetype")]
public string DaArchetype;
[Entry("material_library")]
public string MaterialLibrary;
[Entry("ids_name")]
public int IdsName;
[Entry("ids_info")]
public int IdsInfo;
[Entry("hit_pts")]
public int Hitpoints;
[Entry("turn_rate")]
Expand Down
16 changes: 12 additions & 4 deletions src/LibreLancer.Data/Equipment/PowerCore.cs
Expand Up @@ -8,9 +8,17 @@ namespace LibreLancer.Data.Equipment
{
public class PowerCore : AbstractEquipment
{
[Entry("da_archetype")]
public string DaArchetype;
[Entry("material_library")]
public string MaterialLibrary;
[Entry("volume")]
public int Volume;
[Entry("mass")]
public int Mass;
[Entry("capacity")]
public int Capacity;
[Entry("charge_rate")]
public int ChargeRate;
[Entry("thrust_capacity")]
public int ThrustCapacity;
[Entry("thrust_charge_rate")]
public int ThrustChargeRate;
}
}
10 changes: 1 addition & 9 deletions src/LibreLancer.Data/Equipment/Thruster.cs
Expand Up @@ -8,22 +8,14 @@ namespace LibreLancer.Data.Equipment
{
public class Thruster : AbstractEquipment
{
[Entry("particles")]
[Entry("particles")]
public string Particles;
[Entry("da_archetype")]
public string DaArchetype;
[Entry("material_library")]
public string MaterialLibrary;
[Entry("hp_particles")]
public string HpParticles;
[Entry("max_force")]
public int MaxForce;
[Entry("power_usage")]
public int PowerUsage;
[Entry("ids_name")]
public int IdsName;
[Entry("ids_info")]
public int IdsInfo;
[Entry("hit_pts")]
public int Hitpoints;
}
Expand Down
8 changes: 7 additions & 1 deletion src/LibreLancer/Utf/Cmp/Part.cs
Expand Up @@ -33,7 +33,13 @@ public AbstractConstruct Construct
return construct;
}
}

/// <summary>
/// EDITOR USE ONLY: Changes the construct object for the part
/// </summary>
public void UpdateConstruct(AbstractConstruct con)
{
construct = con;
}
private string fileName;
private ModelFile model;
public ModelFile Model
Expand Down

0 comments on commit 3652cde

Please sign in to comment.