Skip to content

Commit 21f51a2

Browse files
Jesus-QCVALERA771louis1706IRacle1YongAn404
authored
8.12 (#107)
* uwu (#5) * AdminToy.List (#18) * AdminToy.List * Better AdminToy::Get() * Update EXILED/Exiled.API/Features/Toys/AdminToy.cs Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> * TODO * Fix Error * Fix2 --------- Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> * Fix `Jailbird::WearState` (#12) * Jailbird * Fix * Exception * Fix NW moment * Porting EXILED9 RespawnedTeam event. by.VALERA771 (#27) Exiled-Team/EXILED#2386 * Fix not returning null (#22) * Fix not returning null * Apply suggestions from code review Co-authored-by: Jesus QC <69375249+Jesus-QC@users.noreply.github.com> * Little modification --------- Co-authored-by: Jesus QC <69375249+Jesus-QC@users.noreply.github.com> * RecontainedEventArgs more feature (#20) * RecontainedEventArgs more feature * Fix Naming * grammar * Update RecontainedEventArgs.cs --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * InteractingScp330.cs: Reduction of bloat code from original design. (#30) * Should reduce bloat code that was required years ago. * Should reduce bloat code that was required years ago. * Added back per Yamato's request --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * IScp330Event (#11) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * PR than i made (#9) * PR made by me Thanks Ika for the Help on CustomAmmo/CategoryLimit Co-Authored-By: Ika <36999341+IkaOverride@users.noreply.github.com> * Build error * Added support to SCPs for escaping-related events. * spacing * LocalReporting Exiled should be call before NWAPI * Optimising / More documentation on SpawningItem * ISpawnableScp * Use of ComponentsEqualityComparer for Dictionary --------- Co-authored-by: Ika <36999341+IkaOverride@users.noreply.github.com> * [Events] Fix null reference (#15) * fix situation when `ply == null` * lol why --------- Co-authored-by: IRacle <zornik2006@yandex.ru> * Offline mode support (#19) * Fix Offline-mode breaking everything * Add `offline` authentication type and append `@offline` to UserIds during offline mode * Add offline id support to Player.Get * Comment transpilers --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fix NW bugs (#32) * Fix Armor Drop from https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/230 * add comments * fix scp173 and adding bug report link to summary class fix https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/143 * Moved patches and fixed Scp173FirstKillPatch * Add Slowness Fix Avoid values more than 100 for effect slowness to fix https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/378 * skill issue * skill issue (again= --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Useless Event (939 Placed Amnestic Cloud) (#40) * Fix custom role classes giving custom ammo when they are not suppose to (#24) * Fix custom role classes giving custom ammmo when they are not suppose to * change to using EnumUtils * Moved Ammo additions into Inventory call delayed * `Item::<T>Get()` and `Pickup::<T>Get()` (#17) * `Item::::<T>Get()` and `Pickup::<T>Get()` * Revert doc change * Add `Hazard::Get<T>()` * doc fix * `Door::Get<T>()` * AdminToy.Get<T>() * More <T> implementation * WeirdFix * simplify Scp244Spawning patch and AddedComment & NO IL error * Remove Log.info * DroppingItem light modifiication * Moving Item.Get inside the eventargs instead of transpiller * FixNpcNoclip (#34) * FixNpcNoclip * oups * . * virtual / override * Implements more patches for RemovingHandcuffs event and adding RemovedHandcuffs event (#3) * Update labeler.yml * RemovingHandcuffs event * Update UncuffReason.cs * New event * docs * Interacting scp330 compile fix (#43) * My scp built with no issues.. no idea why. * Fixes issue * Harmony suppresses NON harmony errors. --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Trello is no more & more NW Fix & Fix IL Code on dev (#28) * Trello Is Replaced by gitlab * also this one * Fix106RegenerationWithScp244 * Report To NW * . * Scp3114FriendlyFireFix * Fix * yamatotototo * Fix * Fix for building dev + TODO than i just seen * Fix Undid patch * fIX * Fix Client Crash Issue --------- Co-authored-by: IRacle <zornik2006@yandex.ru> * Additions (#29) * Add a bunch * Fix * Security * Make changes * remove unused usings * Getting inventory * oops * Dev commit * use exiled --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * `[EXILED::API]` Pickup::Category (#46) * Item Category on Pickup * Fixed Build Error * Fix (#50) * `[Exiled::API]` Removing breaking changes (#54) Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> * `Scp330` sound fix (#55) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Fix Npc (#58) * Fix breaking change (#61) Fix a breaking change in #9 * Version bump * 💀💀💀 * `SendStaffMessage` fix * Added the SCP-079 Recontaining event (#21) * added the RecontainingEvent with the patch * Fixed constructors * consistency * fixed logic skill issue * Removed "useless" constructor * corrected the typo * fixed some typo * final edit for the final request * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * `[EXILED::API]` Adding SpawnMice (#47) * Mouse Spawner * Changes to make it public * Optimization * Finally can i spawn rats? * Fix adding throw and changing the error that throws --------- Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * `[EXILED::API]` Adding ScaleNetworkIdentityObject (#49) * Revert "💀💀💀" This reverts commit 904865e. * `[EXILED::API]` Adding SendFakeSceneLoading (#45) * Added ScenesType and Corrisponding Methods for the Server and Player * Fixing Building Error * Applied the Change request * Changes requested by Yamato made * Fixed Building Errors * Fix build --------- Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * scp018projectile (#73) * 😱😎🙂💀😈 (#51) * Разрабы дауны😱😎🙂💀😈 * new better `SendFakeSyncVar` method * ililililililil * c * `KeycardPickup.Permissions` now is not joke (#70) * `[Exiled::Events]` `Unbanning` and `Unbanned` events (#68) * 🐱‍👤🐱‍👤🐱‍👤 * some fixes * fix * ☠️💀💀💀☠️💀 Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> --------- Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> * `[EXILED::API]` Adding StaminaRegenMultiplier (BodyArmor) (#71) * First push * using removed * Added to the pickup * Forgot to add to Armor (not pickup) * Fix Build error * Simplification * `[EXILED::API]` Adding MoveNetworkIdentityObject (#48) * MoveNetworkObject Added * fix builds * Fix Builds --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * `[EXILED::EVENTS]` Adding PlayingAudioLog 69 PR (#69) * Audio log event * Mistakes * Fix build errors * Update EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * 🧠💭😔😞📉😭🤔➡️🧑‍⚕️💬💊📈😌 --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * `RecontainedWhenNoScps` feature (#16) * `[EXILED::EVENTS]` Fixing bug report n.396 (#59) * Fix * Added the Bug report * feat: Added IsDecontaminationEnabled property (#82) * Multiple change (UwU) (#79) Add `Player::AddAmmo(Dictionary<ItemType, ushort> ammo)` Add `Player::GrantLoadout()` Add `Player::GrantLoadout(RoleTypeId)` Add `GetEffect<T>()` Add `Scp3114Role::UpdateIdentity()` Fixed `Scp3114Role::DisguiseDuration` not being sync to client * ``[Exiled::CustomRoles]`` ``[Exiled::CustomItems]`` QoL in List commands. (#78) * Ye * I dont need to use ``ci list registered`` only ``ci list`` * You now that ``customroles list abilities`` exist ? no ? yeah its because never say it the command * Its the same for me * Pi pi po po * Im silly @louis1706 uwu --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * DroppingScp330 Event Fix. (#83) * Probably fixes it. * Sigh stylecop --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * ``[Exiled::CustomItems]`` ``[Exiled::API]`` ``[Exiled::CustomRoles]`` Adding news Spawnpoints, Wrapper for Locker and added LockerType (#77) * QoL * Added ``RoomSpawnPoint`` for spawning things in a room with a offset property. * Now Items will be spawned in the MapGenerated event instead of RoundStart avoiding the micro-log for spawning to many pickups in one frame. * YES YAMATO I USE NULLEABLE * Shut * Done * Created a Wrapper for Locker * Created LockerSpawnPoint * I NEED HELP FOR IMPLEMENTING SUPPLYLOCKER I DONT FUCKING KNOW HOW MAKE A TRANSPILER * I hate you Yamato :D * Boop * Why Exiled use MONO.POSIX * And dont use the nuget for it 💀 * Now it will compile in the page * Removing Else if (spawnPoint is RoleSpawnPoint roleSpawnPoint) since its not necessary spawnpoint.Position does the same. * Supressing CS0618 due the obsolet in SpawnLocationType.InsideLocker. * Note: SpawnLocationType.InsideLocker its only used in CustomItem.SpawnAll() so it will be fine to deleted this in futures releases. * Fixing compile action due the warnings * Adding support for Offset Almost forget about this :P * Sorry I cant resist adding more things * Adding support for CustomRoles * Implementing SupplyLocker * I literally copy the generator transpiler * Its works i test it. * Give me my exiled contributor role. * LockerType enum * Code part of the code has been taken from MER (https://github.com/Michal78900/MapEditorReborn/blob/dev/MapEditorReborn/API/Extensions/LockerExtensions.cs) - Credits to Michal, i ask him i can use it, not answer yet but if the say no i will use another way. * SupplyLocker now have a LockerType Property to know what type of Locker is * LockerSpawnPoint can now chose what locker want to use * Mimimi warnings * Re-implementing Locker API * Re-implementing locker api of Exiled-Team/EXILED#2026 * Update EXILED/Exiled.API/Enums/LockerType.cs Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> * I dont like the name of ExiledLockers but * Resolving #77 (comment) * Resolving #77 (comment) * Cleaning Chambers List. * Fixing CustomWeapon * Fixing a Bug with custom items with spawning in old SpawnLocationType.InsideLocker * Update Map.cs Removing blank line. * MORE * Added GetRandomSpawnPoint() in Chamber * Added AddItemToSpawn((ItemType itemType, int quantity = 1, bool spawnIfIsOpen = false)) in Chamber * Added IsOpen in chamber. * Fixing obsolet use * Sorry @VALERA771 * Resolve #77 (review) * Update Exiled.Loader.csproj * Resolving #77 (comment) * Update MapHandler.cs Reduce the delay on spawning items, its not necessary to be to long * Ups Ups --------- Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> * `[Exiled::API]` Adding new properties for `FpcRole` (#65) * 👉👈 * suggestions * no more bc --------- Co-authored-by: Vladislav Popovič <vladislavcs@proton.me> * Update programs.yml * Scp0492 change apperance fix (#87) * 0492 appearance change fix. * Yamato is correct, ZombieRole also inherits StandardRoleBase * Stylecop, sigh --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Add plugin website * fix (#95) * Replace with exiled wrapper class (#94) * Fix Role NRE (#66) * `[Exiled::API]` New way to register parent commands (#74) * uwu * optimising * Allow `ID_Dedicated`/`null` for `Npc.UserId` Parameter (#75) * Npc * Fix Build Error * Update EXILED/Exiled.API/Features/Npc.cs Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * Fix for the PR * Fix Pr * Fixing a small issue if the player is choosing something not ID_DEDICATED * Fix * forgot --------- Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> * Update Exiled.Loader.csproj (#80) * It gives me anxiety to use something that can be a nuget. Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * [Events] Fix crash (#96) * fix * oh, already made in #95 * Random fixes (#103) * fixes * also * Adding Turning On All Lights (#105) * `[EXILED::Events]` Introduce `hub install` command (#101) * feat: introduce plugin installation command * fix: fix build errors wtf was this actually * version bump --------- Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> Co-authored-by: 永安404 <101850798+YongAn404@users.noreply.github.com> Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: X <24619207+Undid-Iridium@users.noreply.github.com> Co-authored-by: Ika <36999341+IkaOverride@users.noreply.github.com> Co-authored-by: IRacle <zornik2006@yandex.ru> Co-authored-by: x3rt <x3rtdev@gmail.com> Co-authored-by: sky <99112969+skyyt15@users.noreply.github.com> Co-authored-by: TtroubleTT <121741230+TtroubleTT@users.noreply.github.com> Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> Co-authored-by: ZeroTwo <63092138+NotZer0Two@users.noreply.github.com> Co-authored-by: FoxWorn3365 <61429263+FoxWorn3365@users.noreply.github.com> Co-authored-by: DrBright <125764730+alexomur@users.noreply.github.com> Co-authored-by: SrLicht <francoquiroz_13@live.com> Co-authored-by: Vladislav Popovič <vladislavcs@proton.me> Co-authored-by: Alex Rouse <123724383+ALEXWARELLC@users.noreply.github.com> Co-authored-by: Joseph <108951296+Josephfallen@users.noreply.github.com> Co-authored-by: Panikorovskii Vladislav <68610520+bladuk@users.noreply.github.com>
1 parent a536d7e commit 21f51a2

File tree

96 files changed

+2319
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2319
-304
lines changed

EXILED/EXILED.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<PropertyGroup>
1717
<!-- This is the global version and is used for all projects that don't have a version -->
18-
<Version Condition="$(Version) == ''">8.12.0-rc.3</Version>
18+
<Version Condition="$(Version) == ''">8.12.0</Version>
1919
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
2020
<PublicBeta>false</PublicBeta>
2121

EXILED/Exiled.API/Enums/LockerType.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="LockerType.cs" company="Exiled Team">
3+
// Copyright (c) Exiled Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.API.Enums
9+
{
10+
/// <summary>
11+
/// Unique identifier for different types of <see cref="Features.Lockers.Locker"/>s.
12+
/// </summary>
13+
public enum LockerType
14+
{
15+
/// <summary>
16+
/// The pedestal used by SCP items.
17+
/// </summary>
18+
Pedestal,
19+
20+
/// <summary>
21+
/// Large weapon locker.
22+
/// </summary>
23+
LargeGun,
24+
25+
/// <summary>
26+
/// Locker for rifles, known as a rifle rack.
27+
/// </summary>
28+
RifleRack,
29+
30+
/// <summary>
31+
/// Miscellaneous locker for various items.
32+
/// </summary>
33+
Misc,
34+
35+
/// <summary>
36+
/// Locker that contains medkits.
37+
/// </summary>
38+
Medkit,
39+
40+
/// <summary>
41+
/// Locker that contains adrenaline.
42+
/// </summary>
43+
Adrenaline,
44+
45+
/// <summary>
46+
/// Unknow type of locker.
47+
/// </summary>
48+
Unknow,
49+
}
50+
}

EXILED/Exiled.API/Enums/ScenesType.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="ScenesType.cs" company="Exiled Team">
3+
// Copyright (c) Exiled Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.API.Enums
9+
{
10+
/// <summary>
11+
/// Unique identifier for the different types of Scenes the client and server can load.
12+
/// </summary>
13+
public enum ScenesType
14+
{
15+
/// <summary>
16+
/// The facility itself.
17+
/// </summary>
18+
Facility,
19+
20+
/// <summary>
21+
/// The current main menu.
22+
/// ! Will cause crash when trying joining servers !
23+
/// </summary>
24+
NewMainMenu,
25+
26+
/// <summary>
27+
/// The old main menu.
28+
/// </summary>
29+
MainMenuRemastered,
30+
31+
/// <summary>
32+
/// The old server list.
33+
/// </summary>
34+
FastMenu,
35+
36+
/// <summary>
37+
/// The loading Screen.
38+
/// ! Will cause crash when trying joining servers !
39+
/// </summary>
40+
PreLoader,
41+
42+
/// <summary>
43+
/// A black menu before loading the <see cref="NewMainMenu"/>.
44+
/// </summary>
45+
Loader,
46+
}
47+
}

EXILED/Exiled.API/Enums/SpawnLocationType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
// Licensed under the CC BY-SA 3.0 license.
55
// </copyright>
66
// -----------------------------------------------------------------------
7-
87
namespace Exiled.API.Enums
98
{
9+
using System;
10+
1011
/// <summary>
1112
/// All of the valid spawn location types.
1213
/// </summary>
@@ -150,6 +151,7 @@ public enum SpawnLocationType
150151
/// <summary>
151152
/// Inside a random locker on the map.
152153
/// </summary>
154+
[Obsolete("Use LockerSpawnPoint instead")]
153155
InsideLocker,
154156
}
155157
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="LockerExtensions.cs" company="Exiled Team">
3+
// Copyright (c) Exiled Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.API.Extensions
9+
{
10+
using System;
11+
12+
using Exiled.API.Enums;
13+
using MapGeneration.Distributors;
14+
15+
/// <summary>
16+
/// A set of extensions for <see cref="Enums.LockerType"/>.
17+
/// </summary>
18+
public static class LockerExtensions
19+
{
20+
/// <summary>
21+
/// Gets the <see cref="LockerType"/> from the given <see cref="Locker"/> object.
22+
/// </summary>
23+
/// <param name="locker">The <see cref="Locker"/> to check.</param>
24+
/// <returns>The corresponding <see cref="LockerType"/>.</returns>
25+
public static LockerType GetLockerType(this Locker locker) => locker.name.GetLockerTypeByName();
26+
27+
/// <summary>
28+
/// Gets the <see cref="LockerType"/> by name.
29+
/// </summary>
30+
/// <param name="name">The name to check.</param>
31+
/// <returns>The corresponding <see cref="LockerType"/>.</returns>
32+
public static LockerType GetLockerTypeByName(this string name) => name.Replace("(Clone)", string.Empty) switch
33+
{
34+
"Scp500PedestalStructure Variant" => LockerType.Pedestal,
35+
"LargeGunLockerStructure" => LockerType.LargeGun,
36+
"RifleRackStructure" => LockerType.RifleRack,
37+
"MiscLocker" => LockerType.Misc,
38+
"RegularMedkitStructure" => LockerType.Medkit,
39+
"AdrenalineMedkitStructure" => LockerType.Adrenaline,
40+
_ => LockerType.Unknow,
41+
};
42+
}
43+
}

EXILED/Exiled.API/Extensions/MirrorExtensions.cs

Lines changed: 148 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace Exiled.API.Extensions
1515
using System.Reflection.Emit;
1616
using System.Text;
1717

18+
using Exiled.API.Enums;
1819
using Features;
1920
using Features.Pools;
2021

@@ -270,6 +271,15 @@ public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumer
270271
writer.WriteByte(unitId);
271272
}
272273

274+
if (roleBase is ZombieRole)
275+
{
276+
if (player.Role.Base is not ZombieRole)
277+
isRisky = true;
278+
279+
writer.WriteUShort((ushort)Mathf.Clamp(Mathf.CeilToInt(player.MaxHealth), ushort.MinValue, ushort.MaxValue));
280+
writer.WriteBool(true);
281+
}
282+
273283
if (roleBase is FpcStandardRoleBase fpc)
274284
{
275285
if (player.Role.Base is not FpcStandardRoleBase playerfpc)
@@ -283,14 +293,6 @@ public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumer
283293
writer.WriteUShort(value);
284294
}
285295

286-
if (roleBase is ZombieRole)
287-
{
288-
if (player.Role.Base is not ZombieRole)
289-
isRisky = true;
290-
291-
writer.WriteUShort((ushort)Mathf.Clamp(Mathf.CeilToInt(player.MaxHealth), ushort.MinValue, ushort.MaxValue));
292-
}
293-
294296
foreach (Player target in playersToAffect)
295297
{
296298
if (target != player || !isRisky)
@@ -355,6 +357,111 @@ public static void MessageTranslated(this Player player, string words, string tr
355357
}
356358
}
357359

360+
/// <summary>
361+
/// Moves object for the player.
362+
/// </summary>
363+
/// <param name="player">Target to send.</param>
364+
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to move.</param>
365+
/// <param name="pos">The position to change.</param>
366+
public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos)
367+
{
368+
identity.gameObject.transform.position = pos;
369+
ObjectDestroyMessage objectDestroyMessage = new()
370+
{
371+
netId = identity.netId,
372+
};
373+
374+
player.Connection.Send(objectDestroyMessage, 0);
375+
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection });
376+
}
377+
378+
/// <summary>
379+
/// Sends to the player a Fake Change Scene.
380+
/// </summary>
381+
/// <param name="player">The player to send the Scene.</param>
382+
/// <param name="newSceneName">The new Scene the client will load.</param>
383+
public static void SendFakeSceneLoading(this Player player, ScenesType newSceneName)
384+
{
385+
SceneMessage message = new()
386+
{
387+
sceneName = newSceneName.ToString(),
388+
};
389+
390+
player.Connection.Send(message);
391+
}
392+
393+
/// <summary>
394+
/// Emulation of the method SCP:SL uses to change scene.
395+
/// </summary>
396+
/// <param name="scene">The new Scene the client will load.</param>
397+
public static void ChangeSceneToAllClients(ScenesType scene)
398+
{
399+
SceneMessage message = new()
400+
{
401+
sceneName = scene.ToString(),
402+
};
403+
404+
NetworkServer.SendToAll(message);
405+
}
406+
407+
/// <summary>
408+
/// Scales an object for the specified player.
409+
/// </summary>
410+
/// <param name="player">Target to send.</param>
411+
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to scale.</param>
412+
/// <param name="scale">The scale the object needs to be set to.</param>
413+
public static void ScaleNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 scale)
414+
{
415+
identity.gameObject.transform.localScale = scale;
416+
ObjectDestroyMessage objectDestroyMessage = new()
417+
{
418+
netId = identity.netId,
419+
};
420+
421+
player.Connection.Send(objectDestroyMessage, 0);
422+
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection });
423+
}
424+
425+
/// <summary>
426+
/// Moves object for all the players.
427+
/// </summary>
428+
/// <param name="identity">The <see cref="NetworkIdentity"/> to move.</param>
429+
/// <param name="pos">The position to change.</param>
430+
public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vector3 pos)
431+
{
432+
identity.gameObject.transform.position = pos;
433+
ObjectDestroyMessage objectDestroyMessage = new()
434+
{
435+
netId = identity.netId,
436+
};
437+
438+
foreach (Player ply in Player.List)
439+
{
440+
ply.Connection.Send(objectDestroyMessage, 0);
441+
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection });
442+
}
443+
}
444+
445+
/// <summary>
446+
/// Scales an object for all players.
447+
/// </summary>
448+
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to scale.</param>
449+
/// <param name="scale">The scale the object needs to be set to.</param>
450+
public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vector3 scale)
451+
{
452+
identity.gameObject.transform.localScale = scale;
453+
ObjectDestroyMessage objectDestroyMessage = new()
454+
{
455+
netId = identity.netId,
456+
};
457+
458+
foreach (Player ply in Player.List)
459+
{
460+
ply.Connection.Send(objectDestroyMessage, 0);
461+
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection });
462+
}
463+
}
464+
358465
/// <summary>
359466
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
360467
/// </summary>
@@ -363,6 +470,7 @@ public static void MessageTranslated(this Player player, string words, string tr
363470
/// <param name="targetType"><see cref="NetworkBehaviour"/>'s type.</param>
364471
/// <param name="propertyName">Property name starting with Network.</param>
365472
/// <param name="value">Value of send to target.</param>
473+
[Obsolete("Use overload with type-template instead.")]
366474
public static void SendFakeSyncVar(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, object value)
367475
{
368476
if (!target.IsConnected)
@@ -386,6 +494,38 @@ void CustomSyncVarGenerator(NetworkWriter targetWriter)
386494
}
387495
}
388496

497+
/// <summary>
498+
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
499+
/// </summary>
500+
/// <typeparam name="T">Target SyncVar property type.</typeparam>
501+
/// <param name="target">Target to send.</param>
502+
/// <param name="behaviorOwner"><see cref="NetworkIdentity"/> of object that owns <see cref="NetworkBehaviour"/>.</param>
503+
/// <param name="targetType"><see cref="NetworkBehaviour"/>'s type.</param>
504+
/// <param name="propertyName">Property name starting with Network.</param>
505+
/// <param name="value">Value of send to target.</param>
506+
public static void SendFakeSyncVar<T>(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, T value)
507+
{
508+
if (!target.IsConnected)
509+
return;
510+
511+
NetworkWriterPooled writer = NetworkWriterPool.Get();
512+
NetworkWriterPooled writer2 = NetworkWriterPool.Get();
513+
MakeCustomSyncWriter(behaviorOwner, targetType, null, CustomSyncVarGenerator, writer, writer2);
514+
target.Connection.Send(new EntityStateMessage
515+
{
516+
netId = behaviorOwner.netId,
517+
payload = writer.ToArraySegment(),
518+
});
519+
520+
NetworkWriterPool.Return(writer);
521+
NetworkWriterPool.Return(writer2);
522+
void CustomSyncVarGenerator(NetworkWriter targetWriter)
523+
{
524+
targetWriter.WriteULong(SyncVarDirtyBits[$"{targetType.Name}.{propertyName}"]);
525+
WriterExtensions[typeof(T)]?.Invoke(null, new object[2] { targetWriter, value });
526+
}
527+
}
528+
389529
/// <summary>
390530
/// Force resync to client's <see cref="SyncVarAttribute"/>.
391531
/// </summary>

0 commit comments

Comments
 (0)