Skip to content

Commit

Permalink
Merge SCP:SL14 to Joker-PR
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 committed Dec 13, 2024
2 parents d73fa03 + 941aacd commit eb3580b
Show file tree
Hide file tree
Showing 57 changed files with 616 additions and 825 deletions.
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/SpawnableFaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ namespace Exiled.API.Enums
/// </summary>
public enum SpawnableFaction
{
/// <summary>
/// Represents no wave.
/// </summary>
None,

/// <summary>
/// Normal NTF wave.
/// </summary>
Expand Down
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
57 changes: 54 additions & 3 deletions EXILED/Exiled.API/Extensions/RoleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ namespace Exiled.API.Extensions
using System.Linq;

using Enums;
using Exiled.API.Features.Spawn;
using Features.Spawn;
using Footprinting;
using InventorySystem;
using InventorySystem.Configs;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using Respawning;
using Respawning.Waves;
using UnityEngine;

Expand Down Expand Up @@ -233,12 +234,62 @@ public static Dictionary<AmmoType, ushort> GetStartingAmmo(this RoleTypeId roleT
/// </summary>
/// <param name="waveBase">A <see cref="SpawnableWaveBase"/> instance.</param>
/// <returns><see cref="SpawnableFaction"/> associated with the wave.</returns>
public static SpawnableFaction GetFaction(this SpawnableWaveBase waveBase) => waveBase switch
public static SpawnableFaction GetSpawnableFaction(this SpawnableWaveBase waveBase) => waveBase switch
{
NtfSpawnWave => SpawnableFaction.NtfWave,
NtfMiniWave => SpawnableFaction.NtfMiniWave,
ChaosSpawnWave => SpawnableFaction.ChaosWave,
_ => SpawnableFaction.ChaosMiniWave
ChaosMiniWave => SpawnableFaction.ChaosMiniWave,
_ => SpawnableFaction.None
};

/// <summary>
/// Gets the <see cref="Faction"/> associated with the provided <see cref="SpawnableFaction"/>.
/// </summary>
/// <param name="spawnableFaction">A member of the <see cref="SpawnableFaction"/> enum.</param>
/// <returns><see cref="Faction"/> associated with the provided <paramref name="spawnableFaction"/>.</returns>
public static Faction GetFaction(this SpawnableFaction spawnableFaction) => spawnableFaction switch
{
SpawnableFaction.ChaosWave or SpawnableFaction.ChaosMiniWave => Faction.FoundationEnemy,
SpawnableFaction.NtfWave or SpawnableFaction.NtfMiniWave => Faction.FoundationStaff,
_ => Faction.Unclassified,
};

/// <summary>
/// Gets the <see cref="Faction"/> associated with the provided <see cref="SpawnableTeamType"/>.
/// </summary>
/// <param name="spawnableTeamType">A member of the <see cref="SpawnableTeamType"/>enum.</param>
/// <returns><see cref="Faction"/> associated with the provided <paramref name="spawnableTeamType"/>.</returns>
public static Faction GetFaction(this SpawnableTeamType spawnableTeamType) => spawnableTeamType switch
{
SpawnableTeamType.ChaosInsurgency => Faction.FoundationEnemy,
SpawnableTeamType.NineTailedFox => Faction.FoundationStaff,
_ => Faction.Unclassified,
};

/// <summary>
/// Tries to get the <see cref="SpawnableFaction"/> associated with the provided <see cref="SpawnableTeamType"/> and <see cref="bool"/>.
/// </summary>
/// <param name="faction">A member of the <see cref="Faction"/>enum.</param>
/// <param name="spawnableFaction">The <see cref="SpawnableFaction"/> to return.</param>
/// <param name="mini">A <see cref="bool"/> determining whether to get a normal spawn wave or a mini one.</param>
/// <returns><see cref="Faction"/> associated with the provided <paramref name="faction"/> influenced by <paramref name="mini"/>.</returns>
public static bool TryGetSpawnableFaction(this Faction faction, out SpawnableFaction spawnableFaction, bool mini = false)
{
switch (faction)
{
case Faction.FoundationStaff:
spawnableFaction = mini ? SpawnableFaction.NtfMiniWave : SpawnableFaction.NtfWave;
break;
case Faction.FoundationEnemy:
spawnableFaction = mini ? SpawnableFaction.ChaosMiniWave : SpawnableFaction.ChaosWave;
break;
default:
spawnableFaction = SpawnableFaction.None;
return false;
}

return true;
}
}
}
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 @@ -157,8 +157,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
7 changes: 6 additions & 1 deletion EXILED/Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ public ushort Serial
/// <summary>
/// Gets a value indicating whether this item is a weapon.
/// </summary>
public bool IsWeapon => this is Firearm;
public bool IsWeapon => this is Firearm || Type is ItemType.Jailbird or ItemType.MicroHID;

/// <summary>
/// Gets a value indicating whether or not this item is a firearm.
/// </summary>
public bool IsFirearm => this is Firearm;

/// <summary>
/// Gets a value indicating whether this item emits light.
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();
}
}
}
Loading

0 comments on commit eb3580b

Please sign in to comment.