Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LolaLollipop committed Jan 6, 2024
1 parent 0fd85d0 commit c3637a2
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 114 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ References/
packages/
RueITests/obj
RueITests/bin
ruei-debug.txt
RueIDocFX.dll
8 changes: 4 additions & 4 deletions RueI/RueI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
<Platforms>AnyCPU;x64</Platforms>
<Title>RueI</Title>
<Copyright>CC0 1.0</Copyright>
<Version>2.0.3</Version>
<Version>2.0.4</Version>
<Authors>Rue &lt;3, Override (some help)</Authors>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>universal hint framework for scp:sl</Description>
<RepositoryUrl>https://github.com/Ruemena/RueI</RepositoryUrl>
<PackageProjectUrl>https://github.com/Ruemena/RueI</PackageProjectUrl>
<PackageTags>scpsl;hints;scp;exiled;nwapi</PackageTags>
<AssemblyVersion>2.0.3</AssemblyVersion>
<FileVersion>2.0.3</FileVersion>
<AssemblyVersion>2.0.4</AssemblyVersion>
<FileVersion>2.0.4</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>fixes and improvements to documentation</PackageReleaseNotes>
<PackageReleaseNotes>various fixes, improvements to docs, new reflection helpers, and general cleanup</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion RueI/RueI/Events/Events.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace RueI.Events;

/// <summary>
/// Provides events for use by other plugins.
/// Provides events for use by plugins using RueI.
/// </summary>
public static class Events
{
Expand Down
21 changes: 0 additions & 21 deletions RueI/RueI/Extensions/CollectionExtensions.cs

This file was deleted.

8 changes: 6 additions & 2 deletions RueI/RueI/Extensions/DisplayCoreExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static void SetElementOrNew(this DisplayCore core, IElemReference<SetElem

/// <summary>
/// Temporarily adds an <see cref="Element"/> to a <see cref="DisplayCore"/> using the specified <see cref="TimedElemRef{T}"/>.
/// This method updates the <see cref="DisplayCore"/>.
/// </summary>
/// <param name="core">The <see cref="DisplayCore"/> to add the element to.</param>
/// <param name="element">The element to add.</param>
Expand All @@ -43,20 +44,22 @@ public static void AddTemp<T>(this DisplayCore core, T element, TimeSpan time, T
where T : Element, ISettable
{
core.AddAsReference(elemRef, element);
core.Update();

core.Scheduler.KillJob(elemRef.JobToken);
core.Scheduler.Schedule(time, () => core.RemoveReference(elemRef), elemRef.JobToken);
}

/// <summary>
/// Temporarily adds a <see cref="SetElement"/> using the provided string and position, or sets it if it already exists.
/// This method updates the <see cref="DisplayCore"/>.
/// </summary>
/// <param name="core">The <see cref="DisplayCore"/> to add the element to.</param>
/// <param name="content">The content of the element.</param>
/// <param name="position">The position of the element.</param>
/// <param name="time">How long to keep the element in the <see cref="DisplayCore"/> for.</param>
/// <param name="elemRef">The <see cref="TimedElemRef{T}"/> to use.</param>
public static void ShowTemp(this DisplayCore core, string content, float position, TimeSpan time, TimedElemRef<SetElement> elemRef)
public static void SetElemTemp(this DisplayCore core, string content, float position, TimeSpan time, TimedElemRef<SetElement> elemRef)
{
core.SetElementOrNew(elemRef, content, position);
core.Update();
Expand All @@ -67,13 +70,14 @@ public static void ShowTemp(this DisplayCore core, string content, float positio

/// <summary>
/// Temporarily adds a <see cref="SetElement"/> using the provided string and functional position, or sets it if it already exists.
/// This method updates the <see cref="DisplayCore"/>.
/// </summary>
/// <param name="core">The <see cref="DisplayCore"/> to add the element to.</param>
/// <param name="content">The content of the element.</param>
/// <param name="position">The position of the element.</param>
/// <param name="time">How long to keep the element in the <see cref="DisplayCore"/> for.</param>
/// <param name="elemRef">The <see cref="TimedElemRef{T}"/> to use.</param>
public static void ShowTempFunctional(this DisplayCore core, string content, float position, TimeSpan time, TimedElemRef<SetElement> elemRef)
public static void SetElemTempFunctional(this DisplayCore core, string content, float position, TimeSpan time, TimedElemRef<SetElement> elemRef)
{
core.SetElementOrNew(elemRef, content, Ruetility.FunctionalToScaledPosition(position));
core.Update();
Expand Down
14 changes: 0 additions & 14 deletions RueI/RueI/Extensions/ElementHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@
/// </summary>
public static class ElementHelpers
{
/// <summary>
/// Adds an <see cref="Element"/> to a <see cref="IElementContainer"/>.
/// </summary>
/// <typeparam name="T">The type of the <see cref="Element"/>.</typeparam>
/// <param name="element">The element to add.</param>
/// <param name="container">The <see cref="IElementContainer"/> to add to.</param>
/// <returns>A reference to this element.</returns>
public static T AddTo<T>(this T element, IElementContainer container)
where T : Element
{
element.AddTo(container.Elements);
return element;
}

/// <summary>
/// Filters out all of the disabled <see cref="Element"/>s in an <see cref="IEnumerable{T}"/>.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions RueI/RueI/Extensions/IEnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace RueI.Extensions;

using NorthwoodLib.Pools;

/// <summary>
/// Provides extensions for working with collections.
/// </summary>
Expand Down
51 changes: 0 additions & 51 deletions RueI/RueI/Extensions/Intersection.cs

This file was deleted.

24 changes: 18 additions & 6 deletions RueI/RueI/Extensions/ReflectionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,33 @@
public static class ReflectionHelpers
{
/// <summary>
/// Gets a <see cref="Action{T1, T2, T3, T4}"/> that can be used to add an element, with a <see cref="TimedElemRef{T}"/> as a closure.
/// Gets an <see cref="Action{T1, T2, T3, T4}"/> that can be used to add an element, with a <see cref="TimedElemRef{T}"/> as a closure.
/// </summary>
/// <returns>A <see cref="Action{T1, T2, T3, T4}"/> that can be used to add an element to a <see cref="ReferenceHub"/>.</returns>
/// <returns>An <see cref="Action{T1, T2, T3, T4}"/> that can be used to add an element to a <see cref="ReferenceHub"/>.</returns>
/// <remarks>
/// This method is not intended to be used when using RueI as a direct dependency.
/// Every time this method is called, it creates a new <see cref="TimedElemRef{T}"/>. Therefore, every delegate returned by this method
/// represents a unique 'element'.
/// </remarks>
public static Action<ReferenceHub, string, float, TimeSpan> GetElementShower()
{
TimedElemRef<SetElement> elemRef = new();
return (hub, content, name, span) => ShowTempFunctional(hub, content, name, span, elemRef);
return (hub, content, name, span) => SetElemTempFunctional(hub, content, name, span, elemRef);
}

private static void ShowTempFunctional(ReferenceHub hub, string content, float position, TimeSpan time, object elemRef)
/// <summary>
/// Gets a <see cref="Func{T}"/> that can be used to easily call <see cref="GetElementShower"/>.
/// </summary>
/// <returns>A <see cref="Func{T}"/> that itself returns an <see cref="Action{T1, T2, T3, T4}"/>.</returns>
/// <remarks>
/// The <see cref="Func{T}"/> returned by this method is identical to calling <see cref="GetElementShower"/>.
/// This method serves a helper to easily turn GetElementShower into a <see cref="Func{T}"/>, to make
/// reflection easier.
/// </remarks>
public static Func<Action<ReferenceHub, string, float, TimeSpan>> GetElemCreator() => GetElementShower;

private static void SetElemTempFunctional(ReferenceHub hub, string content, float position, TimeSpan time, TimedElemRef<SetElement> elemRef)
{
DisplayCore core = DisplayCore.Get(hub);
core.ShowTempFunctional(content, position, time, (TimedElemRef<SetElement>)elemRef);
core.SetElemTempFunctional(content, position, time, elemRef);
}
}
13 changes: 0 additions & 13 deletions RueI/docs.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<docs>
<emec>
<members name="updatetask">
<UpdateTask>
<example>
This example demonstrates simple usage of three UpdateTasks.

<code>

</code>
</example>
</UpdateTask>
</members>
</emec>
<displays>
<members name="roles">
<Roles>
Expand Down

0 comments on commit c3637a2

Please sign in to comment.