-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFind.cs
More file actions
239 lines (202 loc) · 8.32 KB
/
Find.cs
File metadata and controls
239 lines (202 loc) · 8.32 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
namespace Pluton.Rust
{
using System.Collections.Generic;
using System.Linq;
using Pluton.Core;
using Objects;
public class Find : Singleton<Find>, ISingleton
{
public void Initialize()
{
}
public List<ItemBlueprint> BluePrints()
{
return ItemManager.bpList;
}
public ItemBlueprint BluePrint(string name)
{
return ItemManager.bpList.Find(item => {
if (item.targetItem.shortname == name || item.targetItem.displayName.english == name)
return true;
return false;
});
}
public List<ItemBlueprint> BluePrintsByCategory(string cat)
{
return ItemManager.bpList.FindAll(item => {
if (item.targetItem.category.ToString() == cat)
return true;
return false;
});
}
public List<ItemBlueprint> BluePrintsByCategory(ItemCategory cat)
{
return ItemManager.bpList.FindAll(item => {
if (item.targetItem.category == cat)
return true;
return false;
});
}
public List<BuildingPart> BuildingParts()
{
return (from block in UnityEngine.Object.FindObjectsOfType<BuildingBlock>()
select new BuildingPart(block)).ToList();
}
public List<BuildingPart> BuildingPartsByName(string name)
{
return (from block in UnityEngine.Object.FindObjectsOfType<BuildingBlock>()
where block.PrefabName == name ||
block.ShortPrefabName == name ||
block.blockDefinition.fullName == name
select new BuildingPart(block)).ToList();
}
public List<BuildingPart> BuildingPartsByGrade(BuildingGrade.Enum grade)
{
return (from block in UnityEngine.Object.FindObjectsOfType<BuildingBlock>()
where block.grade == grade
select new BuildingPart(block)).ToList();
}
public List<BuildingPart> BuildingPartsByGrade(int grade)
{
return (from block in UnityEngine.Object.FindObjectsOfType<BuildingBlock>()
where (int)block.grade == grade
select new BuildingPart(block)).ToList();
}
public List<BuildingPart> BuildingPartsByGrade(string grade)
{
return (from block in UnityEngine.Object.FindObjectsOfType<BuildingBlock>()
where block.grade.ToString() == grade
select new BuildingPart(block)).ToList();
}
public List<TriggerComfort> ComfortZones()
{
return UnityEngine.Object.FindObjectsOfType<TriggerComfort>().ToList();
}
public List<Entity> CupBoards()
{
return (from board in UnityEngine.Object.FindObjectsOfType<BuildingPrivlidge>()
select new Entity(board)).ToList();
}
public List<Entity> CupBoards(ulong steamid)
{
return (from board in UnityEngine.Object.FindObjectsOfType<BuildingPrivlidge>()
where board.authorizedPlayers.Count(x => x.userid == steamid) != 0
select new Entity(board)).ToList();
}
public List<Entity> Doors()
{
return (from door in UnityEngine.Object.FindObjectsOfType<Door>()
select new Entity(door as BaseEntity)).ToList();
}
/*
public Entity Entity(UnityEngine.Vector3 location, float dist = 1f)
{
foreach (var x in BaseNetworkable.serverEntities) {
if (UnityEngine.Vector3.Distance(x.transform.position, location) <= dist) {
return new Entity(x as BaseEntity);
}
}
return null;
}
public List<Entity> Entities()
{
return (from ent in BaseNetworkable.serverEntities
select new Entity(ent as BaseEntity)).ToList();
}
public List<Entity> Entities(string name)
{
return (from ent in BaseNetworkable.serverEntities
where ent.PrefabName.Contains(name) ||
ent.ShortPrefabName.Contains(name) ||
ent.name.Contains(name)
select new Entity(ent as BaseEntity)).ToList();
}
*/
public List<ItemDefinition> ItemDefinitions()
{
return ItemManager.itemList;
}
public List<ItemDefinition> ItemDefinitionsByCategory(string cat)
{
return (from item in ItemManager.itemList
where item.category.ToString() == cat
select item).ToList();
}
public List<ItemDefinition> ItemDefinitionsByCategory(ItemCategory cat)
{
return (from item in ItemManager.itemList
where item.category == cat
select item).ToList();
}
public ItemDefinition ItemDefinition(string name)
{
return (from item in ItemManager.itemList
where item.shortname == name ||
item.displayName.english == name
select item).FirstOrDefault();
}
public List<Entity> Locks()
{
return (from _lock in UnityEngine.Object.FindObjectsOfType<BaseLock>()
select new Entity(_lock as BaseEntity)).ToList();
}
public List<Entity> LocksByAuthorizedUserID(ulong steamid)
{
return (from _lock in UnityEngine.Object.FindObjectsOfType<CodeLock>()
where ((List<ulong>)_lock.GetFieldValue("whitelistPlayers")).Contains(steamid)
select new Entity(_lock as BaseEntity)).ToList();
}
public List<Entity> Loot()
{
return (from loot in UnityEngine.Object.FindObjectsOfType<LootContainer>()
select new Entity(loot as BaseEntity)).ToList();
}
public List<NPC> NPCs()
{
return (from npc in UnityEngine.Object.FindObjectsOfType<BaseNPC>()
select new NPC(npc)).ToList();
}
public List<NPC> NPCs(string name)
{
return (from npc in UnityEngine.Object.FindObjectsOfType<BaseNPC>()
where npc.name.Contains(name)
select new NPC(npc)).ToList();
}
public Player Player(string nameorIPorID)
{
return (from player in Server.GetInstance().Players.Values
where player.Name == nameorIPorID ||
player.IP == nameorIPorID ||
player.SteamID == nameorIPorID
select player).FirstOrDefault();
}
public List<Player> Players(string nameorIP)
{
return (from player in Server.GetInstance().Players.Values
where player.Name.Contains(nameorIP) ||
player.IP.Contains(nameorIP)
select player).ToList();
}
public List<TriggerRadiation> RadZones()
{
return UnityEngine.Object.FindObjectsOfType<TriggerRadiation>().ToList();
}
public List<Entity> Storage()
{
return (from storage in UnityEngine.Object.FindObjectsOfType<StorageContainer>()
select new Entity(storage as BaseEntity)).ToList();
}
public List<TriggerTemperature> TemperatureZones()
{
return UnityEngine.Object.FindObjectsOfType<TriggerTemperature>().ToList();
}
public List<TriggerBase> Triggers()
{
return UnityEngine.Object.FindObjectsOfType<TriggerBase>().ToList();
}
public List<T> Triggers<T>() where T : TriggerBase
{
return UnityEngine.Object.FindObjectsOfType<T>().ToList();
}
}
}