Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Chamber.IsOpen #335

Merged
merged 16 commits into from
Dec 27, 2024
1 change: 1 addition & 0 deletions EXILED/Exiled.API/Exiled.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<Reference Include="UnityEngine.CoreModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.CoreModule.dll" Private="false" />
<Reference Include="UnityEngine.ParticleSystemModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.ParticleSystemModule.dll" Private="false" />
<Reference Include="UnityEngine.PhysicsModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.PhysicsModule.dll" Private="false" />
<Reference Include="UnityEngine.AudioModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.AudioModule.dll" Private="false" />
Rysik5318 marked this conversation as resolved.
Show resolved Hide resolved
<Reference Include="YamlDotNet" HintPath="$(EXILED_REFERENCES)\YamlDotNet.dll" Private="false" />
</ItemGroup>

Expand Down
12 changes: 10 additions & 2 deletions EXILED/Exiled.API/Features/Lockers/Chamber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,17 @@ public float Cooldown
}

/// <summary>
/// Gets a value indicating whether the chamber is currently open.
/// Gets or sets a value indicating whether the chamber is currently open.
/// </summary>
public bool IsOpen => Base.IsOpen;
public bool IsOpen
{
get => Base.IsOpen;
set
{
Base.SetDoor(value, null);
Locker.Base.RefreshOpenedSyncvar();
}
}

/// <summary>
/// Gets the id of this chamber in <see cref="Locker"/>.
Expand Down
11 changes: 10 additions & 1 deletion EXILED/Exiled.API/Features/Lockers/Locker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ public Locker(BaseLocker locker)
/// </summary>
public IReadOnlyCollection<Chamber> Chambers { get; }

/// <summary>
/// Gets or sets a value indicating whether the locker is currently open.
/// </summary>
public bool IsOpen
{
get => Chambers.First().IsOpen;
set => Chambers.First().IsOpen = value;
}

louis1706 marked this conversation as resolved.
Show resolved Hide resolved
/// <summary>
/// Gets or sets an id for manipulating opened chambers.
/// </summary>
Expand Down Expand Up @@ -177,7 +186,7 @@ public void AddItem(Pickup item)
: chamber.Spawnpoint;

// If the chamber is open, immediately set the item's parent and spawn it.
if (chamber.Base.IsOpen)
if (chamber.IsOpen)
{
item.Transform.SetParent(parentTransform);
item.Spawn();
Expand Down
2 changes: 1 addition & 1 deletion EXILED/docs/articles/SCPSLRessources/NW_Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5019,4 +5019,4 @@ PlayerRoles.PlayableScps.Scp939.Scp939DamageHandler : AttackerDamageHandler
PlayerRoles.PlayableScps.Scp3114.Scp3114DamageHandler : AttackerDamageHandler

```
</details>
</details>
Loading