This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 897
/
IMyTerminalBlock.cs
90 lines (87 loc) · 3.5 KB
/
IMyTerminalBlock.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VRage.Collections;
namespace Sandbox.ModAPI.Ingame
{
public interface IMyTerminalBlock : IMyCubeBlock
{
string CustomName { get; }
string CustomNameWithFaction { get; }
string DetailedInfo { get; }
bool HasLocalPlayerAccess();
bool HasPlayerAccess(long playerId);
void RequestShowOnHUD(bool enable);
void SetCustomName(string text);
void SetCustomName(StringBuilder text);
bool ShowOnHUD { get; }
void GetActions(List<Sandbox.ModAPI.Interfaces.ITerminalAction> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalAction, bool> collect = null);
void SearchActionsOfName(string name,List<Sandbox.ModAPI.Interfaces.ITerminalAction> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalAction, bool> collect = null);
Sandbox.ModAPI.Interfaces.ITerminalAction GetActionWithName(string name);
Sandbox.ModAPI.Interfaces.ITerminalProperty GetProperty(string id);
void GetProperties(List<Sandbox.ModAPI.Interfaces.ITerminalProperty> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalProperty, bool> collect = null);
}
/*
Written by Kalvin Osborne, AKA Night Lone. Please do not remove this line.
*/
public static class TerminalBlockExtentions
{
public static void ApplyAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName)
{
block.GetActionWithName(actionName).Apply(block);
}
public static void ApplyAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName, List<TerminalActionParameter> parameters)
{
block.GetActionWithName(actionName).Apply(block, parameters);
}
public static bool HasAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string Action)
{
return !(block.GetActionWithName(Action) == null);
}
public static bool HasInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block)
{
return block is Sandbox.ModAPI.Interfaces.IMyInventoryOwner;
}
public static Sandbox.ModAPI.Interfaces.IMyInventory GetInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, int index)
{
if (block.HasInventory())
{
return ((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)block).GetInventory(index);
}
else
{
return null;
}
}
public static int GetInventoryCount(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block)
{
if (block.HasInventory())
{
return ((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)block).InventoryCount;
}
else
{
return 0;
}
}
public static bool GetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block)
{
if (block.HasInventory())
{
return ((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)block).UseConveyorSystem;
}
else
{
return false;
}
}
public static void SetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, bool use)
{
if (block.HasInventory())
{
((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)block).UseConveyorSystem = use;
}
}
}
}