-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActionEcho.cs
More file actions
executable file
·101 lines (87 loc) · 3.31 KB
/
Copy pathActionEcho.cs
File metadata and controls
executable file
·101 lines (87 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Sandbox.Common;
using Sandbox.Common.Components;
using Sandbox.Common.Input;
using Sandbox.Game.Entities;
using Sandbox.Game.World;
using Sandbox.Game.Weapons;
using Sandbox.Definitions;
using Sandbox.Engine;
using VRage.Common;
using Sandbox.ModAPI.Ingame;
using Sandbox.ModAPI.Interfaces;
namespace IngameProg
{
public class ActionEcho : IngameScript
{
private const char Seperator = ';';
private int CountArguments = 3;
void Main(string argument)
{
StringBuilder debug = new StringBuilder();
var blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<
////////////// EDIT TYPE HERE //////////////
IMyAirVent
////////////// END EDIT //////////////
>(blocks);
if (blocks.Count == 0)
{
Echo("No blocks found.");
return;
}
debug.Append("Porperties:").AppendLine();
debug.Append("-->Structure:").AppendLine();
debug.Append("Name (Default Value) [Min Value, Max Value] : Type Name").AppendLine();
var block = blocks[0];
List<ITerminalProperty> properties = new List<ITerminalProperty>();
block.GetProperties(properties);
for (int i = 0; i < properties.Count; ++i)
{
ITerminalProperty property = properties[i];
debug.Append('-');
debug.Append(property.Id);
switch (property.TypeName)
{
case "Boolean":
AppendProperty<Boolean>( debug, block, property);
break;
default:
AppendProperty<Single>( debug, block, property);
break;
}
debug.Append(property.TypeName);
if (i < properties.Count - 1)
debug.Append(", ");
//if (i % 10 == 9)
debug.AppendLine();
}
debug.AppendLine();
List<ITerminalAction> actions = new List<ITerminalAction>();
block.GetActions(actions);
debug.Append("Actions:").AppendLine();
List<string> actionNames = new List<string>();
for (int i = 0; i < actions.Count; ++i)
{
ITerminalAction action = actions[i];
debug.Append('-');
debug.Append(action.Id);
actionNames.Add(action.Id);
if (i < actions.Count - 1)
debug.Append(", ");
//if (i % 10 == 9)
debug.AppendLine();
}
Echo(debug.ToString());
debug.Clear();
}
void AppendProperty<T>(StringBuilder debug, IMyTerminalBlock block, ITerminalProperty property)
{
debug.Append(" (").Append(block.GetDefaultValue<T>(property.Id)).Append(") [");
debug.Append(block.GetMininum<T>(property.Id)).Append(',').Append(block.GetMaximum<T>(property.Id)).Append("] : ");
}
}
}