Skip to content

Commit

Permalink
feat: Xmas 2024 from xmas 2023 (#325)
Browse files Browse the repository at this point in the history
* Scp 559 events (#2345)

* lots of new

new effects
956
559

* final

* fix

* idk

* Scp956Target

* Snowed

* doc

* scp559 events

* comments

* fix

* Update Exiled.Events/Handlers/Scp559.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp559/InteractingScp559EventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Interfaces/IScp559Event.cs

Co-authored-by: Nao <[email protected]>

* nao suggestions

* fix doc

---------

Co-authored-by: Yamato <[email protected]>
Co-authored-by: Yamato <[email protected]>
Co-authored-by: Nao <[email protected]>

* SCP-3114 ragdoll (#2368)

* scp 3114 ragdoll

* fux

* Fix docs

---------

Co-authored-by: Nao <[email protected]>

* Coffee API (#2360)

* coffee api

* comments

* Fix setter and grammar

---------

Co-authored-by: Yamato <[email protected]>
Co-authored-by: Nao <[email protected]>

* Flamingo respawn event (#2362)

* new ev

* remove test logs

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/Handlers/Scp1507.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/Handlers/Scp1507.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs

Co-authored-by: Nao <[email protected]>

* Update Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs

Co-authored-by: Nao <[email protected]>

* fix

---------

Co-authored-by: Nao <[email protected]>

* SpawnReason::ItemUsage

* Move File to the new place

* Lots of new API (#2342)

* lots of new

new effects
956
559

* final

* fix

* idk

* Scp956Target

* Snowed

* doc

---------

Co-authored-by: Yamato <[email protected]>

* revert

* push

* Finish Fix build

* fix AmbiguousMatchException

* FindingPosition Fixed

* OpeningGiftEvent

* GrantingGift Fix

* Fix SpawningFlamingos

* DamageType::Scp1507

* DamageType::Scp956

* SnowBall

* Fix NPC not spawning

* Flamingos

* Obsolete Coffee because nw didn't added it in game

* patch fixes and optimization

* flamingo event to right namespace

* or not

---------

Co-authored-by: VALERA771 <[email protected]>
Co-authored-by: Nao <[email protected]>
Co-authored-by: IRacle <[email protected]>
  • Loading branch information
4 people authored Dec 26, 2024
1 parent 7c73439 commit 1c7dca4
Show file tree
Hide file tree
Showing 39 changed files with 1,807 additions and 1 deletion.
15 changes: 15 additions & 0 deletions EXILED/Exiled.API/Enums/DamageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,20 @@ public enum DamageType
/// Damage caused by the marshmallow man.
/// </summary>
Marshmallow,

/// <summary>
/// Damage caused by <see cref="RoleTypeId.Flamingo"/> ,<see cref="RoleTypeId.AlphaFlamingo"/> or <see cref="RoleTypeId.ZombieFlamingo"/>.
/// </summary>
Scp1507,

/// <summary>
/// Damage caused by Scp956 the pinata.
/// </summary>
Scp956,

/// <summary>
/// Damage caused by <see cref="ItemType.Snowball"/>.
/// </summary>
SnowBall,
}
}
20 changes: 20 additions & 0 deletions EXILED/Exiled.API/Enums/EffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,25 @@ public enum EffectType
/// <see cref="CustomPlayerEffects.Blurred"/>.
/// </summary>
Blurred,

/// <summary>
/// Makes you a flamingo.
/// </summary>
BecomingFlamingo,

/// <summary>
/// Makes you a Child after eating Cake.
/// </summary>
Scp559,

/// <summary>
/// Scp956 found you.
/// </summary>
Scp956Target,

/// <summary>
/// you are snowed.
/// </summary>
Snowed,
}
}
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/SpawnReason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ public enum SpawnReason : byte // TOTO: Remove this file and use Basegame
/// The user will be destroyed.
/// </summary>
Destroyed,

/// <summary>
/// The user has been spawn by the usage of an Item.
/// </summary>
ItemUsage,
}
}
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Exiled.API.Extensions
using Enums;

using Features;
using PlayerRoles.PlayableScps.Scp1507;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerStatsSystem;

Expand Down Expand Up @@ -180,6 +181,12 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)
return DamageType.MicroHid;
case DisruptorDamageHandler:
return DamageType.ParticleDisruptor;
case Scp1507DamageHandler:
return DamageType.Scp1507;
case Scp956DamageHandler:
return DamageType.Scp956;
case SnowballDamageHandler:
return DamageType.SnowBall;
case Scp049DamageHandler scp049DamageHandler:
return scp049DamageHandler.DamageSubType switch
{
Expand Down
4 changes: 4 additions & 0 deletions EXILED/Exiled.API/Extensions/EffectTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public static class EffectTypeExtension
{ EffectType.SeveredEyes, typeof(SeveredEyes) },
{ EffectType.PitDeath, typeof(PitDeath) },
{ EffectType.Blurred, typeof(Blurred) },
{ EffectType.BecomingFlamingo, typeof(BecomingFlamingo) },
{ EffectType.Scp559, typeof(Scp559Effect) },
{ EffectType.Scp956Target, typeof(Scp956Target) },
{ EffectType.Snowed, typeof(Snowed) },
});

/// <summary>
Expand Down
120 changes: 120 additions & 0 deletions EXILED/Exiled.API/Features/Coffee.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// -----------------------------------------------------------------------
// <copyright file="Coffee.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features
{
using System;
using System.Collections.Generic;
using System.Linq;

using Exiled.API.Extensions;
using Exiled.API.Interfaces;
using UnityEngine;

using BaseCoffee = global::Coffee;

/// <summary>
/// A wrapper for coffee cup.
/// </summary>
public class Coffee : IWrapper<BaseCoffee>
{
/// <summary>
/// Gets the <see cref="Dictionary{TKey,TValue}"/> containing <see cref="BaseCoffee"/> to <see cref="Coffee"/>.
/// </summary>
internal static readonly Dictionary<BaseCoffee, Coffee> BaseToWrapper = new();

/// <summary>
/// Initializes a new instance of the <see cref="Coffee"/> class.
/// </summary>
/// <param name="coffee"><inheritdoc cref="Base"/></param>
public Coffee(BaseCoffee coffee)
{
Base = coffee;

BaseToWrapper.Add(coffee, this);
}

/// <summary>
/// Gets or sets an <see cref="IEnumerable{T}"/> of players who cannot interact with coffee cups.
/// </summary>
public static IEnumerable<Player> BlacklistedPlayers
{
get => BaseCoffee.BlacklistedPlayers.Select(Player.Get);
set
{
BaseCoffee.BlacklistedPlayers.Clear();

foreach (Player player in value)
BaseCoffee.BlacklistedPlayers.Add(player.ReferenceHub);
}
}

/// <summary>
/// Gets the list with all available <see cref="Coffee"/> instanses.
/// </summary>
[Obsolete("This list will be empty")]
public static IReadOnlyCollection<Coffee> List => BaseToWrapper.Values;

/// <summary>
/// Gets the base coffee instance.
/// </summary>
public BaseCoffee Base { get; }

/// <summary>
/// Gets or sets a value indicating whether or not coffee has been drunk.
/// </summary>
public bool IsConsumed
{
get => Base.IsConsumed;
set => Base.NetworkIsConsumed = value;
}

/// <summary>
/// Gets or sets text which will be displayed to player when he drinks coffee.
/// </summary>
public CoffeeTranslation CoffeeTranslation
{
get => Base._drinkText;
set => Base._drinkText = value;
}

/// <summary>
/// Gets or sets the author of current <see cref="CoffeeTranslation"/>.
/// </summary>
public string TranslationAuthor
{
get => Base._author;
set => Base._author = value;
}

/// <summary>
/// Gets the color of a drink in a cup.
/// </summary>
public Color DrinkColor => Base._drinkColor;

/// <summary>
/// Gets a <see cref="Coffee"/> given a <see cref="BaseCoffee"/> instance.
/// </summary>
/// <param name="baseCoffee">The <see cref="BaseCoffee"/> instance.</param>
/// <returns>The <see cref="Coffee"/> instance.</returns>
public static Coffee Get(BaseCoffee baseCoffee) => BaseToWrapper.TryGetValue(baseCoffee, out Coffee coffee) ? coffee : new(baseCoffee);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Coffee"/> matching the condition.
/// </summary>
/// <param name="predicate">The condition to satisfy.</param>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="Coffee"/> matching the condition.</returns>
[Obsolete("The respond list will be empty")]
public static IEnumerable<Coffee> Get(Func<Coffee, bool> predicate) => List.Where(predicate);

/// <summary>
/// Interacts with <see cref="Coffee"/>.
/// </summary>
/// <param name="player">The player who interacts. If <see langword="null"/>, it will be chosen randomly.</param>
public void Interact(Player player = null) => Base.ServerInteract((player ?? Player.Get(x => x.IsHuman).GetRandomValue()).ReferenceHub, byte.MaxValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Exiled.API.Features.DamageHandlers
using Enums;

using Extensions;
using PlayerRoles.PlayableScps.Scp1507;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.PlayableScps.Scp939;

Expand Down Expand Up @@ -116,6 +117,12 @@ public virtual DamageType Type
return DamageType.Scp939;
case JailbirdDamageHandler:
return DamageType.Jailbird;
case Scp1507DamageHandler:
return DamageType.Scp1507;
case Scp956DamageHandler:
return DamageType.Scp956;
case SnowballDamageHandler:
return DamageType.SnowBall;
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Expand Down
4 changes: 4 additions & 0 deletions EXILED/Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ internal static void ClearCache()
Firearm.ItemTypeToFirearmInstance.Clear();
Firearm.BaseCodesValue.Clear();
Firearm.AvailableAttachmentsValue.Clear();

Scp559.CakeToWrapper.Clear();

Coffee.BaseToWrapper.Clear();
}
}
}
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Scp3114Ragdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public bool IsPlayingAnimation
set => Base._playingAnimation = value;
}
}
}
}
136 changes: 136 additions & 0 deletions EXILED/Exiled.API/Features/Scp559.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// -----------------------------------------------------------------------
// <copyright file="Scp559.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features
{
using System;
using System.Collections.Generic;
using System.Linq;

using Exiled.API.Interfaces;
using MapGeneration;
using UnityEngine;

/// <summary>
/// Represents a cake.
/// </summary>
public class Scp559 : IWrapper<Scp559Cake>, IPosition
{
/// <summary>
/// <see cref="Dictionary{TKey,TValue}"/> <see cref="Scp559Cake"/> to <see cref="Scp559"/>.
/// </summary>
internal static readonly Dictionary<Scp559Cake, Scp559> CakeToWrapper = new();

/// <summary>
/// Initializes a new instance of the <see cref="Scp559"/> class.
/// </summary>
/// <param name="cakeBase">The <see cref="Scp559Cake"/> instance.</param>
public Scp559(Scp559Cake cakeBase)
{
Base = cakeBase;

CakeToWrapper.Add(cakeBase, this);
}

/// <summary>
/// Gets the list with all <see cref="Scp559"/> instances.
/// </summary>
public static IReadOnlyCollection<Scp559> List => CakeToWrapper.Values;

/// <summary>
/// Gets a <see cref="Dictionary{TKey,TValue}"/> with rooms and amount of people in them.
/// </summary>
public static Dictionary<Room, int> PopulatedRooms => Scp559Cake.PopulatedRooms.ToDictionary(x => Room.Get(x.Key), x => x.Value);

/// <summary>
/// Gets a <see cref="Dictionary{TKey,TValue}"/> with spawnpoint in rooms.
/// </summary>
public static Dictionary<RoomName, Vector4> SpawnPositions => Scp559Cake.Spawnpoints;

/// <summary>
/// Gets the list of all available spawnpoints.
/// </summary>
public static List<Vector4> AvailableSpawnpoints => Scp559Cake.PossiblePositions;

/// <summary>
/// Gets or sets offset for spawning near pedestals.
/// </summary>
public static Vector3 PedestalOffset
{
get => Scp559Cake.PedestalOffset;
set => Scp559Cake.PedestalOffset.Set(value.x, value.y, value.z);
}

/// <inheritdoc/>
public Scp559Cake Base { get; }

/// <summary>
/// Gets or sets how many slices are still on cake.
/// </summary>
public byte RemainingSlices
{
get => Base._remainingSlices;
set => Base.Network_remainingSlices = value;
}

/// <summary>
/// Gets or sets a value indicating whether or not cake is spawned.
/// </summary>
public bool IsSpawned
{
get => Base._isSpawned;
set => Base.Network_isSpawned = value;
}

/// <summary>
/// Gets or sets the time how much cake will still be usable.
/// </summary>
public float RemainingTime
{
get => Base._remainingTime;
set => Base._remainingTime = value;
}

/// <summary>
/// Gets or sets the minimum required time for cake to spawn.
/// </summary>
public float RespawnTime
{
get => Base._respawnTime;
set => Base._respawnTime = value;
}

/// <inheritdoc/>
public Vector3 Position
{
get => Base._position;
set => Base.Network_position = value;
}

/// <summary>
/// Gets the <see cref="Scp559"/> by it's game instance.
/// </summary>
/// <param name="cake">Game instance.</param>
/// <returns><see cref="Scp559"/>.</returns>
public static Scp559 Get(Scp559Cake cake) => CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);

/// <summary>
/// Gets the <see cref="IEnumerable{T}"/> of SCP-559 which matches the predicate.
/// </summary>
/// <param name="predicate">Predicate to match.</param>
/// <returns><see cref="IEnumerable{T}"/> of SCP-559.</returns>
public static IEnumerable<Scp559> Get(Func<Scp559, bool> predicate) => List.Where(predicate);

/// <summary>
/// Tries to get available spawn point for SCP-559.
/// </summary>
/// <param name="pos">Position of spawn.</param>
/// <param name="pedestal">Will be pedestal also spawned.</param>
/// <returns><see langword="true"/> if position was found. Otherwise, <see langword="false"/>.</returns>
public bool TryGetSpawnpoint(out Vector3 pos, out bool pedestal) => Base.TryGetSpawnPoint(out pos, out pedestal);
}
}
Loading

0 comments on commit 1c7dca4

Please sign in to comment.