Get a random float (0-1) from a pre-calculated list. This is faster, and if you put the same seed in, it will always return the same number.
The downside is that it only has 8192 variations of floats, but that seem like enough for most things.
Get the managed size of a given type. This matches an IL-level sizeof(t), even if it cannot be determined normally in C#.
Note that `sizeof(t) != Marshal.SizeOf(t)` when t is char or bool.
Note
An IL-level `sizeof(t)` will return `sizeof(IntPtr)` for reference types, as it refers to the size on stack or in an object,
not the size on heap.
Is this string a valid Tag. This is a way to check if a string is a valid tag, project wide. So our logic is always the same.
- not null
- between 1 and 32 chars
- a-z
Given a large string, find all occurrences of a substring and return them with padding.
This is useful in situations where you're searching for a word in a hug body of text, and
want to show how it's used without displaying the whole text.
Formats a remaining duration as a compact countdown, such as "2d 03h 04m 05s".
Leading zero units are omitted, and zero or negative durations return an empty string.
Parameter
Type
Description
span
TimeSpan
The time remaining, calculated using the caller's clock.
includeSeconds = True
bool
Includes every unit down to seconds. When false, shows days and hours, hours and minutes,
or minutes alone; a positive duration below one minute is shown as "<1m".
Convert to `System.Double`. Might be a string formula. This is always going to be slower than a call to `Sandbox.SandboxSystemExtensions.ToDouble(System.String,System.Single)`.
Convert to `System.Single`. Might be a string formula. This is always going to be slower than a call to `Sandbox.SandboxSystemExtensions.ToFloat(System.String,System.Single)`.
Convert to `System.Int32`. Might be a string formula. This is always going to be slower than a call to `Sandbox.SandboxSystemExtensions.ToInt(System.String,System.Int32)`.
Convert to `System.Int64`. Might be a string formula. This is always going to be slower than a call to `Sandbox.SandboxSystemExtensions.ToLong(System.String,System.Int64)`.
If the string is longer than this amount of characters then truncate it
If appendage is defined, it will be appended to the end of truncated strings (ie, "..")
If the string is longer than this amount of characters then truncate it
If appendage is defined, it will be appended to the end of truncated strings (ie, "..")
Returns true if this string matches a wildcard match. Check is case insensitive.
Supports '*' (zero or more chars) and '?' (exactly one char) wildcards.
The backslash character '\' escapes '*' to match it literally.