Compare commits
No commits in common. "d0be374ca8b05410512064dfb69e5e6a4aa321ea" and "736aec97db4fbc56d1f5ceb9c382c8b3cab1b32a" have entirely different histories.
d0be374ca8
...
736aec97db
7 changed files with 0 additions and 579 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -135,4 +135,3 @@ $RECYCLE.BIN/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
_NCrunch*
|
_NCrunch*
|
||||||
/PML/.$pml.drawio.bkp
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netframework48</TargetFramework>
|
|
||||||
<RootNamespace>IngameScript</RootNamespace>
|
|
||||||
<LangVersion>6</LangVersion>
|
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
|
||||||
<Configurations>Release;Debug</Configurations>
|
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Mal.Mdk2.PbAnalyzers" Version="2.1.13">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Mal.Mdk2.PbPackager" Version="2.1.5">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Mal.Mdk2.References" Version="2.2.4">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Instructions.readme" />
|
|
||||||
<AdditionalFiles Include="Instructions.readme" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Import Project="..\SECommon\SECommon.projitems" Label="Shared" />
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
; This file is project specific and should be checked in to source control.
|
|
||||||
|
|
||||||
[mdk]
|
|
||||||
; This is a programmable block script project.
|
|
||||||
; You should not change this.
|
|
||||||
type=programmableblock
|
|
||||||
|
|
||||||
; Toggle trace (on|off) (verbose output)
|
|
||||||
trace=off
|
|
||||||
|
|
||||||
; What type of minification to use (none|trim|stripcomments|lite|full)
|
|
||||||
; none: No minification
|
|
||||||
; trim: Removes unused types (NOT members).
|
|
||||||
; stripcomments: trim + removes comments.
|
|
||||||
; lite: stripcomments + removes leading/trailing whitespace.
|
|
||||||
; full: lite + renames identifiers to shorter names.
|
|
||||||
minify=none
|
|
||||||
|
|
||||||
; A list of files and folder to ignore when creating the script.
|
|
||||||
; This is a comma separated list of glob patterns.
|
|
||||||
; See https://code.visualstudio.com/docs/editor/glob-patterns
|
|
||||||
ignores=obj/**/*,MDK/**/*,**/*.debug.cs
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
; This file is _local_ to your machine and should not be checked in to source control.
|
|
||||||
|
|
||||||
[mdk]
|
|
||||||
; Where to output the script to (auto|specific path)
|
|
||||||
output=auto
|
|
||||||
; Override the default binary path (auto|specific path)
|
|
||||||
binarypath=auto
|
|
||||||
402
PML/Program.cs
402
PML/Program.cs
|
|
@ -1,402 +0,0 @@
|
||||||
using Sandbox.Game.EntityComponents;
|
|
||||||
using Sandbox.ModAPI.Ingame;
|
|
||||||
using Sandbox.ModAPI.Interfaces;
|
|
||||||
|
|
||||||
using SpaceEngineers.Game.ModAPI.Ingame;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.Immutable;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using VRage;
|
|
||||||
using VRage.Collections;
|
|
||||||
using VRage.Game;
|
|
||||||
using VRage.Game.Components;
|
|
||||||
using VRage.Game.GUI.TextPanel;
|
|
||||||
using VRage.Game.ModAPI.Ingame;
|
|
||||||
using VRage.Game.ModAPI.Ingame.Utilities;
|
|
||||||
using VRage.Game.ObjectBuilders.Definitions;
|
|
||||||
using VRage.ObjectBuilders;
|
|
||||||
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace IngameScript
|
|
||||||
{
|
|
||||||
partial class Program : MyGridProgram
|
|
||||||
{
|
|
||||||
const int NUMBER_OF_MISSILES = 52; // The quantity of components will be created to build this quantity of missiles.
|
|
||||||
const int NUMBER_OF_CANNON_SHELL = 160;
|
|
||||||
const int NUMBER_OF_ARTILLERY_SHELL = 40;
|
|
||||||
|
|
||||||
const int CONSOLE_NB_LINES = 14;
|
|
||||||
const string GRID_PREFIX = "[PML]";
|
|
||||||
|
|
||||||
const float EPSILON = 0.05f;
|
|
||||||
|
|
||||||
readonly IMyCubeGrid grid;
|
|
||||||
|
|
||||||
readonly Output output;
|
|
||||||
|
|
||||||
readonly Output topPanel;
|
|
||||||
readonly Output bottomPanel;
|
|
||||||
|
|
||||||
readonly IMyAssembler assembler;
|
|
||||||
|
|
||||||
readonly List<ComponentQuantity> missileComponents = new List<ComponentQuantity>{
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("SteelPlate"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/SteelPlate"), 256),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Construction"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/ConstructionComponent"), 166),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Motor"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/MotorComponent"), 18),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("InteriorPlate"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/InteriorPlate"), 40),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Computer"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/ComputerComponent"), 48),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("PowerCell"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/PowerCell"), 2),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Display"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/Display"), 1),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("SmallTube"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/SmallTube"), 29),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("MetalGrid"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/MetalGrid"), 48),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("LargeTube"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/LargeTube"), 16),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Detector"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/DetectorComponent"), 8),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Girder"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/GirderComponent"), 12),
|
|
||||||
new ComponentQuantity(MyItemType.MakeComponent("Explosives"), MyDefinitionId.Parse("MyObjectBuilder_BlueprintDefinition/ExplosivesComponent"), 24),
|
|
||||||
};
|
|
||||||
|
|
||||||
public Program()
|
|
||||||
{
|
|
||||||
this.grid = this.Me.CubeGrid;
|
|
||||||
|
|
||||||
var output = this.Me.GetSurface(0);
|
|
||||||
this.output = new Output(output, CONSOLE_NB_LINES);
|
|
||||||
|
|
||||||
this.output.Print("PML system starting...");
|
|
||||||
|
|
||||||
this.topPanel = new Output(this.GridTerminalSystem.GetBlock<IMyTextPanel>("LCD Panel - Main 02", this.grid));
|
|
||||||
|
|
||||||
this.assembler = this.GridTerminalSystem.GetBlock<IMyAssembler>("Assembler Main", this.grid);
|
|
||||||
|
|
||||||
Runtime.UpdateFrequency = UpdateFrequency.Update100;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Main(string argument, UpdateType updateSource)
|
|
||||||
{
|
|
||||||
if ((updateSource & UpdateType.Update100) != 0)
|
|
||||||
{
|
|
||||||
this.UpdateState();
|
|
||||||
}
|
|
||||||
else if ((updateSource & (UpdateType.Terminal | UpdateType.Trigger)) != 0)
|
|
||||||
{
|
|
||||||
switch (argument)
|
|
||||||
{
|
|
||||||
case "COMMAND":
|
|
||||||
this.output.Print("BLA...");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "START_MINING":
|
|
||||||
|
|
||||||
default:
|
|
||||||
this.output.Print($"Uknown command: {argument}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateState()
|
|
||||||
{
|
|
||||||
this.BuildComponentForMissiles();
|
|
||||||
this.BuildAmmo();
|
|
||||||
this.DisplayStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildComponentForMissiles()
|
|
||||||
{
|
|
||||||
var existingAmounts = this.GetCurrentItemQuantity(missileComponents.Select(quantity => quantity.ItemType));
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
foreach (var missileComponent in this.missileComponents)
|
|
||||||
{
|
|
||||||
var existing = existingAmounts[i];
|
|
||||||
|
|
||||||
var queue = new List<MyProductionItem>();
|
|
||||||
this.assembler.GetQueue(queue);
|
|
||||||
foreach (var item in queue)
|
|
||||||
{
|
|
||||||
if (item.BlueprintId == missileComponent.blueprintId)
|
|
||||||
existing += item.Amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
var desired = missileComponent.Quantity * NUMBER_OF_MISSILES;
|
|
||||||
|
|
||||||
if (existing < desired)
|
|
||||||
{
|
|
||||||
var toBuild = desired - existing;
|
|
||||||
this.output.Print($"Requesting {toBuild} of {missileComponent.blueprintId.SubtypeName}");
|
|
||||||
this.assembler.AddQueueItem(missileComponent.blueprintId, toBuild);
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildAmmo()
|
|
||||||
{
|
|
||||||
//var ammoDefinitionIds = new List<MyDefinitionId>
|
|
||||||
//{
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Missile200mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Missile400mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Missile800mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Missile1200mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Projectile200mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Projectile400mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Projectile800mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/Projectile1200mm"),
|
|
||||||
// MyDefinitionId.Parse("MyObjectBuilder_AmmoMagazine/ArtilleryShell"),
|
|
||||||
//};
|
|
||||||
//var existingAmounts = this.GetCurrentItemQuantity(ammoDefinitionIds);
|
|
||||||
//var desiredAmounts = new List<MyFixedPoint>
|
|
||||||
//{
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_MISSILES * 4), // Missile200mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_MISSILES * 4), // Missile400mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_MISSILES * 2), // Missile800mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_MISSILES * 2), // Missile1200mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_CANNON_SHELL / 4), // Projectile200mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_CANNON_SHELL / 4), // Projectile400mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_CANNON_SHELL / 4), // Projectile800mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_CANNON_SHELL / 4), // Projectile1200mm
|
|
||||||
// (MyFixedPoint)(NUMBER_OF_ARTILLERY_SHELL), // ArtilleryShell
|
|
||||||
//};
|
|
||||||
//foreach (var tuple in ammoDefinitionIds.Zip(existingAmounts, desiredAmounts, (id, existing, desired) => (id, existing, desired)))
|
|
||||||
//{
|
|
||||||
// if (tuple.existing < tuple.desired - EPSILON)
|
|
||||||
// {
|
|
||||||
// var toBuild = tuple.desired - tuple.existing;
|
|
||||||
// this.assembler.AddQueueItem(tuple.id, toBuild);
|
|
||||||
// this.output.Print($"Requesting {toBuild} of {tuple.id.SubtypeName}");
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayStatus()
|
|
||||||
{
|
|
||||||
var cargoSpace = this.GetCargoSpace();
|
|
||||||
var energyState = this.GetEnergyState();
|
|
||||||
var hydrogenVolume = this.GetHydrogenVolume();
|
|
||||||
var oxygenVolume = this.GetOxygenVolume();
|
|
||||||
|
|
||||||
this.topPanel.Display(
|
|
||||||
$@"
|
|
||||||
{cargoSpace.ToString("Cargo volume", "kL")}
|
|
||||||
|
|
||||||
{energyState.ToString("Energy", "MWh")}
|
|
||||||
|
|
||||||
{hydrogenVolume.ToString("Hydrogen", "L")}
|
|
||||||
|
|
||||||
{oxygenVolume.ToString("Oxygen", "L")}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MyFixedPoint> GetCurrentItemQuantity(IEnumerable<MyItemType> itemTypes)
|
|
||||||
{
|
|
||||||
var total = new List<MyFixedPoint>(new MyFixedPoint[itemTypes.Count()]);
|
|
||||||
|
|
||||||
foreach (var container in this.GridTerminalSystem.GetBlocks<IMyCargoContainer>(null, this.grid))
|
|
||||||
{
|
|
||||||
//this.output.Print($"Container: {container.CustomName}");
|
|
||||||
int i = 0;
|
|
||||||
foreach (var itemType in itemTypes)
|
|
||||||
{
|
|
||||||
var items = container.GetInventory().FindItem(itemType);
|
|
||||||
//this.output.Print($"{itemType}: {items}");
|
|
||||||
if (items.HasValue)
|
|
||||||
total[i] += items.Value.Amount;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var assembler in this.GridTerminalSystem.GetBlocks<IMyAssembler>(null, this.grid))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (var itemType in itemTypes)
|
|
||||||
{
|
|
||||||
var items = assembler.OutputInventory.FindItem(itemType);
|
|
||||||
if (items.HasValue)
|
|
||||||
total[i] += items.Value.Amount;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var sorter in this.GridTerminalSystem.GetBlocks<IMyConveyorSorter>(null, this.grid))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (var itemType in itemTypes)
|
|
||||||
{
|
|
||||||
var items = sorter.GetInventory().FindItem(itemType);
|
|
||||||
if (items.HasValue)
|
|
||||||
total[i] += items.Value.Amount;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var welder in this.GridTerminalSystem.GetBlocks<IMyShipWelder>(null, this.grid))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (var itemType in itemTypes)
|
|
||||||
{
|
|
||||||
var items = welder.GetInventory().FindItem(itemType);
|
|
||||||
if (items.HasValue)
|
|
||||||
total[i] += items.Value.Amount;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var turret in this.GridTerminalSystem.GetBlocks<IMyLargeTurretBase>(null, this.grid))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (var itemType in itemTypes)
|
|
||||||
{
|
|
||||||
var items = turret.GetInventory().FindItem(itemType);
|
|
||||||
if (items.HasValue)
|
|
||||||
total[i] += items.Value.Amount;
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ComponentQuantity
|
|
||||||
{
|
|
||||||
public ComponentQuantity(MyItemType itemType, MyDefinitionId blueprintId, MyFixedPoint quantity)
|
|
||||||
{
|
|
||||||
this.ItemType = itemType;
|
|
||||||
this.blueprintId = blueprintId;
|
|
||||||
|
|
||||||
//if (!MyDefinitionId.TryParse("MyObjectBuilder_BlueprintDefinition", this.ItemType.SubtypeId, out this.Id))
|
|
||||||
// throw new ArgumentException($"Cannot parse {this.ItemType} into a MyDefinitionId");
|
|
||||||
|
|
||||||
this.Quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly MyItemType ItemType;
|
|
||||||
public readonly MyDefinitionId blueprintId;
|
|
||||||
public readonly MyFixedPoint Quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Quantity
|
|
||||||
{
|
|
||||||
public Quantity(double current, double total)
|
|
||||||
{
|
|
||||||
this.Current = current;
|
|
||||||
this.Total = total;
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly double Current;
|
|
||||||
public readonly double Total;
|
|
||||||
|
|
||||||
public string ToString(string name, string unit)
|
|
||||||
{
|
|
||||||
var firstLineLength = 50;
|
|
||||||
var secondLineLength = 50;
|
|
||||||
|
|
||||||
var firstLine = new StringBuilder();
|
|
||||||
firstLine.Append(name).Append(": ");
|
|
||||||
var values = $"{this.Current:N1} {unit} / {this.Total:N1} {unit}";
|
|
||||||
firstLine.Append(values.PadLeft(firstLineLength - firstLine.Length));
|
|
||||||
|
|
||||||
var secondLine = new StringBuilder();
|
|
||||||
secondLine.Append("[");
|
|
||||||
var ratio = this.Current / this.Total;
|
|
||||||
var percentStr = $"{ratio * 100.0,8:N1}%";
|
|
||||||
// "-2" because of the starting and ending characters: '[', ']'.
|
|
||||||
var gaugeSize = secondLineLength - percentStr.Length - 2;
|
|
||||||
var n = (int)((double)gaugeSize * ratio);
|
|
||||||
secondLine.Append(new string('|', n));
|
|
||||||
secondLine.Append(new string(' ', gaugeSize - n)).Append("]");
|
|
||||||
secondLine.Append(percentStr);
|
|
||||||
|
|
||||||
return $"{firstLine}\n{secondLine}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity GetCargoSpace()
|
|
||||||
{
|
|
||||||
var containers = this.GridTerminalSystem.GetBlocks<IMyCargoContainer>(null, this.grid);
|
|
||||||
|
|
||||||
double currentVolume = 0;
|
|
||||||
double totalVolume = 0;
|
|
||||||
|
|
||||||
foreach (var container in containers)
|
|
||||||
{
|
|
||||||
var inventory = container.GetInventory();
|
|
||||||
currentVolume += (double)inventory.CurrentVolume;
|
|
||||||
totalVolume += (double)inventory.MaxVolume;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Quantity(currentVolume, totalVolume);
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity GetEnergyState()
|
|
||||||
{
|
|
||||||
double currentkWh = 0;
|
|
||||||
double maxkWh = 0;
|
|
||||||
var batteries = this.GridTerminalSystem.GetBlocks<IMyBatteryBlock>(null, this.grid);
|
|
||||||
|
|
||||||
foreach (var battery in batteries)
|
|
||||||
{
|
|
||||||
currentkWh += (double)battery.CurrentStoredPower;
|
|
||||||
maxkWh += (double)battery.MaxStoredPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Quantity(currentkWh, maxkWh);
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity GetHydrogenVolume()
|
|
||||||
{
|
|
||||||
double currentVolume = 0;
|
|
||||||
double totalVolume = 0;
|
|
||||||
var tanks = this.GridTerminalSystem.GetBlocks<IMyGasTank>(null, this.grid, tank => tank.CustomName.Contains("Hydrogen"));
|
|
||||||
|
|
||||||
//var tanks = new List<IMyGasTank>();
|
|
||||||
//GridTerminalSystem.GetBlocksOfType<IMyGasTank>(tanks,
|
|
||||||
// (IMyGasTank tank) =>
|
|
||||||
// {
|
|
||||||
// return tank.CustomName.Contains("Mammouth") && tank.CustomName.Contains("hydro");
|
|
||||||
// }
|
|
||||||
//);
|
|
||||||
|
|
||||||
foreach (var tank in tanks)
|
|
||||||
{
|
|
||||||
currentVolume += (double)tank.Capacity * (double)tank.FilledRatio;
|
|
||||||
totalVolume += (double)tank.Capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Quantity(currentVolume, totalVolume);
|
|
||||||
}
|
|
||||||
|
|
||||||
Quantity GetOxygenVolume()
|
|
||||||
{
|
|
||||||
double currentVolume = 0;
|
|
||||||
double totalVolume = 0;
|
|
||||||
var tanks = this.GridTerminalSystem.GetBlocks<IMyGasTank>(null, this.grid, tank => tank.CustomName.Contains("Oxygen"));
|
|
||||||
//var tanks = new List<IMyGasTank>();
|
|
||||||
//GridTerminalSystem.GetBlocksOfType<IMyGasTank>(tanks,
|
|
||||||
// (IMyGasTank tank) =>
|
|
||||||
// {
|
|
||||||
// return tank.CustomName.Contains("Mammouth") && tank.CustomName.Contains("oxygène");
|
|
||||||
// }
|
|
||||||
//);
|
|
||||||
|
|
||||||
foreach (var tank in tanks)
|
|
||||||
{
|
|
||||||
currentVolume += (double)tank.Capacity * (double)tank.FilledRatio;
|
|
||||||
totalVolume += (double)tank.Capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Quantity(currentVolume, totalVolume);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Mal.Mdk2.PbPackager" version="2.0.0-alpha073" targetFramework="net48" />
|
|
||||||
</packages>
|
|
||||||
109
PML/pml.drawio
109
PML/pml.drawio
|
|
@ -1,109 +0,0 @@
|
||||||
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/28.0.6 Chrome/138.0.7204.100 Electron/37.2.3 Safari/537.36" version="28.0.6">
|
|
||||||
<diagram name="Page-1" id="m05EODv_H8KI0kuR81v5">
|
|
||||||
<mxGraphModel dx="641" dy="817" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
|
||||||
<root>
|
|
||||||
<mxCell id="0" />
|
|
||||||
<mxCell id="1" parent="0" />
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-2" target="kR_Pu0Igsif7gIAWynWH-5">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="680" y="440" />
|
|
||||||
<mxPoint x="340" y="440" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-2" value="Large Container<div>(Components)</div>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="620" y="600" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-3" target="kR_Pu0Igsif7gIAWynWH-5">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="540" y="460" />
|
|
||||||
<mxPoint x="370" y="460" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-13" value="Urnaium output" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="kR_Pu0Igsif7gIAWynWH-12">
|
|
||||||
<mxGeometry x="0.0034" y="1" relative="1" as="geometry">
|
|
||||||
<mxPoint x="-39" as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-3" target="kR_Pu0Igsif7gIAWynWH-15">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<mxPoint x="600" y="720" as="targetPoint" />
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="500" y="710" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-3" target="kR_Pu0Igsif7gIAWynWH-16">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-3" value="Large Container<div>(Ingots<span style="background-color: transparent; color: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));">)</span></div>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="440" y="600" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-4" target="kR_Pu0Igsif7gIAWynWH-7">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-4" value="Large Container<div>(Ore<span style="background-color: transparent; color: light-dark(rgb(0, 0, 0), rgb(255, 255, 255));">)</span></div>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="130" y="600" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-5" target="kR_Pu0Igsif7gIAWynWH-3">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="500" y="540" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-11" value="Bypass ingot" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="kR_Pu0Igsif7gIAWynWH-10">
|
|
||||||
<mxGeometry x="-0.1872" y="1" relative="1" as="geometry">
|
|
||||||
<mxPoint as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-5" target="kR_Pu0Igsif7gIAWynWH-4">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-19" value="Ore" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="kR_Pu0Igsif7gIAWynWH-18">
|
|
||||||
<mxGeometry x="-0.3175" y="-1" relative="1" as="geometry">
|
|
||||||
<mxPoint as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-5" value="2 x Large Container" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="280" y="510" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-6" value="20 x O2/H2 Generator" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="280" y="300" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-7" target="kR_Pu0Igsif7gIAWynWH-3">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-7" value="3 x Refinery" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="280" y="600" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-14" value="5 x Hydrogen Tank" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="440" y="300" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-15" target="kR_Pu0Igsif7gIAWynWH-2">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="680" y="710" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-15" value="Assembler Main" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="540" y="680" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="kR_Pu0Igsif7gIAWynWH-16" target="kR_Pu0Igsif7gIAWynWH-2">
|
|
||||||
<mxGeometry relative="1" as="geometry">
|
|
||||||
<Array as="points">
|
|
||||||
<mxPoint x="680" y="780" />
|
|
||||||
</Array>
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="kR_Pu0Igsif7gIAWynWH-16" value="Assembler Slave" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="540" y="750" width="120" height="60" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</root>
|
|
||||||
</mxGraphModel>
|
|
||||||
</diagram>
|
|
||||||
</mxfile>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue