mirror of
https://github.com/dreamforceinc/wContainerSorter.git
synced 2025-12-12 19:22:36 +03:00
Some fixes.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -361,4 +361,3 @@ MigrationBackup/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
/wContainerSorter_Backup_2023-11-03-121529496.zip
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
R e a d m e
|
||||
-----------
|
||||
|
||||
In this file you can include any instructions or other comments you want to have injected onto the
|
||||
top of your final script. You can safely delete this file if you do not want any such comments.
|
||||
@@ -1,34 +1,11 @@
|
||||
using Sandbox.Game.EntityComponents;
|
||||
using Sandbox.ModAPI.Ingame;
|
||||
using Sandbox.ModAPI.Interfaces;
|
||||
|
||||
using SpaceEngineers.Game.ModAPI.Ingame;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Sandbox.ModAPI.Ingame;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
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 VRageMath;
|
||||
namespace IngameScript {
|
||||
partial class Program : MyGridProgram {
|
||||
|
||||
namespace IngameScript
|
||||
{
|
||||
partial class Program : MyGridProgram
|
||||
{
|
||||
|
||||
// --------------------------------------------------
|
||||
// wContainerSorter, v1.0
|
||||
// wContainerSorter, v1.1
|
||||
// Copyright (c) 2023 by W0LF aka 'dreamforce'
|
||||
//
|
||||
// This script sorts the content of the containers.
|
||||
@@ -40,27 +17,19 @@ namespace IngameScript
|
||||
|
||||
|
||||
|
||||
// !!! NO CHANGES BELOW !!! //
|
||||
// =============== !!! NO CHANGES BELOW !!! =============== //
|
||||
static List<IMyTerminalBlock> containers = new List<IMyTerminalBlock>();
|
||||
static List<MyInventoryItem> containerItems = new List<MyInventoryItem>();
|
||||
|
||||
public Program()
|
||||
{
|
||||
public Program() {
|
||||
Runtime.UpdateFrequency = UpdateFrequency.Update100;
|
||||
}
|
||||
|
||||
public void Main(string argument, UpdateType updateSource)
|
||||
{
|
||||
//IMyTextPanel lcd = GridTerminalSystem.GetBlockWithName("LCD") as IMyTextPanel;
|
||||
//lcd.ContentType = ContentType.TEXT_AND_IMAGE;
|
||||
//lcd.WriteText("");
|
||||
|
||||
public void Main(string argument, UpdateType updateSource) {
|
||||
containers.Clear();
|
||||
|
||||
GridTerminalSystem.GetBlocksOfType<IMyCargoContainer>(containers);
|
||||
|
||||
foreach (var container in containers)
|
||||
{
|
||||
foreach (var container in containers) {
|
||||
containerItems.Clear();
|
||||
IMyInventory containerInventory = container.GetInventory();
|
||||
containerInventory.GetItems(containerItems);
|
||||
@@ -68,23 +37,13 @@ namespace IngameScript
|
||||
if (sortType.ToUpper() == "NAME") containerItems.Sort((MyInventoryItem x, MyInventoryItem y) => x.Type.SubtypeId.ToString().CompareTo(y.Type.SubtypeId.ToString()));
|
||||
else containerItems.Sort((MyInventoryItem x, MyInventoryItem y) => x.Type.ToString().CompareTo(y.Type.ToString()));
|
||||
|
||||
foreach (MyInventoryItem item in containerItems)
|
||||
{
|
||||
for (int i = 0; i < containerInventory.ItemCount; i++)
|
||||
{
|
||||
foreach (MyInventoryItem item in containerItems) {
|
||||
for (int i = 0; i < containerInventory.ItemCount; i++) {
|
||||
MyInventoryItem item2 = (MyInventoryItem)containerInventory.GetItemAt(i);
|
||||
if (item.Equals(item2)) containerInventory.TransferItemTo(containerInventory, i, i + containerInventory.ItemCount, true);
|
||||
}
|
||||
}
|
||||
|
||||
//lcd.WriteText($"{container.CustomName}:\n", true);
|
||||
//foreach (MyInventoryItem item in containerItems) lcd.WriteText($"{item.Type} - {item.Amount}\n", true);
|
||||
//lcd.WriteText("\n", true);
|
||||
}
|
||||
}
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</AdditionalFiles>
|
||||
<Compile Include="Program.cs" />
|
||||
<AdditionalFiles Include="Instructions.readme" />
|
||||
<AdditionalFiles Include="thumb.png" />
|
||||
<AdditionalFiles Include="MDK\whitelist.cache" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user