Construct Compound
This commit is contained in:
@@ -49,11 +49,12 @@ public partial class CompoundConstructor : Panel
|
||||
BaseAtom a = AtomResolver.Resolve(idx);
|
||||
Compound c = a.GrabCompound;
|
||||
c.Amount = 1;
|
||||
a.Compound = c;
|
||||
Atom at = ResourceLoader.Load<PackedScene>("res://Scenes/Atom.tscn").Instantiate<Atom>();
|
||||
at.BaseAtom = a;
|
||||
AddChild(at);
|
||||
at.Position = new(500, 500);
|
||||
HomogeneousMixture.AddCompound(c);
|
||||
HomogeneousMixture.AddCompound(c, true, true);
|
||||
Atoms.Add(at);
|
||||
}
|
||||
|
||||
@@ -112,6 +113,8 @@ public partial class CompoundConstructor : Panel
|
||||
{
|
||||
HeterogeneousMixture.Container = GlobalScene.Demo.SelectedBottle;
|
||||
GlobalScene.Demo.SelectedBottle.Content = HeterogeneousMixture;
|
||||
GlobalScene.Demo.SelectedBottle.BuildMenu();
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
@@ -128,7 +131,8 @@ public partial class CompoundConstructor : Panel
|
||||
foreach (Atom atom in Atoms)
|
||||
{
|
||||
RemoveChild(atom);
|
||||
|
||||
if (!BondMap.ContainsKey(atom))
|
||||
continue;
|
||||
foreach (Bond bond in BondMap[atom])
|
||||
{
|
||||
if (!removedBonds.Contains(bond))
|
||||
@@ -140,6 +144,7 @@ public partial class CompoundConstructor : Panel
|
||||
Atoms = new();
|
||||
BondMap = new();
|
||||
HeterogeneousMixture = new HeterogeneousMixture();
|
||||
HomogeneousMixture = HeterogeneousMixture.AddLayer();
|
||||
}
|
||||
|
||||
private void ForceClear() => Clear(false);
|
||||
|
||||
Reference in New Issue
Block a user