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
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/AdminToyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ public enum AdminToyType
/// ShootingTarget toy.
/// </summary>
ShootingTarget,

/// <summary>
/// Speaker toy.
/// </summary>
Speaker,
}
}
22 changes: 21 additions & 1 deletion EXILED/Exiled.API/Enums/EffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum EffectType
/// <summary>
/// This EffectType do not exist it's only use when not found or error.
/// </summary>
None = -1, // TODO: remove = -1
None,

/// <summary>
/// The player isn't able to open their inventory or reload a weapon.
Expand Down Expand Up @@ -239,5 +239,25 @@ public enum EffectType
/// <see cref="CustomPlayerEffects.Slowness"/>.
/// </summary>
Slowness,

/// <summary>
/// <see cref="CustomPlayerEffects.Scp1344"/>.
/// </summary>
Scp1344,

/// <summary>
/// <see cref="CustomPlayerEffects.SeveredEyes"/>.
/// </summary>
SeveredEyes,

/// <summary>
/// <see cref="CustomPlayerEffects.PitDeath"/>.
/// </summary>
PitDeath,

/// <summary>
/// <see cref="CustomPlayerEffects.Blurred"/>.
/// </summary>
Blurred,
}
}
11 changes: 3 additions & 8 deletions EXILED/Exiled.API/Enums/RespawnEffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@ namespace Exiled.API.Enums
/// </summary>
/// <seealso cref="Respawn.PlayEffect(RespawnEffectType)"/>
/// <seealso cref="Respawn.PlayEffects(RespawnEffectType[])"/>
public enum RespawnEffectType : byte
public enum RespawnEffectType
{
/// <summary>
/// Plays the <see cref="Side.ChaosInsurgency"/> music to alive <see cref="RoleTypeId.ClassD"/> and <see cref="Side.ChaosInsurgency"/>.
/// </summary>
PlayChaosInsurgencyMusic = 0,

/// <summary>
/// Summons the <see cref="Side.ChaosInsurgency"/> van.
/// </summary>
SummonChaosInsurgencyVan = 128,
SummonChaosInsurgencyVan,

/// <summary>
/// Summons the NTF chopper.
/// </summary>
SummonNtfChopper = 129,
SummonNtfChopper,
}
}
6 changes: 0 additions & 6 deletions EXILED/Exiled.API/Enums/SpawnLocationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,5 @@ public enum SpawnLocationType
/// Just inside the door at the bottom of the server's room.
/// </summary>
InsideServersBottom,

/// <summary>
/// Inside a random locker on the map.
/// </summary>
[Obsolete("Use LockerSpawnPoint instead")]
InsideLocker,
}
}
35 changes: 35 additions & 0 deletions EXILED/Exiled.API/Enums/SpawnableFaction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// -----------------------------------------------------------------------
// <copyright file="SpawnableFaction.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Enums
{
/// <summary>
/// All spawnable factions.
/// </summary>
public enum SpawnableFaction
{
/// <summary>
/// Normal NTF wave.
/// </summary>
NtfWave,

/// <summary>
/// Normal Chaos wave.
/// </summary>
ChaosWave,

/// <summary>
/// Mini NTF wave.
/// </summary>
NtfMiniWave,

/// <summary>
/// Mini Chaos wave.
/// </summary>
ChaosMiniWave,
}
}
8 changes: 6 additions & 2 deletions EXILED/Exiled.API/Extensions/EffectTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static class EffectTypeExtension
{ EffectType.AmnesiaVision, typeof(AmnesiaVision) },
{ EffectType.Asphyxiated, typeof(Asphyxiated) },
{ EffectType.Bleeding, typeof(Bleeding) },
{ EffectType.Blinded, typeof(Blinded) },
{ EffectType.Blinded, typeof(Blindness) },
{ EffectType.BodyshotReduction, typeof(BodyshotReduction) },
{ EffectType.Burned, typeof(Burned) },
{ EffectType.CardiacArrest, typeof(CardiacArrest) },
Expand Down Expand Up @@ -74,6 +74,10 @@ public static class EffectTypeExtension
{ EffectType.Ghostly, typeof(Ghostly) },
{ EffectType.FogControl, typeof(FogControl) },
{ EffectType.Slowness, typeof(Slowness) },
{ EffectType.Scp1344, typeof(Scp1344) },
{ EffectType.SeveredEyes, typeof(SeveredEyes) },
{ EffectType.PitDeath, typeof(PitDeath) },
{ EffectType.Blurred, typeof(Blurred) },
});

/// <summary>
Expand Down Expand Up @@ -146,7 +150,7 @@ or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage o
/// <param name="effect">The <see cref="EffectType"/>.</param>
/// <returns>Whether the effect heals.</returns>
/// <seealso cref="IsHarmful(EffectType)"/>
public static bool IsHealing(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IHealablePlayerEffect).IsAssignableFrom(type);
public static bool IsHealing(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IHealableEffect).IsAssignableFrom(type);

/// <summary>
/// Returns whether the provided <paramref name="effect"/> is a negative effect.
Expand Down
13 changes: 11 additions & 2 deletions EXILED/Exiled.API/Extensions/ItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Exiled.API.Extensions
using InventorySystem;
using InventorySystem.Items;
using InventorySystem.Items.Firearms.Attachments;
using InventorySystem.Items.Firearms.Modules;
using InventorySystem.Items.Pickups;
using Structs;

Expand Down Expand Up @@ -123,12 +124,12 @@ public static T GetItemBase<T>(this ItemType type)
/// </summary>
/// <param name="item">The <see cref="FirearmType">weapon</see> that you want to get maximum of.</param>
/// <returns>Returns the maximum.</returns>
public static byte GetMaxAmmo(this FirearmType item)
public static int GetMaxAmmo(this FirearmType item)
{
if (!InventoryItemLoader.AvailableItems.TryGetValue(item.GetItemType(), out ItemBase itemBase) || itemBase is not InventorySystem.Items.Firearms.Firearm firearm)
return 0;

return firearm.AmmoManagerModule.MaxAmmo;
return (firearm.Modules.FirstOrDefault(x => x is IAmmoContainerModule) as IAmmoContainerModule).AmmoMax;
}

/// <summary>
Expand Down Expand Up @@ -323,5 +324,13 @@ public static uint GetBaseCode(this FirearmType type)
/// <param name="type">The <see cref="ItemType"/> to check.</param>
/// <returns><see cref="ItemCategory"/> of the specified <see cref="ItemType"/>.</returns>
public static ItemCategory GetCategory(this ItemType type) => GetItemBase(type).Category;

/// <summary>
/// Checks if the specified <see cref="Firearm"/> has the specified <see cref="AttachmentName"/>.
/// </summary>
/// <param name="firearm">Weapon to check.</param>
/// <param name="attachment">Attachment to check.</param>
/// <returns><c>true</c> if weapon has the specified attachment. Otherwise, <c>false</c>.</returns>
public static bool HasAttachment(this Firearm firearm, AttachmentName attachment) => firearm.Attachments.FirstOrDefault(x => x.Name == attachment)?.IsEnabled ?? false;
}
}
17 changes: 4 additions & 13 deletions EXILED/Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static ReadOnlyDictionary<string, string> RpcFullNames
/// Plays a beep sound that only the target <paramref name="player"/> can hear.
/// </summary>
/// <param name="player">Target to play sound to.</param>
public static void PlayBeepSound(this Player player) => SendFakeTargetRpc(player, ReferenceHub.HostHub.networkIdentity, typeof(AmbientSoundPlayer), nameof(AmbientSoundPlayer.RpcPlaySound), 7);
public static void PlayBeepSound(this Player player) => SendFakeTargetRpc(player, ReferenceHub._hostHub.networkIdentity, typeof(AmbientSoundPlayer), nameof(AmbientSoundPlayer.RpcPlaySound), 7);

/// <summary>
/// Set <see cref="Player.CustomInfo"/> on the <paramref name="target"/> player that only the <paramref name="player"/> can see.
Expand All @@ -171,6 +171,8 @@ public static ReadOnlyDictionary<string, string> RpcFullNames
/// <param name="audioClipId">GunAudioMessage's audioClipId to set (default = 0).</param>
public static void PlayGunSound(this Player player, Vector3 position, ItemType itemType, byte volume, byte audioClipId = 0)
{
// TODO: Not finish
/*
GunAudioMessage message = new()
{
Weapon = itemType,
Expand All @@ -180,7 +182,7 @@ public static void PlayGunSound(this Player player, Vector3 position, ItemType i
ShooterPosition = new RelativePosition(position),
};

player.Connection.Send(message);
player.Connection.Send(message);*/
}

/// <summary>
Expand Down Expand Up @@ -222,17 +224,6 @@ public static void SetName(this Player target, Player player, string name)
target.SendFakeSyncVar(player.NetworkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_displayName), name);
}

/// <summary>
/// Sets <see cref="Room"/> of a <paramref name="room"/> that only the <paramref name="target"/> player can see.
/// </summary>
/// <param name="room">Room to modify.</param>
/// <param name="target">Only this player can see room color.</param>
/// <param name="multiplier">Light intensity multiplier to set.</param>
[Obsolete("This features has been remove by NW", true)]
public static void SetRoomLightIntensityForTargetOnly(this Room room, Player target, float multiplier)
{
}

/// <summary>
/// Change <see cref="Player"/> character model for appearance.
/// It will continue until <see cref="Player"/>'s <see cref="RoleTypeId"/> changes.
Expand Down
15 changes: 14 additions & 1 deletion EXILED/Exiled.API/Extensions/RoleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Exiled.API.Extensions
using InventorySystem.Configs;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;

using Respawning.Waves;
using UnityEngine;

using Team = PlayerRoles.Team;
Expand Down Expand Up @@ -210,5 +210,18 @@ public static Dictionary<AmmoType, ushort> GetStartingAmmo(this RoleTypeId roleT

return info.Ammo.ToDictionary(kvp => kvp.Key.GetAmmoType(), kvp => kvp.Value);
}

/// <summary>
/// Gets the <see cref="SpawnableFaction"/> of a <see cref="SpawnableWaveBase"/>.
/// </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
{
NtfSpawnWave => SpawnableFaction.NtfWave,
NtfMiniWave => SpawnableFaction.NtfMiniWave,
ChaosSpawnWave => SpawnableFaction.ChaosWave,
_ => SpawnableFaction.ChaosMiniWave
};
}
}
6 changes: 4 additions & 2 deletions EXILED/Exiled.API/Features/Components/CollisionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ private void OnCollisionEnter(Collision collision)
Log.Error("Grenade is null!");
if (collision is null)
Log.Error("wat");
if (collision.gameObject == null)
if (collision.collider)
Log.Error("water");
if (collision.collider.gameObject == null)
Log.Error("pepehm");
if (collision.gameObject == Owner || collision.gameObject.TryGetComponent<EffectGrenade>(out _))
if (collision.collider.gameObject == Owner || collision.collider.gameObject.TryGetComponent<EffectGrenade>(out _))
return;

Grenade.TargetTime = 0.1f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CustomDamageHandler(Player target, Player attacker, float damage, DamageT
Base = { Owner = attacker.ReferenceHub },
};

CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler(firearm.Base, damage));
CustomBase = new FirearmDamageHandler(firearm, target, new PlayerStatsSystem.FirearmDamageHandler() { Firearm = firearm.Base, Damage = damage });
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ namespace Exiled.API.Features.DamageHandlers
using Enums;

using Footprinting;

using Items;

using PlayerRoles.PlayableScps.Scp096;
using PlayerRoles.PlayableScps.Scp939;

using PlayerStatsSystem;

using UnityEngine;

/// <summary>
Expand Down Expand Up @@ -113,7 +111,7 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage
Base = new MicroHidDamageHandler(microHidOwner, damage);
break;
case DamageType.Explosion:
Base = new ExplosionDamageHandler(attacker.Footprint, UnityEngine.Vector3.zero, damage, 0);
Base = new ExplosionDamageHandler(attacker.Footprint, UnityEngine.Vector3.zero, damage, 0, ExplosionType.Grenade);
break;
case DamageType.Firearm:
GenericFirearm(player, attacker, damage, damageType, ItemType.GunAK);
Expand Down Expand Up @@ -155,7 +153,7 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage
GenericFirearm(player, attacker, damage, damageType, ItemType.GunA7);
break;
case DamageType.ParticleDisruptor:
Base = new DisruptorDamageHandler(Attacker, damage);
Base = new DisruptorDamageHandler(new (Item.Create(ItemType.ParticleDisruptor, attacker).Base as InventorySystem.Items.Firearms.Firearm, InventorySystem.Items.Firearms.Modules.DisruptorActionModule.FiringState.FiringSingle), Vector3.up, damage);
break;
case DamageType.Scp096:
Scp096Role curr096 = attacker.ReferenceHub.roleManager.CurrentRole as Scp096Role ?? new Scp096Role();
Expand Down Expand Up @@ -259,7 +257,7 @@ private void GenericFirearm(Player player, Player attacker, float amount, Damage
Owner = attacker.ReferenceHub,
},
};
Base = new PlayerStatsSystem.FirearmDamageHandler(firearm.Base, amount);
Base = new PlayerStatsSystem.FirearmDamageHandler() { Firearm = firearm.Base, Damage = amount };
}
}
}
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ private DoorType GetDoorType()
},
"Elevator" => (Base as Interactables.Interobjects.ElevatorDoor)?.Group switch
{
ElevatorGroup.Nuke => DoorType.ElevatorNuke,
ElevatorGroup.Nuke01 or ElevatorGroup.Nuke02 => DoorType.ElevatorNuke,
ElevatorGroup.Scp049 => DoorType.ElevatorScp049,
ElevatorGroup.GateB => DoorType.ElevatorGateB,
ElevatorGroup.GateA => DoorType.ElevatorGateA,
Expand Down
30 changes: 17 additions & 13 deletions EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Exiled.API.Features.Doors

using Exiled.API.Enums;
using Interactables.Interobjects;
using Interactables.Interobjects.DoorUtils;
using UnityEngine;

/// <summary>
/// Represents an elevator door.
Expand All @@ -28,6 +30,8 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List<Room> r
{
Base = door;
Lift = Lift.Get(x => x.Group == Group).FirstOrDefault();

Panel = Object.FindObjectsOfType<ElevatorPanel>().FirstOrDefault(x => x._door == door);
}

/// <summary>
Expand All @@ -36,29 +40,29 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List<Room> r
public new Interactables.Interobjects.ElevatorDoor Base { get; }

/// <summary>
/// Gets the <see cref="ElevatorManager.ElevatorGroup"/> that this door's <see cref="Lift"/> belongs to.
/// Gets the <see cref="ElevatorGroup"/> that this door's <see cref="Lift"/> belongs to.
/// </summary>
public ElevatorGroup Group => Base.Group;

/// <summary>
/// Gets the <see cref="ElevatorPanel"/> associated with this lift.
/// </summary>
public ElevatorManager.ElevatorGroup Group => Base.Group;
public ElevatorPanel Panel { get; }

/// <summary>
/// Gets the type according to <see cref="Group"/>.
/// </summary>
public ElevatorType ElevatorType => Group switch
{
ElevatorManager.ElevatorGroup.Scp049 => ElevatorType.Scp049,
ElevatorManager.ElevatorGroup.GateA => ElevatorType.GateA,
ElevatorManager.ElevatorGroup.GateB => ElevatorType.GateB,
ElevatorManager.ElevatorGroup.LczA01 or ElevatorManager.ElevatorGroup.LczA02 => ElevatorType.LczA,
ElevatorManager.ElevatorGroup.LczB01 or ElevatorManager.ElevatorGroup.LczB02 => ElevatorType.LczB,
ElevatorManager.ElevatorGroup.Nuke => ElevatorType.Nuke,
ElevatorGroup.Scp049 => ElevatorType.Scp049,
ElevatorGroup.GateA => ElevatorType.GateA,
ElevatorGroup.GateB => ElevatorType.GateB,
ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => ElevatorType.LczA,
ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => ElevatorType.LczB,
ElevatorGroup.Nuke01 or ElevatorGroup.Nuke02 => ElevatorType.Nuke,
_ => ElevatorType.Unknown,
};

/// <summary>
/// Gets the target panel for this lift.
/// </summary>
public ElevatorPanel Panel => Base.TargetPanel;

/// <summary>
/// Gets the <see cref="Lift"/> associated with this elevator door.
/// </summary>
Expand Down
Loading