Skip to content

Commit

Permalink
All the compile fixes needed after nuking KAE.
Browse files Browse the repository at this point in the history
  • Loading branch information
taniwha committed Apr 4, 2016
1 parent d48c36d commit 6213cca
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 113 deletions.
31 changes: 26 additions & 5 deletions Source/Tanks/FuelTank.cs
Expand Up @@ -92,6 +92,27 @@ public PartResource resource
}
}

public void RaiseResourceInitialChanged (Part part, PartResource resource, double amount)
{
var data = new BaseEventData (BaseEventData.Sender.USER);
data.Set<PartResource> ("resource", resource);
data.Set<double> ("amount", amount);
part.SendEvent ("OnResourceInitialChanged", data, 0);
}

public void RaiseResourceMaxChanged (Part part, PartResource resource, double amount)
{
var data = new BaseEventData (BaseEventData.Sender.USER);
data.Set<PartResource> ("resource", resource);
data.Set<double> ("amount", amount);
part.SendEvent ("OnResourceMaxChanged", data, 0);
}

public void RaiseResourceListChanged (Part part)
{
part.SendEvent ("OnResourceListChanged", null, 0);
}

public double amount
{
get {
Expand Down Expand Up @@ -130,7 +151,7 @@ public double amount
foreach (Part sym in part.symmetryCounterparts) {
PartResource symResc = sym.Resources[name];
symResc.amount = value;
PartMessageService.Send<PartResourceInitialAmountChanged> (this, sym, symResc, amount);
RaiseResourceInitialChanged (sym, symResc, amount);
}
}
}
Expand Down Expand Up @@ -164,7 +185,7 @@ void DeleteTank ()
PartResource symResc = sym.Resources[name];
sym.Resources.list.Remove (symResc);
PartModule.DestroyImmediate (symResc);
PartMessageService.Send<PartResourceListChanged> (this, sym);
RaiseResourceListChanged (sym);
}
}
//print ("Sym removed");
Expand Down Expand Up @@ -206,11 +227,11 @@ void UpdateTank (double value)
foreach (Part sym in part.symmetryCounterparts) {
PartResource symResc = sym.Resources[name];
symResc.maxAmount = value;
PartMessageService.Send<PartResourceMaxAmountChanged> (this, sym, symResc, value);
RaiseResourceMaxChanged (sym, symResc, value);

if (newAmount != symResc.amount) {
symResc.amount = newAmount;
PartMessageService.Send<PartResourceInitialAmountChanged> (this, sym, symResc, newAmount);
RaiseResourceInitialChanged (sym, symResc, newAmount);
}
}
}
Expand Down Expand Up @@ -241,7 +262,7 @@ void AddTank (double value)
foreach (Part sym in part.symmetryCounterparts) {
PartResource symResc = sym.AddResource (node);
symResc.enabled = true;
PartMessageService.Send<PartResourceListChanged> (this, sym);
RaiseResourceListChanged (sym);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions Source/Tanks/FuelTankList.cs
Expand Up @@ -20,6 +20,16 @@ public FuelTankList (ConfigNode node)
Load (node);
}

public bool TryGet(string resource, out FuelTank tank)
{
if (Contains(resource)) {
tank = this[resource];
return true;
}
tank = null;
return false;
}

protected override string GetKeyForItem (FuelTank item)
{
return item.name;
Expand Down
4 changes: 2 additions & 2 deletions Source/Tanks/MFSSettings.cs
Expand Up @@ -36,8 +36,8 @@ public static string GetVersion ()
}

var asm = Assembly.GetCallingAssembly ();
var title = SystemUtils.GetAssemblyTitle (asm);
version = title + " " + SystemUtils.GetAssemblyVersionString (asm);
var title = MFSVersionReport.GetAssemblyTitle (asm);
version = title + " " + MFSVersionReport.GetAssemblyVersionString (asm);

return version;
}
Expand Down

0 comments on commit 6213cca

Please sign in to comment.