Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions EXILED/Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ namespace Exiled.API.Extensions
using Features;
using Features.Pools;

using InventorySystem.Items.Firearms;

using Mirror;

using PlayerRoles;
Expand Down Expand Up @@ -453,38 +451,6 @@ public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vec
}
}

/// <summary>
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
/// </summary>
/// <param name="target">Target to send.</param>
/// <param name="behaviorOwner"><see cref="NetworkIdentity"/> of object that owns <see cref="NetworkBehaviour"/>.</param>
/// <param name="targetType"><see cref="NetworkBehaviour"/>'s type.</param>
/// <param name="propertyName">Property name starting with Network.</param>
/// <param name="value">Value of send to target.</param>
[Obsolete("Use overload with type-template instead.")]
public static void SendFakeSyncVar(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, object value)
{
if (!target.IsConnected)
return;

NetworkWriterPooled writer = NetworkWriterPool.Get();
NetworkWriterPooled writer2 = NetworkWriterPool.Get();
MakeCustomSyncWriter(behaviorOwner, targetType, null, CustomSyncVarGenerator, writer, writer2);
target.Connection.Send(new EntityStateMessage
{
netId = behaviorOwner.netId,
payload = writer.ToArraySegment(),
});

NetworkWriterPool.Return(writer);
NetworkWriterPool.Return(writer2);
void CustomSyncVarGenerator(NetworkWriter targetWriter)
{
targetWriter.WriteULong(SyncVarDirtyBits[$"{targetType.Name}.{propertyName}"]);
WriterExtensions[value.GetType()]?.Invoke(null, new object[2] { targetWriter, value });
}
}

/// <summary>
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions EXILED/Exiled.API/Features/Items/Firearm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ public int MaxAmmo
/// </summary>
public bool FlashlightEnabled => Base.IsEmittingLight;

// TODO NOT FINISH

/// <summary>
/// Gets a value indicating whether the firearm's NightVision is being used.
/// </summary>
Expand Down
39 changes: 3 additions & 36 deletions EXILED/Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,20 @@ namespace Exiled.API.Features
using System.Collections.ObjectModel;
using System.Linq;

using Decals;
using Enums;
using Exiled.API.Extensions;
using Exiled.API.Features.Hazards;
using Exiled.API.Features.Lockers;
using Exiled.API.Features.Pickups;
using Exiled.API.Features.Toys;
using global::Hazards;
using InventorySystem;
using InventorySystem.Items.Firearms;
using InventorySystem.Items.Firearms.BasicMessages;
using InventorySystem.Items.Pickups;
using InventorySystem.Items.ThrowableProjectiles;
using Items;
using LightContainmentZoneDecontamination;
using MapGeneration;
using MapGeneration.Distributors;
using PlayerRoles.PlayableScps.Scp939;
using PlayerRoles.Ragdolls;
using RelativePositioning;
using UnityEngine;
using Utils;
using Utils.Networking;

using Object = UnityEngine.Object;

Expand All @@ -53,16 +44,6 @@ public static class Map

private static SqueakSpawner squeakSpawner;

/// <summary>
/// Gets the tantrum prefab.
/// </summary>
public static TantrumEnvironmentalHazard TantrumPrefab => TantrumHazard.TantrumPrefab; // TODO: Remove this.

/// <summary>
/// Gets the amnestic cloud prefab.
/// </summary>
public static Scp939AmnesticCloudInstance AmnesticCloudPrefab => AmnesticCloudHazard.AmnesticCloudPrefab; // TODO: Remove this.

/// <summary>
/// Gets a value indicating whether decontamination has begun in the light containment zone.
/// </summary>
Expand All @@ -80,11 +61,6 @@ DecontaminationController.Singleton.NetworkDecontaminationOverride is Decontamin
/// </summary>
public static ReadOnlyCollection<PocketDimensionTeleport> PocketDimensionTeleports { get; } = TeleportsValue.AsReadOnly();

/// <summary>
/// Gets all <see cref="AdminToy"/> objects.
/// </summary>
public static ReadOnlyCollection<AdminToy> Toys => AdminToy.BaseToAdminToy.Values.ToList().AsReadOnly(); // TODO: Obsolete it and make people use AdminToy.List

/// <summary>
/// Gets or sets the current seed of the map.
/// </summary>
Expand Down Expand Up @@ -249,15 +225,6 @@ public static void PlayAmbientSound(int id)
AmbientSoundPlayer.RpcPlaySound(AmbientSoundPlayer.clips[id].index);
}

/// <summary>
/// Places a Tantrum (SCP-173's ability) in the indicated position.
/// </summary>
/// <param name="position">The position where you want to spawn the Tantrum.</param>
/// <param name="isActive">Whether the tantrum will apply the <see cref="EffectType.Stained"/> effect.</param>
/// <remarks>If <paramref name="isActive"/> is <see langword="true"/>, the tantrum is moved slightly up from its original position. Otherwise, the collision will not be detected and the slowness will not work.</remarks>
/// <returns>The <see cref="TantrumHazard"/> instance.</returns>
public static TantrumHazard PlaceTantrum(Vector3 position, bool isActive = true) => TantrumHazard.PlaceTantrum(position, isActive); // TODO: Remove this.

/// <summary>
/// Destroy all <see cref="ItemPickupBase"/> objects.
/// </summary>
Expand Down Expand Up @@ -397,9 +364,9 @@ internal static void ClearCache()

Ragdoll.BasicRagdollToRagdoll.Clear();

Items.Firearm.ItemTypeToFirearmInstance.Clear();
Items.Firearm.BaseCodesValue.Clear();
Items.Firearm.AvailableAttachmentsValue.Clear();
Firearm.ItemTypeToFirearmInstance.Clear();
Firearm.BaseCodesValue.Clear();
Firearm.AvailableAttachmentsValue.Clear();
}
}
}
43 changes: 8 additions & 35 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,6 @@ private set
/// </summary>
public bool HasHint => CurrentHint != null;

/// <summary>
/// Gets the <see cref="ReferenceHub"/>'s <see cref="VoiceModule"/>, can be null.
/// </summary>
[Obsolete("Use IVoiceRole::VoiceModule instead.")]
public VoiceModuleBase VoiceModule => Role is Roles.IVoiceRole voiceRole ? voiceRole.VoiceModule : null;

/// <summary>
/// Gets the <see cref="ReferenceHub"/>'s <see cref="PersonalRadioPlayback"/>, can be null.
/// </summary>
Expand Down Expand Up @@ -680,11 +674,16 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences
public bool IsDead => Role?.IsDead ?? false;

/// <summary>
/// Gets a value indicating whether the player's <see cref="RoleTypeId"/> is any NTF rank.
/// Gets a value indicating whether the player's <see cref="RoleTypeId"/> is any Foundation Forces.
/// Equivalent to checking the player's <see cref="Team"/>.
/// </summary>
public bool IsFoundationForces => Role?.Team is Team.FoundationForces;

/// <summary>
/// Gets a value indicating whether the player's <see cref="RoleTypeId"/> is any NTF rank and not a Facility Guard.
/// Equivalent to checking the player's <see cref="Team"/>.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this line

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is wrong there?

/// </summary>
// TODO: Change logic for FacilityGuard in next major update
public bool IsNTF => Role?.Team is Team.FoundationForces;
public bool IsNTF => Role?.Team is Team.FoundationForces && Role?.Type is not RoleTypeId.FacilityGuard;

/// <summary>
/// Gets a value indicating whether the player's <see cref="RoleTypeId"/> is any Chaos rank.
Expand Down Expand Up @@ -1479,16 +1478,6 @@ public static Player Get(string args)
/// <returns>An <see cref="IEnumerable{Player}"/> representing the processed players.</returns>
public static IEnumerable<Player> GetProcessedData(ArraySegment<string> args, int startIndex = 0) => GetProcessedData(args, startIndex, out string[] _);

/// <summary>
/// Adds a player's UserId to the list of reserved slots.
/// </summary>
/// <remarks>This method does not permanently give a user a reserved slot. The slot will be removed if the reserved slots are reloaded.</remarks>
/// <param name="userId">The UserId of the player to add.</param>
/// <returns><see langword="true"/> if the slot was successfully added, or <see langword="false"/> if the provided UserId already has a reserved slot.</returns>
/// <seealso cref="GiveReservedSlot()"/>
// TODO: Remove this method
public static bool AddReservedSlot(string userId) => ReservedSlot.Users.Add(userId);

/// <summary>
/// Adds a player's UserId to the list of reserved slots.
/// </summary>
Expand Down Expand Up @@ -1541,15 +1530,6 @@ public static bool AddToWhitelist(string userId, bool isPermanent)
/// </summary>
public static void ReloadWhitelist() => WhiteList.Reload();

/// <summary>
/// Adds the player's UserId to the list of reserved slots.
/// </summary>
/// <remarks>This method does not permanently give a user a reserved slot. The slot will be removed if the reserved slots are reloaded.</remarks>
/// <returns><see langword="true"/> if the slot was successfully added, or <see langword="false"/> if the player already has a reserved slot.</returns>
/// <seealso cref="AddReservedSlot(string)"/>
// TODO: Remove this method
public bool GiveReservedSlot() => AddReservedSlot(UserId);

/// <summary>
/// Adds a player's UserId to the list of reserved slots.
/// </summary>
Expand Down Expand Up @@ -3234,13 +3214,6 @@ public void EnableEffect(EffectType type, float duration = 0f, bool addDurationI
public bool EnableEffect(EffectType type, byte intensity, float duration = 0f, bool addDurationIfActive = false)
=> TryGetEffect(type, out StatusEffectBase statusEffect) && EnableEffect(statusEffect, intensity, duration, addDurationIfActive);

/// <summary>
/// Enables a <see cref="Effect">status effect</see> on the player.
/// </summary>
/// <param name="effect">The <see cref="Effect"/> to enable.</param>
[Obsolete("Use SyncEffect(Effect) instead of this")]
public void EnableEffect(Effect effect) => SyncEffect(effect);

/// <summary>
/// Syncs the <see cref="Effect">status effect</see> on the player.
/// </summary>
Expand Down
21 changes: 0 additions & 21 deletions EXILED/Exiled.API/Features/Respawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,6 @@ public static Faction NextKnownFaction
/// </summary>
public static SpawnableTeamType NextKnownTeam => NextKnownFaction.GetSpawnableTeam();

/* TODO: Possibly moved to TimedWave
/// <summary>
/// Gets or sets the amount of seconds before the next respawn phase will occur.
/// </summary>
public static float TimeUntilNextPhase
{
get => RespawnManager.Singleton._timeForNextSequence - (float)RespawnManager.Singleton._stopwatch.Elapsed.TotalSeconds
set => RespawnManager.Singleton._timeForNextSequence = (float)RespawnManager.Singleton._stopwatch.Elapsed.TotalSeconds + value;
}

/// <summary>
/// Gets a <see cref="TimeSpan"/> indicating the amount of time before the next respawn wave will occur.
/// </summary>
public static TimeSpan TimeUntilSpawnWave => TimeSpan.FromSeconds(TimeUntilNextPhase);

/// <summary>
/// Gets a <see cref="DateTime"/> indicating the moment in UTC time the next respawn wave will occur.
/// </summary>
public static DateTime NextTeamTime => DateTime.UtcNow.AddSeconds(TimeUntilSpawnWave.TotalSeconds);
*/

/// <summary>
/// Gets the current state of the <see cref="WaveManager"/>.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Toys/Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public static Light Create(Vector3? position /*= null*/, Vector3? rotation /*= n
/// <returns>The corresponding <see cref="LightSourceToy"/> instance.</returns>
public static Light Get(LightSourceToy lightSourceToy)
{
AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == lightSourceToy);
return adminToy is not null ? adminToy as Light : new Light(lightSourceToy);
AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == lightSourceToy);
return adminToy is not null ? adminToy as Light : new(lightSourceToy);
}
}
}
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Toys/Primitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static Primitive Create(PrimitiveSettings primitiveSettings)
/// <returns>The corresponding <see cref="Primitive"/> instance.</returns>
public static Primitive Get(PrimitiveObjectToy primitiveObjectToy)
{
AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == primitiveObjectToy);
AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == primitiveObjectToy);
return adminToy is not null ? adminToy as Primitive : new(primitiveObjectToy);
}
}
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public static ShootingTargetToy Create(ShootingTargetType type, Vector3? positio
/// <returns>The corresponding <see cref="ShootingTargetToy"/> instance.</returns>
public static ShootingTargetToy Get(ShootingTarget shootingTarget)
{
AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == shootingTarget);
AdminToy adminToy = List.FirstOrDefault(x => x.AdminToyBase == shootingTarget);
return adminToy is not null ? adminToy as ShootingTargetToy : new(shootingTarget);
}

Expand Down
17 changes: 4 additions & 13 deletions EXILED/Exiled.API/Features/Waves/TimedWave.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright file="TimedWave.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
Expand Down Expand Up @@ -30,10 +30,7 @@ public class TimedWave
/// <param name="wave">
/// The <see cref="TimeBasedWave"/> that this class should be based off of.
/// </param>
public TimedWave(TimeBasedWave wave)
{
timedWave = wave;
}
public TimedWave(TimeBasedWave wave) => timedWave = wave;

/// <summary>
/// Gets the name of the wave timer.
Expand Down Expand Up @@ -166,10 +163,7 @@ public static List<TimedWave> GetTimedWaves()
/// <summary>
/// Destroys this wave.
/// </summary>
public void Destroy()
{
timedWave.Destroy();
}
public void Destroy() => timedWave.Destroy();

/// <summary>
/// Populates this wave with the specified amount of roles.
Expand All @@ -180,9 +174,6 @@ public void Destroy()
/// <param name="amount">
/// The amount of people to populate.
/// </param>
public void PopulateQueue(Queue<RoleTypeId> queue, int amount)
{
timedWave.PopulateQueue(queue, amount);
}
public void PopulateQueue(Queue<RoleTypeId> queue, int amount) => timedWave.PopulateQueue(queue, amount);
}
}
Loading