Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* uwu (#5)

* AdminToy.List (ExMod-Team#18)

* AdminToy.List

* Better AdminToy::Get()

* Update EXILED/Exiled.API/Features/Toys/AdminToy.cs

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

* TODO

* Fix Error

* Fix2

---------

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

* Fix `Jailbird::WearState` (ExMod-Team#12)

* Jailbird

* Fix

* Exception

* Fix NW moment

* Porting EXILED9 RespawnedTeam event. by.VALERA771 (ExMod-Team#27)

Exiled-Team/EXILED#2386

* Fix not returning null (ExMod-Team#22)

* Fix not returning null

* Apply suggestions from code review

Co-authored-by: Jesus QC <[email protected]>

* Little modification

---------

Co-authored-by: Jesus QC <[email protected]>

* RecontainedEventArgs more feature (ExMod-Team#20)

* RecontainedEventArgs more feature

* Fix Naming

* grammar

* Update RecontainedEventArgs.cs

---------

Co-authored-by: Misaka-ZeroTwo <[email protected]>

* InteractingScp330.cs: Reduction of bloat code from original design. (ExMod-Team#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 <[email protected]>

* IScp330Event (ExMod-Team#11)

Co-authored-by: Misaka-ZeroTwo <[email protected]>

* PR than i made (#9)

* PR made by me

Thanks Ika for the Help on CustomAmmo/CategoryLimit

Co-Authored-By: Ika <[email protected]>

* 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 <[email protected]>

* [Events] Fix null reference (ExMod-Team#15)

* fix situation when `ply == null`

* lol why

---------

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

* Offline mode support (ExMod-Team#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 <[email protected]>

* Fix NW bugs (ExMod-Team#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 <[email protected]>

* Useless Event (939 Placed Amnestic Cloud) (ExMod-Team#40)

* Fix custom role classes giving custom ammo when they are not suppose to (ExMod-Team#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()` (ExMod-Team#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 (ExMod-Team#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 (ExMod-Team#43)

* My scp built with no issues.. no idea why.

* Fixes issue

* Harmony suppresses NON harmony errors.

---------

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

* Trello is no more & more NW Fix & Fix IL Code on dev (ExMod-Team#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 <[email protected]>

* Additions (ExMod-Team#29)

* Add a bunch

* Fix

* Security

* Make changes

* remove unused usings

* Getting inventory

* oops

* Dev commit

* use exiled

---------

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

* `[EXILED::API]` Pickup::Category (ExMod-Team#46)

* Item Category on Pickup

* Fixed Build Error

* Fix (ExMod-Team#50)

* `[Exiled::API]` Removing breaking changes (ExMod-Team#54)

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

* `Scp330` sound fix (ExMod-Team#55)

Co-authored-by: Misaka-ZeroTwo <[email protected]>

* Fix Npc (ExMod-Team#58)

* Fix breaking change (ExMod-Team#61)

Fix a breaking change in #9

* Version bump

* 💀💀💀

* `SendStaffMessage` fix

* Added the SCP-079 Recontaining event (ExMod-Team#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 <[email protected]>

---------

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

* `[EXILED::API]` Adding SpawnMice (ExMod-Team#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 <[email protected]>

* `[EXILED::API]` Adding ScaleNetworkIdentityObject (ExMod-Team#49)

* Revert "💀💀💀"

This reverts commit 904865e.

* `[EXILED::API]` Adding SendFakeSceneLoading (ExMod-Team#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 <[email protected]>

* scp018projectile (ExMod-Team#73)

* 😱😎🙂💀😈 (ExMod-Team#51)

* Разрабы дауны😱😎🙂💀😈

* new better `SendFakeSyncVar` method

* ililililililil

* c

* `KeycardPickup.Permissions` now is not joke (ExMod-Team#70)

* `[Exiled::Events]` `Unbanning` and `Unbanned` events (ExMod-Team#68)

* 🐱‍👤🐱‍👤🐱‍👤

* some fixes

* fix

* ☠️💀💀💀☠️💀

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

---------

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

* `[EXILED::API]` Adding StaminaRegenMultiplier (BodyArmor) (ExMod-Team#71)

* First push

* using removed

* Added to the pickup

* Forgot to add to Armor (not pickup)

* Fix Build error

* Simplification

* `[EXILED::API]` Adding MoveNetworkIdentityObject (ExMod-Team#48)

* MoveNetworkObject Added

* fix builds

* Fix Builds

---------

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

* `[EXILED::EVENTS]` Adding PlayingAudioLog 69 PR (ExMod-Team#69) 

* Audio log event

* Mistakes

* Fix build errors

* Update EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs

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

* Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs

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

* Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs

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

* Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs

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

* Update EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs

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

* 🧠💭😔😞📉😭🤔➡️🧑‍⚕️💬💊📈😌

---------

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

* `RecontainedWhenNoScps` feature (ExMod-Team#16)

* `[EXILED::EVENTS]` Fixing bug report n.396 (ExMod-Team#59)

* Fix

* Added the Bug report

* feat: Added IsDecontaminationEnabled property (ExMod-Team#82)

* Multiple change (UwU) (ExMod-Team#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. (ExMod-Team#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 <[email protected]>

* DroppingScp330 Event Fix. (ExMod-Team#83)

* Probably fixes it.

* Sigh stylecop

---------

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

* ``[Exiled::CustomItems]`` ``[Exiled::API]`` ``[Exiled::CustomRoles]`` Adding news Spawnpoints, Wrapper for Locker and added LockerType (ExMod-Team#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 <[email protected]>

* I dont like the name of ExiledLockers but

* Resolving ExMod-Team#77 (comment)

* Resolving ExMod-Team#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 ExMod-Team#77 (review)

* Update Exiled.Loader.csproj

* Resolving ExMod-Team#77 (comment)

* Update MapHandler.cs

Reduce the delay on spawning items, its not necessary to be to long

* Ups

Ups

---------

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

* `[Exiled::API]` Adding new properties for `FpcRole` (ExMod-Team#65)

* 👉👈

* suggestions

* no more bc

---------

Co-authored-by: Vladislav Popovič <[email protected]>

* Update programs.yml

* Scp0492 change apperance fix (ExMod-Team#87)

* 0492 appearance change fix.

* Yamato is correct, ZombieRole also inherits StandardRoleBase

* Stylecop, sigh

---------

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

* Add plugin website

* fix (ExMod-Team#95)

* Replace with exiled wrapper class (ExMod-Team#94)

* Fix Role NRE (ExMod-Team#66)

* `[Exiled::API]` New way to register parent commands (ExMod-Team#74)

* uwu

* optimising

* Allow `ID_Dedicated`/`null` for `Npc.UserId` Parameter (ExMod-Team#75)

* Npc

* Fix Build Error

* Update EXILED/Exiled.API/Features/Npc.cs

Co-authored-by: Alex Rouse <[email protected]>

* 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 <[email protected]>

* Update Exiled.Loader.csproj (ExMod-Team#80)

* It gives me anxiety to use something that can be a nuget.

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

* [Events] Fix crash (ExMod-Team#96)

* fix

* oh, already made in ExMod-Team#95

* Random fixes (ExMod-Team#103)

* fixes

* also

* Adding Turning On All Lights (ExMod-Team#105)

* `[EXILED::Events]` Introduce `hub install` command (ExMod-Team#101)

* feat: introduce plugin installation command

* fix: fix build errors

wtf was this actually

* version bump

---------

Co-authored-by: VALERA771 <[email protected]>
Co-authored-by: Yamato <[email protected]>
Co-authored-by: IRacle <[email protected]>
Co-authored-by: 永安404 <[email protected]>
Co-authored-by: Misaka-ZeroTwo <[email protected]>
Co-authored-by: X <[email protected]>
Co-authored-by: Ika <[email protected]>
Co-authored-by: IRacle <[email protected]>
Co-authored-by: x3rt <[email protected]>
Co-authored-by: sky <[email protected]>
Co-authored-by: TtroubleTT <[email protected]>
Co-authored-by: Nameless <[email protected]>
Co-authored-by: ZeroTwo <[email protected]>
Co-authored-by: FoxWorn3365 <[email protected]>
Co-authored-by: DrBright <[email protected]>
Co-authored-by: SrLicht <[email protected]>
Co-authored-by: Vladislav Popovič <[email protected]>
Co-authored-by: Alex Rouse <[email protected]>
Co-authored-by: Joseph <[email protected]>
Co-authored-by: Panikorovskii Vladislav <[email protected]>
  • Loading branch information
1 parent a536d7e commit 21f51a2
Show file tree
Hide file tree
Showing 96 changed files with 2,319 additions and 304 deletions.
2 changes: 1 addition & 1 deletion EXILED/EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

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

namespace Exiled.API.Enums
{
/// <summary>
/// Unique identifier for different types of <see cref="Features.Lockers.Locker"/>s.
/// </summary>
public enum LockerType
{
/// <summary>
/// The pedestal used by SCP items.
/// </summary>
Pedestal,

/// <summary>
/// Large weapon locker.
/// </summary>
LargeGun,

/// <summary>
/// Locker for rifles, known as a rifle rack.
/// </summary>
RifleRack,

/// <summary>
/// Miscellaneous locker for various items.
/// </summary>
Misc,

/// <summary>
/// Locker that contains medkits.
/// </summary>
Medkit,

/// <summary>
/// Locker that contains adrenaline.
/// </summary>
Adrenaline,

/// <summary>
/// Unknow type of locker.
/// </summary>
Unknow,
}
}
47 changes: 47 additions & 0 deletions EXILED/Exiled.API/Enums/ScenesType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// -----------------------------------------------------------------------
// <copyright file="ScenesType.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Enums
{
/// <summary>
/// Unique identifier for the different types of Scenes the client and server can load.
/// </summary>
public enum ScenesType
{
/// <summary>
/// The facility itself.
/// </summary>
Facility,

/// <summary>
/// The current main menu.
/// ! Will cause crash when trying joining servers !
/// </summary>
NewMainMenu,

/// <summary>
/// The old main menu.
/// </summary>
MainMenuRemastered,

/// <summary>
/// The old server list.
/// </summary>
FastMenu,

/// <summary>
/// The loading Screen.
/// ! Will cause crash when trying joining servers !
/// </summary>
PreLoader,

/// <summary>
/// A black menu before loading the <see cref="NewMainMenu"/>.
/// </summary>
Loader,
}
}
4 changes: 3 additions & 1 deletion EXILED/Exiled.API/Enums/SpawnLocationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Enums
{
using System;

/// <summary>
/// All of the valid spawn location types.
/// </summary>
Expand Down Expand Up @@ -150,6 +151,7 @@ public enum SpawnLocationType
/// <summary>
/// Inside a random locker on the map.
/// </summary>
[Obsolete("Use LockerSpawnPoint instead")]
InsideLocker,
}
}
43 changes: 43 additions & 0 deletions EXILED/Exiled.API/Extensions/LockerExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// -----------------------------------------------------------------------
// <copyright file="LockerExtensions.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Extensions
{
using System;

using Exiled.API.Enums;
using MapGeneration.Distributors;

/// <summary>
/// A set of extensions for <see cref="Enums.LockerType"/>.
/// </summary>
public static class LockerExtensions
{
/// <summary>
/// Gets the <see cref="LockerType"/> from the given <see cref="Locker"/> object.
/// </summary>
/// <param name="locker">The <see cref="Locker"/> to check.</param>
/// <returns>The corresponding <see cref="LockerType"/>.</returns>
public static LockerType GetLockerType(this Locker locker) => locker.name.GetLockerTypeByName();

/// <summary>
/// Gets the <see cref="LockerType"/> by name.
/// </summary>
/// <param name="name">The name to check.</param>
/// <returns>The corresponding <see cref="LockerType"/>.</returns>
public static LockerType GetLockerTypeByName(this string name) => name.Replace("(Clone)", string.Empty) switch
{
"Scp500PedestalStructure Variant" => LockerType.Pedestal,
"LargeGunLockerStructure" => LockerType.LargeGun,
"RifleRackStructure" => LockerType.RifleRack,
"MiscLocker" => LockerType.Misc,
"RegularMedkitStructure" => LockerType.Medkit,
"AdrenalineMedkitStructure" => LockerType.Adrenaline,
_ => LockerType.Unknow,
};
}
}
156 changes: 148 additions & 8 deletions EXILED/Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Exiled.API.Extensions
using System.Reflection.Emit;
using System.Text;

using Exiled.API.Enums;
using Features;
using Features.Pools;

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

if (roleBase is ZombieRole)
{
if (player.Role.Base is not ZombieRole)
isRisky = true;

writer.WriteUShort((ushort)Mathf.Clamp(Mathf.CeilToInt(player.MaxHealth), ushort.MinValue, ushort.MaxValue));
writer.WriteBool(true);
}

if (roleBase is FpcStandardRoleBase fpc)
{
if (player.Role.Base is not FpcStandardRoleBase playerfpc)
Expand All @@ -283,14 +293,6 @@ public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumer
writer.WriteUShort(value);
}

if (roleBase is ZombieRole)
{
if (player.Role.Base is not ZombieRole)
isRisky = true;

writer.WriteUShort((ushort)Mathf.Clamp(Mathf.CeilToInt(player.MaxHealth), ushort.MinValue, ushort.MaxValue));
}

foreach (Player target in playersToAffect)
{
if (target != player || !isRisky)
Expand Down Expand Up @@ -355,6 +357,111 @@ public static void MessageTranslated(this Player player, string words, string tr
}
}

/// <summary>
/// Moves object for the player.
/// </summary>
/// <param name="player">Target to send.</param>
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to move.</param>
/// <param name="pos">The position to change.</param>
public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos)
{
identity.gameObject.transform.position = pos;
ObjectDestroyMessage objectDestroyMessage = new()
{
netId = identity.netId,
};

player.Connection.Send(objectDestroyMessage, 0);
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection });
}

/// <summary>
/// Sends to the player a Fake Change Scene.
/// </summary>
/// <param name="player">The player to send the Scene.</param>
/// <param name="newSceneName">The new Scene the client will load.</param>
public static void SendFakeSceneLoading(this Player player, ScenesType newSceneName)
{
SceneMessage message = new()
{
sceneName = newSceneName.ToString(),
};

player.Connection.Send(message);
}

/// <summary>
/// Emulation of the method SCP:SL uses to change scene.
/// </summary>
/// <param name="scene">The new Scene the client will load.</param>
public static void ChangeSceneToAllClients(ScenesType scene)
{
SceneMessage message = new()
{
sceneName = scene.ToString(),
};

NetworkServer.SendToAll(message);
}

/// <summary>
/// Scales an object for the specified player.
/// </summary>
/// <param name="player">Target to send.</param>
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to scale.</param>
/// <param name="scale">The scale the object needs to be set to.</param>
public static void ScaleNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 scale)
{
identity.gameObject.transform.localScale = scale;
ObjectDestroyMessage objectDestroyMessage = new()
{
netId = identity.netId,
};

player.Connection.Send(objectDestroyMessage, 0);
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection });
}

/// <summary>
/// Moves object for all the players.
/// </summary>
/// <param name="identity">The <see cref="NetworkIdentity"/> to move.</param>
/// <param name="pos">The position to change.</param>
public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vector3 pos)
{
identity.gameObject.transform.position = pos;
ObjectDestroyMessage objectDestroyMessage = new()
{
netId = identity.netId,
};

foreach (Player ply in Player.List)
{
ply.Connection.Send(objectDestroyMessage, 0);
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection });
}
}

/// <summary>
/// Scales an object for all players.
/// </summary>
/// <param name="identity">The <see cref="Mirror.NetworkIdentity"/> to scale.</param>
/// <param name="scale">The scale the object needs to be set to.</param>
public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vector3 scale)
{
identity.gameObject.transform.localScale = scale;
ObjectDestroyMessage objectDestroyMessage = new()
{
netId = identity.netId,
};

foreach (Player ply in Player.List)
{
ply.Connection.Send(objectDestroyMessage, 0);
SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection });
}
}

/// <summary>
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
/// </summary>
Expand All @@ -363,6 +470,7 @@ public static void MessageTranslated(this Player player, string words, string tr
/// <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)
Expand All @@ -386,6 +494,38 @@ void CustomSyncVarGenerator(NetworkWriter targetWriter)
}
}

/// <summary>
/// Send fake values to client's <see cref="SyncVarAttribute"/>.
/// </summary>
/// <typeparam name="T">Target SyncVar property type.</typeparam>
/// <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>
public static void SendFakeSyncVar<T>(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, T 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[typeof(T)]?.Invoke(null, new object[2] { targetWriter, value });
}
}

/// <summary>
/// Force resync to client's <see cref="SyncVarAttribute"/>.
/// </summary>
Expand Down
Loading

0 comments on commit 21f51a2

Please sign in to comment.