-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdatableAndDeletable.cs
More file actions
49 lines (43 loc) · 1.31 KB
/
Copy pathUpdatableAndDeletable.cs
File metadata and controls
49 lines (43 loc) · 1.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
namespace TimeStop
{
public partial class TimeStop
{
}
internal static class UpdatableAndDeletableCWT
{
static ConditionalWeakTable<UpdatableAndDeletable, Data> table = new ConditionalWeakTable<UpdatableAndDeletable, Data>();
public static Data GetCustomData(this UpdatableAndDeletable self)
{
if (table.TryGetValue(self, out Data data))
return data;
data = new Data(self);
table.Add(self, data);
return data;
}
public class Data
{
public UpdatableAndDeletable Target { get; }
public bool isEligableForTimeStopVFX
{
get
{
if (Target is not Player) return false;
Player player = Target as Player;
if (player == null || player.abstractCreature == null || player.room == null || player.dead) return false;
return true;
}
}
public Data(UpdatableAndDeletable target)
{
Target = target;
}
}
}
}