44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using Sandbox.ModAPI.Ingame;
|
|
using SpaceEngineers.Game.ModAPI.Ingame;
|
|
|
|
namespace IngameScript
|
|
{
|
|
public class Program : MyGridProgram
|
|
{
|
|
private const string InputMap =
|
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#&^£%!$@[]{};:.,<>/|\\|!~\"'`()=+-*_";
|
|
|
|
private const string Password = "password";
|
|
|
|
public Program()
|
|
{
|
|
Runtime.UpdateFrequency = UpdateFrequency.Update1;
|
|
}
|
|
|
|
public void Main(string argument, UpdateType updateType)
|
|
{
|
|
}
|
|
|
|
private void Setup()
|
|
{
|
|
var keypad = GridTerminalSystem.GetBlockGroupWithName("Keypad");
|
|
// get list of button panels
|
|
var buttons = new List<IMyButtonPanel>();
|
|
keypad.GetBlocksOfType(buttons);
|
|
|
|
var maxCharacters = buttons.Count;
|
|
if (maxCharacters > InputMap.Length)
|
|
{
|
|
Echo("Too many buttons");
|
|
return;
|
|
}
|
|
|
|
for (var index = 0; index < buttons.Count; index++)
|
|
{
|
|
var myButtonPanel = buttons[index];
|
|
myButtonPanel.SetCustomButtonName(0, InputMap[index].ToString());
|
|
}
|
|
}
|
|
}
|
|
} |