-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUtil.cs
92 lines (84 loc) · 2.61 KB
/
Util.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
91
92
using Sandbox;
using System;
namespace Amper.FPS;
public static class Source1Extensions
{
public async static void Reset( this DoorEntity door )
{
if ( !Host.IsServer ) return;
var startsLocked = door.SpawnSettings.HasFlag( DoorEntity.Flags.StartLocked );
// unlock the door to force change.
var lastSpeed = door.Speed;
// Close the door at a very high speed, so it visually closes immediately.
door.Speed = 10000;
door.Close();
// wait some time
await GameTask.DelaySeconds( 0.1f );
// reset speed back.
door.Speed = lastSpeed;
if ( startsLocked ) door.Lock();
}
public static bool IsValid( this GameResource resource ) => resource != null;
public static void NetInfo( this Logger logger, FormattableString message ) => logger.Info( $"[{(Host.IsServer ? "SV" : "CL")}] {message}" );
public static void NetInfo( this Logger logger, object message ) => logger.Info( $"[{(Host.IsServer ? "SV" : "CL")}] {message}" );
}
public static class CollisionTags
{
/// <summary>
/// Never collides with anything.
/// </summary>
public const string NotSolid = "notsolid";
/// <summary>
/// Everything that is solid.
/// </summary>
public const string Solid = "solid";
/// <summary>
/// Trigger that isn't collideable but can still send touch events.
/// </summary>
public const string Trigger = "trigger";
/// <summary>
/// A ladder.
/// </summary>
public const string Ladder = "ladder";
/// <summary>
/// Water pool.
/// </summary>
public const string Water = "water";
/// <summary>
/// Never collides with anything except solid and other debris.
/// </summary>
public const string Debris = "debris";
/// <summary>
/// Just like debris, but also sends touch events to players.
/// </summary>
public const string Interactable = "interactable";
/// <summary>
/// This is a player.
/// </summary>
public const string Player = "player";
/// <summary>
/// A fired projectile.
/// </summary>
public const string Projectile = "projectile";
/// <summary>
/// This is a weapon players can interact with.
/// </summary>
public const string Weapon = "weapon";
/// <summary>
/// Driveable vehicle.
/// </summary>
public const string Vehicle = "vehicle";
/// <summary>
/// Physics prop, collideable by player movement by default.
/// </summary>
public const string Prop = "prop";
/// <summary>
/// A non playable entity.
/// </summary>
public const string NPC = "npc";
public const string Clip = "clip";
public const string PlayerClip = "playerclip";
public const string BulletClip = "bulletclip";
public const string ProjectileClip = "projectileclip";
public const string NPCClip = "npcclip";
}