diff --git a/Synapse/Api/Decontamination.cs b/Synapse/Api/Decontamination.cs
index 2ed95b2..aa6c3a1 100644
--- a/Synapse/Api/Decontamination.cs
+++ b/Synapse/Api/Decontamination.cs
@@ -5,8 +5,14 @@ namespace Synapse.Api
{
public static class Decontamination
{
+ ///
+ /// Gives you the Decontamination Controller
+ ///
public static DecontaminationController Controller => DecontaminationController.Singleton;
+ ///
+ /// Is the Decontamination Countdown disabled?
+ ///
public static bool IsDecontaminationDisabled
{
get => Controller._disableDecontamination;
@@ -21,6 +27,9 @@ public static bool IsDecontaminationDisabled
}
}
+ ///
+ /// Is the Decontamination in Progress?
+ ///
public static bool IsDecontaminationInProgress => Controller._decontaminationBegun;
///
diff --git a/Synapse/Api/Dummy.cs b/Synapse/Api/Dummy.cs
new file mode 100644
index 0000000..f1b2ef9
--- /dev/null
+++ b/Synapse/Api/Dummy.cs
@@ -0,0 +1,144 @@
+using Mirror;
+using RemoteAdmin;
+using System.Linq;
+using UnityEngine;
+
+namespace Synapse.Api
+{
+ public class Dummy
+ {
+ private ItemType helditem;
+ private GameObject gameObject;
+
+ ///
+ /// Get / Set the Current Role of the Dummy
+ ///
+ public RoleType Role
+ {
+ get => gameObject.GetComponent().CurClass;
+ set
+ {
+ Despawn();
+ gameObject.GetComponent().CurClass = value;
+ Spawn();
+ }
+ }
+
+ ///
+ /// Get / Set the Current Name of the Dummy
+ ///
+ public string Name
+ {
+ get => gameObject.GetComponent().Network_myNickSync;
+ set => gameObject.GetComponent().Network_myNickSync = value;
+ }
+
+ ///
+ /// Get / Set the Current Position of the Dummy
+ ///
+ public Vector3 Position
+ {
+ get => gameObject.transform.position;
+ set
+ {
+ Despawn();
+ gameObject.transform.position = value;
+ Spawn();
+ }
+ }
+
+ ///
+ /// Get / Set the Scale of the Dummy
+ ///
+ public Vector3 Scale
+ {
+ get => gameObject.transform.localScale;
+ set
+ {
+ Despawn();
+ gameObject.transform.localScale = value;
+ Spawn();
+ }
+ }
+
+ ///
+ /// Get / Set the Current Item the Dummy is holding
+ ///
+ public ItemType HeldItem
+ {
+ get => helditem;
+ set
+ {
+ gameObject.GetComponent().SetCurItem(value);
+ helditem = value;
+ }
+ }
+
+ ///
+ /// Get / Set the BadgeText of the Dummy
+ ///
+ public string BadgeName
+ {
+ get => gameObject.GetComponent().MyText;
+ set => gameObject.GetComponent().SetText(value);
+ }
+
+ ///
+ /// Get / Set the BadgeCOlor of the Dummy
+ ///
+ public string BadgeColor
+ {
+ get => gameObject.GetComponent().MyColor;
+ set => gameObject.GetComponent().SetColor(value);
+ }
+
+ ///
+ /// Creates a New Dummy and Spawn it
+ ///
+ /// The Position where the Dummy should spawn
+ /// The Rotation of the Dummy
+ /// The Role which the Dummy should be
+ /// The Name of the Dummy
+ /// The Displayed BadgeTeyt of the Dummy
+ /// The Displayed BadgeColor of the Dummy
+ public Dummy(Vector3 pos, Quaternion rot, RoleType role = RoleType.ClassD, string name = "(null)",string badgetext = "",string badgecolor = "")
+ {
+ GameObject obj =
+ Object.Instantiate(
+ NetworkManager.singleton.spawnPrefabs.FirstOrDefault(p => p.gameObject.name == "Player"));
+
+ if (obj.GetComponent() == null)
+ obj.AddComponent();
+
+ gameObject = obj;
+
+ obj.GetComponent().CurClass = role;
+ obj.GetComponent().Network_myNickSync = name;
+ gameObject.GetComponent().MyText = badgetext;
+ gameObject.GetComponent().MyColor = badgecolor;
+ obj.transform.localScale = Vector3.one;
+ obj.transform.position = pos;
+ obj.transform.rotation = rot;
+ obj.GetComponent().NetworkPlayerId = 9999;
+ obj.GetComponent().PlayerId = 9999;
+
+ NetworkServer.Spawn(obj);
+ ReferenceHub.Hubs.Remove(obj);
+ }
+
+ ///
+ /// Despawns the Dummy
+ ///
+ public void Despawn() => NetworkServer.UnSpawn(gameObject);
+
+ ///
+ /// Spawns the Dummy again after Despawning
+ ///
+ public void Spawn() => NetworkServer.Spawn(gameObject);
+
+ ///
+ /// Destroys the Object
+ ///
+ public void Destroy() => Object.Destroy(gameObject);
+ }
+}
diff --git a/Synapse/Api/Extensions.cs b/Synapse/Api/Extensions.cs
index fec0f08..a7cc53e 100644
--- a/Synapse/Api/Extensions.cs
+++ b/Synapse/Api/Extensions.cs
@@ -97,5 +97,13 @@ public static Player GetPlayer(this ICommandSender sender)
public static string GetVersionString(this PluginDetails details) => $"{details.SynapseMajor}.{details.SynapseMinor}.{details.SynapsePatch}";
public static int GetVersionNumber(this PluginDetails details) => details.SynapseMajor * 100 + details.SynapseMinor * 10 + details.SynapsePatch;
+
+ public static MapPoint GetMapPoint(this YamlConfig config,string key,MapPoint def = null)
+ {
+ if (MapPoint.TryParse(config.GetString(key),out var point))
+ return point;
+
+ return def;
+ }
}
}
\ No newline at end of file
diff --git a/Synapse/Api/Jail.cs b/Synapse/Api/Jail.cs
index c8d1810..1a63f76 100644
--- a/Synapse/Api/Jail.cs
+++ b/Synapse/Api/Jail.cs
@@ -88,6 +88,7 @@ public void UnJail()
player.Role = Role;
Timing.CallDelayed(0.2f, () => player.Position = Position);
player.Health = Health;
+ player.ClearInventory();
foreach (var item in Items)
player.Inventory.items.Add(item);
diff --git a/Synapse/Api/Map.cs b/Synapse/Api/Map.cs
index 5af870c..e4d1f32 100644
--- a/Synapse/Api/Map.cs
+++ b/Synapse/Api/Map.cs
@@ -12,6 +12,9 @@ namespace Synapse.Api
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public static class Map
{
+ private static Broadcast BroadcastComponent => Player.Host.GetComponent();
+
+
///
/// Activates/Deactivates the FriendlyFire on the server
///
@@ -22,8 +25,6 @@ public static class Map
///
public static List Lifts => Server.GetObjectsOf();
- private static Broadcast BroadcastComponent => Player.Host.GetComponent();
-
///
/// Gives you a list of all rooms
///
@@ -37,6 +38,9 @@ public static IEnumerable Rooms
}
}
+ ///
+ /// Get/Sets the Text of the Intercom
+ ///
public static string IntercomText
{
get => Server.Host.GetComponent().CustomContent;
@@ -175,6 +179,38 @@ public static Vector3 GetRandomSpawnPoint(this RoleType type)
public static Pickup SpawnItem(ItemType itemType, float durability, Vector3 position, Quaternion rotation = default, int sight = 0, int barrel = 0, int other = 0)
=> Player.Host.Inventory.SetPickup(itemType, durability, position, rotation, sight, barrel, other);
+ ///
+ /// Spawns a Item on the Map with a specific scale
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Pickup SpawnItem(ItemType itemType, float durability, Vector3 position, Vector3 scale, Quaternion rotation = default, int sight = 0, int barrel = 0, int other = 0)
+ {
+ var p = Server.Host.Inventory.SetPickup(itemType, -4.656647E+11f, position, Quaternion.identity, 0, 0, 0);
+
+ var gameObject = p.gameObject;
+ gameObject.transform.localScale = scale;
+
+ NetworkServer.UnSpawn(gameObject);
+ NetworkServer.Spawn(p.gameObject);
+
+ return p;
+ }
+
+ ///
+ /// Spawns a WorkStation on the Map
+ ///
+ ///
+ ///
+ ///
+ /// The Workstation
public static WorkStation SpawnWorkStation(Vector3 position,Vector3 rotation,Vector3 size)
{
GameObject bench =
@@ -193,6 +229,12 @@ public static WorkStation SpawnWorkStation(Vector3 position,Vector3 rotation,Vec
return bench.GetComponent();
}
+ ///
+ /// Spawns a Ragdoll on the Map
+ ///
+ ///
+ ///
+ ///
public static void SpawnRagdoll(Vector3 Position,RoleType role,string killer = "World")
{
Server.Host.GetComponent().SpawnRagdoll(
@@ -201,19 +243,6 @@ public static void SpawnRagdoll(Vector3 Position,RoleType role,string killer = "
, false, killer, killer, 1);
}
- public static Pickup SpawnItem(ItemType itemType, float durability, Vector3 position, Vector3 scale, Quaternion rotation = default, int sight = 0, int barrel = 0, int other = 0)
- {
- var p = Server.Host.Inventory.SetPickup(itemType, -4.656647E+11f, position,Quaternion.identity, 0, 0, 0);
-
- var gameObject = p.gameObject;
- gameObject.transform.localScale = scale;
-
- NetworkServer.UnSpawn(gameObject);
- NetworkServer.Spawn(p.gameObject);
-
- return p;
- }
-
///
/// Has the group the permission?
///
diff --git a/Synapse/Api/MapPoint.cs b/Synapse/Api/MapPoint.cs
new file mode 100644
index 0000000..8a768df
--- /dev/null
+++ b/Synapse/Api/MapPoint.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Linq;
+using UnityEngine;
+
+namespace Synapse.Api
+{
+ public class MapPoint
+ {
+ ///
+ /// Tries to Parse a string to a MapPoint
+ ///
+ /// The string you try to parse
+ /// The MapPoint you Parse
+ /// If the Parsing was sucesfully and mapPoint is not null
+ public static bool TryParse(string mappointstring, out MapPoint mapPoint)
+ {
+ try
+ {
+ mapPoint = Parse(mappointstring);
+ return true;
+ }
+ catch
+ {
+ mapPoint = null;
+ return false;
+ }
+ }
+
+ ///
+ /// Parses a string to a MapPoint
+ ///
+ /// The String you want to Parse
+ /// The MapPoint which was parsed
+ public static MapPoint Parse(string mappointstring) => new MapPoint(mappointstring);
+
+ ///
+ /// Creates a MapPoint
+ ///
+ /// The Room the MapPoint is realtive too
+ /// The Position you want to get the MapPoint of
+ public MapPoint(Room room, Vector3 position)
+ {
+ if (position == null) throw new ArgumentNullException("position", "The Argument position of the Constructor MapPoint(Room room,Vector3 position) is null");
+ if (room == null) throw new ArgumentNullException("room", "The Argument Room of the Constructor MapPoint(Room room,Vector3 position) is null");
+
+ Room = room;
+ RelativePosition = Room.Transform.InverseTransformPoint(position);
+ }
+
+ ///
+ /// Creates a MapPoint
+ ///
+ /// The String from which you want to create a MapPoint of
+ public MapPoint(string mappointstring)
+ {
+ string[] args = mappointstring.Split(':');
+ if (args.Count() < 4) throw new IndexOutOfRangeException("Parsing of string to MapPoint failed because there was missing informations!He need to look like this: \"Roomname:1,434:-2,346456:1,6554\"");
+ var room = Map.Rooms.FirstOrDefault(r => r.Name.ToLower() == args[0].ToLower());
+ if (room == null) throw new Exception("Parsing of string to MapPoint failed because of the roomname");
+
+ if (!float.TryParse(args[1], out var x)) throw new Exception("Parsing of string to MapPoint failed because of the Relative x Position!");
+ if (!float.TryParse(args[2], out var y)) throw new Exception("Parsing of string to MapPoint failed because of the Relative y Position!");
+ if (!float.TryParse(args[3], out var z)) throw new Exception("Parsing of string to MapPoint failed because of the Relative z Position!");
+
+ Room = room;
+ RelativePosition = new Vector3(x, y, z);
+ }
+
+
+ ///
+ /// The Room of which the MapPoint is relative too
+ ///
+ public readonly Room Room;
+
+ ///
+ /// The Relative Position of the MapPoint to the Room
+ ///
+ public readonly Vector3 RelativePosition;
+
+ ///
+ /// The Calculated end Position on the Map
+ ///
+ public Vector3 Position { get => Room.Transform.TransformPoint(RelativePosition); }
+
+ ///
+ /// The MapPoint as a String
+ ///
+ ///
+ public override string ToString() => $"{Room.Name}:{RelativePosition.x}:{RelativePosition.y}:{RelativePosition.z}";
+ }
+}
diff --git a/Synapse/Api/Player.cs b/Synapse/Api/Player.cs
index f0f3833..8137498 100644
--- a/Synapse/Api/Player.cs
+++ b/Synapse/Api/Player.cs
@@ -9,6 +9,7 @@
using Searching;
using Synapse.Api.Enums;
using Synapse.Config;
+using Synapse.Events.Patches.SynapsePatches;
using UnityEngine;
namespace Synapse.Api
@@ -85,6 +86,10 @@ public static Player GetPlayer(string arg)
public HintDisplay HintDisplay => Hub.hints;
+ public Scp106Controller Scp106Controller => this.GetComponent();
+
+ public Scp079Controller Scp079Controller => this.GetComponent();
+
///
/// The CommandSender objects of the Player
///
@@ -102,6 +107,9 @@ public CommandSender CommandSender
///
public string NickName { get => NicknameSync.Network_myNickSync; }
+ ///
+ /// Get / Set the Displayed Name of the User
+ ///
public string DisplayName { get => NicknameSync.DisplayName; set => NicknameSync.DisplayName = value; }
///
@@ -140,13 +148,11 @@ public CommandSender CommandSender
///
public bool Bypass { get => ServerRoles.BypassMode; set => Hub.serverRoles.BypassMode = value; }
-
///
/// Get / Set the Players GodMode
///
public bool GodMode { get => ClassManager.GodMode; set => ClassManager.GodMode = value; }
-
///
/// Modify the size of the Player
///
@@ -184,6 +190,11 @@ public Vector3 Scale
///
public Vector2 Rotation { get => MovementSync.RotationSync; set => Hub.playerMovementSync.RotationSync = value; }
+ ///
+ /// Get / Set the Last Position the Player died
+ ///
+ public Vector3 DeathPosition { get => ClassManager.DeathPosition; set => ClassManager.DeathPosition = value; }
+
///
/// The health of the player
///
@@ -239,6 +250,11 @@ public Team Side
}
}
}
+
+ ///
+ /// Gives you the Fraction of the Player
+ ///
+ public Fraction Fraction => ClassManager.Fraction;
///
/// The Room where the player currently is
@@ -282,6 +298,8 @@ public Room Room
///
public Inventory.SyncListItemInfo Items { get => Inventory.items; set => Inventory.items = value; }
+ public Inventory.SyncItemInfo CurrentItem { get => Inventory.GetItemInHand(); }
+
///
/// The person who cuffed the player
///
@@ -291,6 +309,7 @@ public Player Cuffer
get => GetPlayer(Handcuffs.CufferId);
set
{
+
var handcuff = value.Handcuffs;
if (handcuff == null) return;
@@ -342,6 +361,21 @@ public Player Cuffer
/// Note: This will not change the permissions
public string RankName { get => Rank.BadgeText; set => Hub.serverRoles.SetText(value); }
+ ///
+ /// Get/Set if the Rank/Badge of the Player is hidden
+ ///
+ public bool HideRank
+ {
+ get => string.IsNullOrEmpty(ServerRoles.HiddenBadge);
+ set
+ {
+ if (value)
+ ClassManager.CmdRequestHideTag();
+ else
+ ClassManager.CallCmdRequestShowTag(false);
+ }
+ }
+
///
/// The Permission of the Player
///
@@ -358,12 +392,20 @@ public Player Cuffer
public bool IsIntercomMuted { get => ClassManager.NetworkIntercomMuted; set => ClassManager.NetworkIntercomMuted = value; }
///
- /// The current camera the player uses (Scp079 only, if not null)
+ /// Gives you the Ping of the Player to the Server
///
- public Camera079 Camera { get => Hub.scp079PlayerScript.currentCamera; set => Hub.scp079PlayerScript?.RpcSwitchCamera(value.cameraId, false); }
-
public int Ping => LiteNetLib4MirrorServer.Peers[Connection.connectionId].Ping;
+ ///
+ /// Gives you the AuthToken of the Player
+ ///
+ public string AuthToken => ClassManager.AuthToken;
+
+ ///
+ /// Gives you the time since the Player last died
+ ///
+ public float AliveTime => ClassManager.AliveTime;
+
///
/// The rotation float of the player
///
@@ -389,8 +431,14 @@ public Player Cuffer
///
public bool IsDead => Team == Team.RIP;
+ ///
+ /// The Jail object of the Player
+ ///
public Jail Jail => GetComponent();
+ ///
+ /// Gets/Sets the UnitName of the Player
+ ///
public string UnitName { get => ClassManager.NetworkCurUnitName; set => ClassManager.NetworkCurUnitName = value; }
///
@@ -419,10 +467,13 @@ public Player Cuffer
///
public void Kill(DamageTypes.DamageType damageType = default) => Hub.playerStats.HurtPlayer(new PlayerStats.HitInfo(-1f, "WORLD", damageType, 0), gameObject);
- [Obsolete("Does not work properly")]
+ ///
+ /// Changes The Role of the Player without Changing his Items/Position/Health
+ ///
+ ///
public void ChangeRoleAtPosition(RoleType role)
{
- //TODO: Fix this shit
+ RolePositionPatch.Lite = true;
Hub.characterClassManager.SetClassIDAdv(role, true);
}
@@ -495,17 +546,6 @@ public void InstantBroadcast(ushort time, string message)
///
public void SendRAConsoleMessage(string message, bool success = true, RaCategory type = RaCategory.None) => CommandSender.RaMessage(message, success, type);
- ///
- /// Hides for normal player the RankName the player has
- ///
- public void HideTag() => ClassManager.CallCmdRequestHideTag();
-
- ///
- /// Shows everyone the RankName the player has
- ///
- ///
- public void ShowTag(bool global = false) => ClassManager.CallCmdRequestShowTag(global);
-
///
/// Gives the player a item
///
@@ -516,8 +556,15 @@ public void InstantBroadcast(ushort time, string message)
///
public void GiveItem(ItemType itemType, float duration = float.NegativeInfinity, int sight = 0, int barrel = 0, int other = 0) => Hub.inventory.AddNewItem(itemType, duration, sight, barrel, other);
+ ///
+ /// Drops the Entire Inventory of the Player
+ ///
public void DropAllItems() => Inventory.ServerDropAll();
+ ///
+ /// Drops a Item from the PlayerInventory
+ ///
+ ///
public void DropItem(Inventory.SyncItemInfo item)
{
Inventory.SetPickup(item.id, item.durability, Position, Inventory.camera.transform.rotation, item.modSight, item.modBarrel, item.modOther);
@@ -587,6 +634,9 @@ public void SendToServer(ushort port)
NetworkWriterPool.Recycle(writer);
}
+ ///
+ /// Makes the Screen of the Player for the entire Round black
+ ///
public void DimScreen()
{
var component = RoundSummary.singleton;
@@ -602,6 +652,10 @@ public void DimScreen()
NetworkWriterPool.Recycle(writer);
}
+ ///
+ /// Shakes the Screen of the Player like when the Warhead explodes
+ ///
+ ///
public void ShakeScreen(bool achieve = false)
{
var component = Warhead.Controller;
@@ -617,5 +671,7 @@ public void ShakeScreen(bool achieve = false)
Connection.Send(msg);
NetworkWriterPool.Recycle(writer);
}
+
+ public override string ToString() => NickName;
}
}
diff --git a/Synapse/Api/Plugin/Translation.cs b/Synapse/Api/Plugin/Translation.cs
index c1340f2..64724b4 100644
--- a/Synapse/Api/Plugin/Translation.cs
+++ b/Synapse/Api/Plugin/Translation.cs
@@ -8,12 +8,15 @@ namespace Synapse.Api.Plugin
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public class Translation
{
+ private Dictionary _rawtranslation;
private Dictionary _translation = new Dictionary();
private string _translationPath;
internal Plugin Plugin;
public void CreateTranslations(Dictionary translations)
{
+ _rawtranslation = translations;
+
_translationPath = Path.Combine(Files.ServerConfigDirectory, Plugin.Details.Name + "-translation.txt");
if (!File.Exists(_translationPath))
File.Create(_translationPath).Close();
@@ -50,6 +53,12 @@ public void CreateTranslations(Dictionary translations)
_translation = dictionary;
}
+ public void ReloadTranslations()
+ {
+ if (_rawtranslation != null)
+ CreateTranslations(_rawtranslation);
+ }
+
public string GetTranslation(string translationName)
{
try
diff --git a/Synapse/Api/Round.cs b/Synapse/Api/Round.cs
index f0a176b..49af41c 100644
--- a/Synapse/Api/Round.cs
+++ b/Synapse/Api/Round.cs
@@ -9,34 +9,115 @@ public static class Round
[Obsolete("Please use RoundLength")]
public static TimeSpan RoundLenght => RoundStart.RoundLenght;
+ ///
+ /// The time since the Round started
+ ///
public static TimeSpan RoundLength => RoundStart.RoundLenght;
+ ///
+ /// The time the Round started
+ ///
public static DateTime StartedTime => DateTime.Now - RoundLength;
+ ///
+ /// Is the Round started?
+ ///
public static bool IsStarted => RoundSummary.RoundInProgress();
///
- /// Activates/Deactivates the RoundLock (if the Round can end)
+ /// Get/Sets if the Round is locked
///
public static bool IsLocked{ get => RoundSummary.RoundLock; set => RoundSummary.RoundLock = value; }
+ ///
+ /// Get/Sets if the Lobby is locked
+ ///
+ public static bool IsLobbyLocked { get => RoundStart.LobbyLock; set => RoundStart.LobbyLock = value; }
+
+ ///
+ /// Gets or sets the amount of Respawntickets for the MTF-Team
+ /// Please be careful when settings the amount of the ticket since this method ignores whether or
+ /// not the ticket amount should be locked to zero or not
+ ///
+ public static int MtfTickets
+ {
+ get {
+ RespawnTickets.Singleton._tickets.TryGetValue(SpawnableTeamType.NineTailedFox, out var tickets);
+ return tickets;
+ }
+
+ set => RespawnTickets.Singleton._tickets[SpawnableTeamType.NineTailedFox] = value;
+ }
+
+ ///
+ /// Gets or sets the amount of Respawntickets for the Chaos-Team
+ /// Please be careful when settings the amount of the ticket since this method ignores whether or
+ /// not the ticket amount should be locked to zero or not
+ ///
+ public static int ChaosTickets
+ {
+ get {
+ RespawnTickets.Singleton._tickets.TryGetValue(SpawnableTeamType.ChaosInsurgency, out var tickets);
+ return tickets;
+ }
+
+ set => RespawnTickets.Singleton._tickets[SpawnableTeamType.ChaosInsurgency] = value;
+ }
+
+ ///
+ /// Grants Respawntickets to the MTF-Team
+ ///
+ /// The amount of tickets granted
+ /// Whether or not a existing lock should be ignored
+ public static void GrantMtfTickets(int tickets, bool overrideLocks = false)
+ {
+ RespawnTickets.Singleton.GrantTickets(SpawnableTeamType.NineTailedFox, tickets, overrideLocks);
+ }
+
+ ///
+ /// Grants Respawntickets to the Chaos-Team
+ ///
+ /// The amount of tickets granted
+ /// Whether or not a existing lock should be ignored
+ public static void GrantChaosTickets(int tickets, bool overrideLocks = false)
+ {
+ RespawnTickets.Singleton.GrantTickets(SpawnableTeamType.ChaosInsurgency, tickets, overrideLocks);
+ }
+
+ ///
+ /// The Amount of escaped ClassD`s
+ ///
public static int EscapedDs { get => RoundSummary.escaped_ds; set => RoundSummary.escaped_ds = value; }
+ ///
+ /// The Amount of escaped Scientists
+ ///
public static int EscapedScientists { get => RoundSummary.escaped_scientists; set => RoundSummary.escaped_scientists = value; }
+ ///
+ /// The Amount of kills by Scps
+ ///
public static int KillsByScps { get => RoundSummary.kills_by_scp; set => RoundSummary.kills_by_scp = value; }
+ ///
+ /// The Amount of persons changed into Zombies
+ ///
public static int ChangedIntoZombies { get => RoundSummary.changed_into_zombies; set => RoundSummary.changed_into_zombies = value; }
///
- /// Activates/Deactivates the LobbyLock (if the Lobby can continue counting down)
+ /// Restarts the Round
///
- public static bool IsLobbyLocked{ get => RoundStart.LobbyLock; set => RoundStart.LobbyLock = value; }
-
public static void Restart() => Player.Host.PlayerStats.Roundrestart();
+ ///
+ /// Starts the Round
+ ///
public static void Start() => CharacterClassManager.ForceRoundStart();
+ ///
+ /// Spawns Mtf/Chaos
+ ///
+ ///
public static void MtfRespawn(bool isCI = false)
{
var component = Server.Host.GetComponent();
diff --git a/Synapse/Api/Scp079Controller.cs b/Synapse/Api/Scp079Controller.cs
new file mode 100644
index 0000000..1c6d6d7
--- /dev/null
+++ b/Synapse/Api/Scp079Controller.cs
@@ -0,0 +1,34 @@
+using UnityEngine;
+
+namespace Synapse.Api
+{
+ public class Scp079Controller : MonoBehaviour
+ {
+ private Player player => this.GetPlayer();
+ private Scp079PlayerScript script => player.ClassManager.Scp079;
+
+ public bool Is079 => player.Role == RoleType.Scp079;
+
+ public byte Level { get => script.Lvl; set => script.Lvl = value; }
+
+ public string Speaker { get => script.Speaker; set => script.Speaker = value; }
+
+ public float Exp { get => script.Exp; set => script.Exp = value; }
+
+ public float Energy { get => script.Mana; set => script.Mana = value; }
+
+ public float MaxEnergy { get => script.maxMana; set => script.NetworkmaxMana = value; }
+
+ ///
+ /// The current camera the player uses (Scp079 only, if not null)
+ ///
+ public Camera079 Camera { get => script.currentCamera; set => script?.RpcSwitchCamera(value.cameraId, false); }
+
+
+ public void GiveExperience(float amount) => script.AddExperience(amount);
+
+ public void ForceLevel(byte levelToForce, bool notifiyUser) => script.ForceLevel(levelToForce, notifiyUser);
+
+ public void UnlockDoors() => script.CmdResetDoors();
+ }
+}
diff --git a/Synapse/Api/Scp106Controller.cs b/Synapse/Api/Scp106Controller.cs
new file mode 100644
index 0000000..7dabb3e
--- /dev/null
+++ b/Synapse/Api/Scp106Controller.cs
@@ -0,0 +1,25 @@
+using UnityEngine;
+
+namespace Synapse.Api
+{
+ public class Scp106Controller : MonoBehaviour
+ {
+ private Player player => this.GetPlayer();
+ private Scp106PlayerScript script => player.ClassManager.Scp106;
+
+ public bool Is106 => player.Role == RoleType.Scp106;
+
+ public Vector3 PortalPosition { get => script.NetworkportalPosition; set => script.SetPortalPosition(value); }
+
+
+ public void UsePortal() => script.UseTeleport();
+
+ public void DeletePortal() => script.DeletePortal();
+
+ public void CreatePortal() => script.CreatePortalInCurrentPosition();
+
+ public void Contain() => script.Contain(player.Hub);
+
+ public void CapturePlayer(Player player) => script.CallCmdMovePlayer(player.gameObject, ServerTime.time);
+ }
+}
diff --git a/Synapse/Api/Server.cs b/Synapse/Api/Server.cs
index 348c126..325aee8 100644
--- a/Synapse/Api/Server.cs
+++ b/Synapse/Api/Server.cs
@@ -14,9 +14,14 @@ public static class Server
private static Broadcast _broadcast;
private static BanPlayer _banPlayer;
-
+ ///
+ /// Gives you the Player object of the Server
+ ///
public static Player Host => Player.Host;
+ ///
+ /// Get/Sets the ServerName
+ ///
public static string Name
{
get => ServerConsole._serverName;
@@ -27,8 +32,14 @@ public static string Name
}
}
+ ///
+ /// Get/Sets the Port of the Server
+ ///
public static ushort Port { get => ServerStatic.ServerPort; set => ServerStatic.ServerPort = value; }
+ ///
+ /// SpawnMessage MethodInfo
+ ///
public static MethodInfo SendSpawnMessage
{
get
@@ -41,6 +52,9 @@ public static MethodInfo SendSpawnMessage
}
}
+ ///
+ /// The Broadcast object of the Server
+ ///
public static Broadcast Broadcast
{
get
@@ -52,6 +66,9 @@ public static Broadcast Broadcast
}
}
+ ///
+ /// The BanPlayer object of the Server
+ ///
public static BanPlayer BanPlayer
{
get
@@ -63,17 +80,50 @@ public static BanPlayer BanPlayer
}
}
+ ///
+ /// Gives you the ServerConsole
+ ///
public static ServerConsole Console => ServerConsole.singleton;
+ ///
+ /// The RemoteAdmin Command Handler
+ ///
+ ///
+ /// You can use it to register Commands
+ ///
public static RemoteAdminCommandHandler RaCommandHandler => CommandProcessor.RemoteAdminCommandHandler;
+ ///
+ /// The ServerConsole Command Handler
+ ///
+ ///
+ /// You can use it to register Commands
+ ///
public static GameConsoleCommandHandler GameCoreCommandHandler => GameCore.Console.singleton.ConsoleCommandHandler;
+ ///
+ /// The Client Command Handler
+ ///
+ ///
+ /// You can use it to register Commands
+ ///
public static ClientCommandHandler ClientCommandHandler => QueryProcessor.DotCommandHandler;
-
+ ///
+ /// Gives you a list of all objects with this Type
+ ///
+ ///
+ ///
public static List GetObjectsOf() where TObject : UnityEngine.Object => UnityEngine.Object.FindObjectsOfType().ToList();
+ public static TObject GetObjectOf() where TObject : UnityEngine.Object => UnityEngine.Object.FindObjectOfType();
+
+ ///
+ /// Gives you the MethodHash
+ ///
+ ///
+ ///
+ ///
public static int GetMethodHash(Type invokeClass, string methodName) => invokeClass.FullName.GetStableHashCode() * 503 + methodName.GetStableHashCode();
}
}
diff --git a/Synapse/Api/Warhead.cs b/Synapse/Api/Warhead.cs
index 4810b14..fae5a6a 100644
--- a/Synapse/Api/Warhead.cs
+++ b/Synapse/Api/Warhead.cs
@@ -4,7 +4,11 @@ public static class Warhead
{
private static AlphaWarheadController _controller;
private static AlphaWarheadNukesitePanel _nukeSitePanel;
+ private static AlphaWarheadOutsitePanel _outsidepanel;
+ ///
+ /// Gives you the Decontamination Controller
+ ///
public static AlphaWarheadController Controller
{
get
@@ -16,19 +20,41 @@ public static AlphaWarheadController Controller
}
}
+ ///
+ /// Gives you the NukesiktePanel
+ ///
public static AlphaWarheadNukesitePanel NukeSitePanel
{
get
{
if (_nukeSitePanel == null)
- _nukeSitePanel = Player.Host.GetComponent();
+ _nukeSitePanel = Server.GetObjectOf();
return _nukeSitePanel;
}
}
+ public static AlphaWarheadOutsitePanel OutsitePanel
+ {
+ get
+ {
+ if (_outsidepanel == null)
+ _outsidepanel = Server.GetObjectOf();
+
+ return _outsidepanel;
+ }
+ }
+
+ public static bool Enabled { get => NukeSitePanel.Networkenabled; set => NukeSitePanel.Networkenabled = value; }
+
+ ///
+ /// Get / Set the LeverStatus
+ ///
public static bool LeverStatus { get => NukeSitePanel.Networkenabled; set => NukeSitePanel.Networkenabled = value; }
+ ///
+ /// The Time to Detonation
+ ///
public static float DetonationTimer
{
get => Controller.NetworktimeToDetonation;
@@ -36,17 +62,17 @@ public static float DetonationTimer
}
///
- /// Is the nuke detonated?
+ /// Is the Nuke Detonated?
///
public static bool IsNukeDetonated => Controller.detonated;
///
- /// Is the nuke in progress?
+ /// Is the Nuke in Progress?
///
public static bool IsNukeInProgress => Controller.inProgress;
///
- /// Starts the nuke
+ /// Starts the Nuke
///
public static void StartNuke()
{
@@ -55,15 +81,18 @@ public static void StartNuke()
}
///
- /// Stops the nuke
+ /// Stops the Nuke
///
public static void StopNuke() => Controller.CancelDetonation();
///
- /// Detonates the nuke
+ /// Detonates the Nuke
///
public static void DetonateNuke() => Controller.Detonate();
+ ///
+ /// Shakes the Screen for all player like when the Nuke explodes
+ ///
public static void Shake() => Controller.RpcShake(true);
}
}
diff --git a/Synapse/Events/Classes/PocketDimensionLeave.cs b/Synapse/Events/Classes/PocketDimensionLeave.cs
new file mode 100644
index 0000000..f714c4d
--- /dev/null
+++ b/Synapse/Events/Classes/PocketDimensionLeave.cs
@@ -0,0 +1,13 @@
+using Synapse.Api;
+
+namespace Synapse.Events.Classes
+{
+ public class PocketDimensionLeave
+ {
+ public Player Player { get; internal set; }
+
+ public PocketDimensionTeleport.PDTeleportType TeleportType { get; set; }
+
+ public bool Allow { get; set; }
+ }
+}
diff --git a/Synapse/Events/Classes/Scp096AddTarget.cs b/Synapse/Events/Classes/Scp096AddTarget.cs
new file mode 100644
index 0000000..8683ff9
--- /dev/null
+++ b/Synapse/Events/Classes/Scp096AddTarget.cs
@@ -0,0 +1,15 @@
+using Synapse.Api;
+
+namespace Synapse.Events.Classes
+{
+ public class Scp096AddTarget
+ {
+ public Player Player { get; internal set; }
+
+ public Player ShyGuy { get; internal set; }
+
+ public PlayableScps.Scp096PlayerState RageState { get; internal set; }
+
+ public bool Allow { get; set; }
+ }
+}
diff --git a/Synapse/Events/Classes/ShootEvent.cs b/Synapse/Events/Classes/ShootEvent.cs
new file mode 100644
index 0000000..0232a29
--- /dev/null
+++ b/Synapse/Events/Classes/ShootEvent.cs
@@ -0,0 +1,16 @@
+using Synapse.Api;
+using UnityEngine;
+
+namespace Synapse.Events.Classes
+{
+ public class ShootEvent
+ {
+ public Player Player { get; internal set; }
+
+ public Player Target { get; internal set; }
+
+ public Vector3 TargetPosition { get; set; }
+
+ public bool Allow { get; set; }
+ }
+}
diff --git a/Synapse/Events/EventHandlers.cs b/Synapse/Events/EventHandlers.cs
index 28cd926..07a082c 100644
--- a/Synapse/Events/EventHandlers.cs
+++ b/Synapse/Events/EventHandlers.cs
@@ -2,6 +2,10 @@
using Synapse.Events.Classes;
using Synapse.Config;
using UnityEngine;
+using Synapse.Api;
+using MEC;
+using Grenades;
+using Mirror;
namespace Synapse.Events
{
@@ -14,6 +18,11 @@ public EventHandlers()
Events.SyncDataEvent += OnSyncData;
Events.DoorInteractEvent += OnDoorInteract;
Events.PlayerJoinEvent += OnPlayerJoin;
+
+ #if DEBUG
+ Events.KeyPressEvent += OnKey;
+ Events.ShootEvent += OnShoot;
+ #endif
}
// Methods
@@ -44,5 +53,82 @@ private static void OnSyncData(SyncDataEvent ev)
!(Vector3.Distance(ev.Player.Position, ev.Player.GetComponent().worldPosition) >= Escape.radius))
ev.Player.Hub.characterClassManager.CmdRegisterEscape();
}
+
+ //Only Debug Events
+ private void OnKey(KeyPressEvent ev)
+ {
+ if (ev.Key == KeyCode.Alpha1)
+ {
+ var dm = new Dummy(ev.Player.Position, Quaternion.identity, ev.Player.Role, "first", "First", "yellow");
+ dm.Name = "second";
+ dm.HeldItem = ItemType.GunLogicer;
+ var pos = ev.Player.Position;
+ pos.y += 2;
+ dm.Position = pos;
+ dm.Role = RoleType.Scientist;
+
+ Timing.CallDelayed(2f, () =>
+ {
+ dm.Scale = Vector3.one * 2;
+ dm.BadgeName = "TestBadge";
+ });
+
+ Timing.CallDelayed(5f, () =>
+ {
+ dm.BadgeColor = "red";
+ });
+
+ Timing.CallDelayed(10f, () => dm.Destroy());
+ }
+ if (ev.Key == KeyCode.Alpha2)
+ {
+ var msg = "";
+ foreach (var player in Player.GetAllPlayers())
+ msg += $"\n{player}";
+
+ ev.Player.SendConsoleMessage(msg);
+ }
+ if (ev.Key == KeyCode.Alpha3)
+ {
+ var msg = "";
+ foreach (var player in ReferenceHub.GetAllHubs())
+ msg += $"\n{player}";
+
+ ev.Player.SendConsoleMessage(msg);
+ }
+ }
+
+ private void OnShoot(ShootEvent ev)
+ {
+ var cam = ev.Player.Hub.PlayerCameraReference;
+ Physics.Raycast(cam.transform.position, cam.transform.forward, out RaycastHit where, 40f);
+ if (where.transform.TryGetComponent(out var grenade))
+ {
+ grenade.NetworkfuseTime = 0;
+ grenade.ServersideExplosion();
+ }
+
+ else if (where.transform.TryGetComponent(out var pickup))
+ {
+ if (pickup.itemId == ItemType.GrenadeFrag)
+ {
+ var pos = pickup.position;
+ pickup.position = Vector3.zero;
+ pickup.Delete();
+
+ var gm = Server.Host.GetComponent();
+ var grenade2 = gm.availableGrenades.FirstOrDefault(g => g.inventoryID == ItemType.GrenadeFrag);
+ var component = Object.Instantiate(grenade2.grenadeInstance).GetComponent();
+ component.InitData(gm, Vector3.zero, Vector3.zero);
+ component.transform.position = pos;
+
+
+ NetworkServer.Spawn(component.gameObject);
+
+ component.NetworkfuseTime = 0f;
+ component.ServersideExplosion();
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Synapse/Events/Patches/EventPatches/PlayerPatches/ComponentsPatch.cs b/Synapse/Events/Patches/EventPatches/PlayerPatches/ComponentsPatch.cs
index adf92ed..2f2999c 100644
--- a/Synapse/Events/Patches/EventPatches/PlayerPatches/ComponentsPatch.cs
+++ b/Synapse/Events/Patches/EventPatches/PlayerPatches/ComponentsPatch.cs
@@ -13,6 +13,8 @@ public static void Prefix(ReferenceHub __instance)
if (__instance.GetComponent() == null) __instance.gameObject.AddComponent();
+ if (__instance.GetComponent() == null) __instance.gameObject.AddComponent();
+
try
{
Events.InvokeLoadComponents(__instance.gameObject);
diff --git a/Synapse/Events/Patches/EventPatches/PlayerPatches/ShootPatch.cs b/Synapse/Events/Patches/EventPatches/PlayerPatches/ShootPatch.cs
new file mode 100644
index 0000000..a6694a1
--- /dev/null
+++ b/Synapse/Events/Patches/EventPatches/PlayerPatches/ShootPatch.cs
@@ -0,0 +1,42 @@
+using System;
+using Harmony;
+using Synapse.Api;
+using UnityEngine;
+
+namespace Synapse.Events.Patches.EventPatches.PlayerPatches
+{
+ [HarmonyPatch(typeof(WeaponManager), nameof(WeaponManager.CallCmdShoot))]
+ static class ShootPatch
+ {
+ private static bool Prefix(WeaponManager __instance, GameObject target, string hitboxType, Vector3 dir, Vector3 sourcePos, Vector3 targetPos)
+ {
+ try
+ {
+ if (!__instance._iawRateLimit.CanExecute(true))
+ return false;
+ int itemIndex = __instance._hub.inventory.GetItemIndex();
+ if (itemIndex < 0 || itemIndex >= __instance._hub.inventory.items.Count || __instance.curWeapon < 0 ||
+ ((__instance._reloadCooldown > 0.0 || __instance._fireCooldown > 0.0) &&
+ !__instance.isLocalPlayer) ||
+ (__instance._hub.inventory.curItem != __instance.weapons[__instance.curWeapon].inventoryID ||
+ __instance._hub.inventory.items[itemIndex].durability <= 0.0))
+ return false;
+
+ Player targetplayer = null;
+ if (target != null)
+ targetplayer = target.GetPlayer();
+
+ //Event Invoke
+ Events.InvokeShootEvent(__instance.gameObject.GetPlayer(), targetplayer, ref targetPos, out var allow);
+
+ return allow;
+ }
+ catch (Exception e)
+ {
+ Log.Error($"Shoot Event Error: {e}");
+
+ return true;
+ }
+ }
+ }
+}
diff --git a/Synapse/Events/Patches/EventPatches/ScpPatches/PocketDimensionLeavePatch.cs b/Synapse/Events/Patches/EventPatches/ScpPatches/PocketDimensionLeavePatch.cs
new file mode 100644
index 0000000..53c9698
--- /dev/null
+++ b/Synapse/Events/Patches/EventPatches/ScpPatches/PocketDimensionLeavePatch.cs
@@ -0,0 +1,30 @@
+using System;
+using Harmony;
+using Mirror;
+using Synapse.Api;
+using UnityEngine;
+
+namespace Synapse.Events.Patches.EventPatches.ScpPatches
+{
+ [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.OnTriggerEnter))]
+ internal static class PocketDimensionLeavePatch
+ {
+ private static bool Prefix(PocketDimensionTeleport __instance, Collider other)
+ {
+ try
+ {
+ var component = other.GetComponent();
+ if (!NetworkServer.active || component == null) return false;
+
+ Events.InvokePocketDimensionLeave(component.GetPlayer(), ref __instance.type, out var allow);
+
+ return allow;
+ }
+ catch (Exception e)
+ {
+ Log.Error($"PocketDimExit Event Error: {e}");
+ return true;
+ }
+ }
+ }
+}
diff --git a/Synapse/Events/Patches/EventPatches/ScpPatches/Scp096Target.cs b/Synapse/Events/Patches/EventPatches/ScpPatches/Scp096Target.cs
new file mode 100644
index 0000000..009b4bc
--- /dev/null
+++ b/Synapse/Events/Patches/EventPatches/ScpPatches/Scp096Target.cs
@@ -0,0 +1,45 @@
+using System;
+using Harmony;
+using PlayableScps;
+using Synapse.Api;
+
+namespace Synapse.Events.Patches.EventPatches.ScpPatches
+{
+ [HarmonyPatch(typeof(Scp096), nameof(Scp096.ParseVisionInformation))]
+ static class Scp096LookPatch
+ {
+ public static bool Prefix(Scp096 __instance ,VisionInformation info)
+ {
+ try
+ {
+ var allow = true;
+ Events.InvokeScp096AddTarget(info.Source.GetPlayer(), __instance.GetPlayer(), __instance.PlayerState, ref allow);
+ return allow;
+ }
+ catch(Exception e)
+ {
+ Log.Info($"Scp096AddTarget Event Error: {e}");
+ return true;
+ }
+ }
+ }
+
+ [HarmonyPatch(typeof(Scp096), nameof(Scp096.OnDamage))]
+ static class Scp096ShootPatch
+ {
+ public static bool Prefix(Scp096 __instance, PlayerStats.HitInfo info)
+ {
+ try
+ {
+ var allow = true;
+ Events.InvokeScp096AddTarget(info.RHub.GetPlayer(), __instance.GetPlayer(), __instance.PlayerState, ref allow);
+ return allow;
+ }
+ catch (Exception e)
+ {
+ Log.Info($"Scp096AddTarget Event Error: {e}");
+ return true;
+ }
+ }
+ }
+}
diff --git a/Synapse/Events/Patches/SynapsePatches/RolePositionPatch.cs b/Synapse/Events/Patches/SynapsePatches/RolePositionPatch.cs
new file mode 100644
index 0000000..f9786e0
--- /dev/null
+++ b/Synapse/Events/Patches/SynapsePatches/RolePositionPatch.cs
@@ -0,0 +1,17 @@
+using Harmony;
+
+namespace Synapse.Events.Patches.SynapsePatches
+{
+ [HarmonyPatch(typeof(CharacterClassManager), nameof(CharacterClassManager.SetClassID))]
+ public static class RolePositionPatch
+ {
+ internal static bool Lite = false;
+
+ public static bool Prefix(CharacterClassManager __instance, RoleType id)
+ {
+ __instance.SetClassIDAdv(id, Lite, false);
+ Lite = false;
+ return false;
+ }
+ }
+}
diff --git a/Synapse/Events/PlayerEvents.cs b/Synapse/Events/PlayerEvents.cs
index e697ed2..e9037af 100644
--- a/Synapse/Events/PlayerEvents.cs
+++ b/Synapse/Events/PlayerEvents.cs
@@ -492,5 +492,26 @@ internal static void InvokePlayerThrowGrenadeEvent(Player player, ItemType type,
time = ev.FuseTime;
}
+
+
+ public delegate void OnShoot(ShootEvent ev);
+ public static event OnShoot ShootEvent;
+ internal static void InvokeShootEvent(Player player,Player target,ref Vector3 targetpos,out bool allow)
+ {
+ allow = true;
+ if (ShootEvent == null) return;
+
+ var ev = new ShootEvent
+ {
+ Player = player,
+ Target = target,
+ TargetPosition = targetpos
+ };
+
+ ShootEvent.Invoke(ev);
+
+ allow = ev.Allow;
+ targetpos = ev.TargetPosition;
+ }
}
}
\ No newline at end of file
diff --git a/Synapse/Events/RoundEvents.cs b/Synapse/Events/RoundEvents.cs
new file mode 100644
index 0000000..5275ef8
--- /dev/null
+++ b/Synapse/Events/RoundEvents.cs
@@ -0,0 +1,55 @@
+using Synapse.Events.Classes;
+
+namespace Synapse.Events
+{
+ public static partial class Events
+ {
+ public delegate void OnWaitingForPlayers();
+ public static event OnWaitingForPlayers WaitingForPlayersEvent;
+ internal static void InvokeWaitingForPlayers() => WaitingForPlayersEvent?.Invoke();
+
+ public delegate void OnCheckRoundEnd(CheckRoundEndEvent ev);
+ public static event OnCheckRoundEnd CheckRoundEndEvent;
+ public static void InvokeCheckRoundEnd(ref bool forceEnd, ref bool allow, ref RoundSummary.LeadingTeam team,
+ ref bool teamChanged)
+ {
+ var ev = new CheckRoundEndEvent
+ {
+ Allow = allow,
+ ForceEnd = forceEnd,
+ LeadingTeam = team
+ };
+
+ CheckRoundEndEvent?.Invoke(ev);
+
+ teamChanged = team != ev.LeadingTeam;
+ team = ev.LeadingTeam;
+ allow = ev.Allow;
+ forceEnd = ev.ForceEnd;
+ }
+
+ public delegate void OnRoundRestart();
+ public static event OnRoundRestart RoundRestartEvent;
+ internal static void InvokeRoundRestart()
+ {
+ RoundRestartEvent?.Invoke();
+ }
+
+ ///
+ /// A Event which activate when the Round Ends (not a Restart!)
+ ///
+ public delegate void OnRoundEnd();
+ public static event OnRoundEnd RoundEndEvent;
+ internal static void InvokeRoundEndEvent()
+ {
+ RoundEndEvent?.Invoke();
+ }
+
+ public delegate void OnRoundStart();
+ public static event OnRoundStart RoundStartEvent;
+ internal static void InvokeRoundStart()
+ {
+ RoundStartEvent?.Invoke();
+ }
+ }
+}
diff --git a/Synapse/Events/Scp049Events.cs b/Synapse/Events/Scp049Events.cs
new file mode 100644
index 0000000..b21cfe2
--- /dev/null
+++ b/Synapse/Events/Scp049Events.cs
@@ -0,0 +1,35 @@
+using Synapse.Api;
+using Synapse.Events.Classes;
+
+namespace Synapse.Events
+{
+ public static partial class Events
+ {
+ /// A Event which is activated when Scp049 respawns a Player
+ public delegate void OnScp049Recall(Scp049RecallEvent ev);
+ public static event OnScp049Recall Scp049RecallEvent;
+ internal static void InvokeScp049RecallEvent(Player player, ref Ragdoll ragdoll, ref Player target,
+ ref bool allow, ref RoleType role, ref float lives)
+ {
+ if (Scp049RecallEvent == null) return;
+
+ var ev = new Scp049RecallEvent
+ {
+ Allow = allow,
+ Ragdoll = ragdoll,
+ Target = target,
+ RespawnRole = role,
+ TargetHealth = lives,
+ Player = player
+ };
+
+ Scp049RecallEvent.Invoke(ev);
+
+ ragdoll = ev.Ragdoll;
+ target = ev.Target;
+ role = ev.RespawnRole;
+ lives = ev.TargetHealth;
+ allow = ev.Allow;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Synapse/Events/Scp079Events.cs b/Synapse/Events/Scp079Events.cs
new file mode 100644
index 0000000..8021ed5
--- /dev/null
+++ b/Synapse/Events/Scp079Events.cs
@@ -0,0 +1,27 @@
+using Synapse.Events.Classes;
+using Synapse.Api;
+
+namespace Synapse.Events
+{
+ public static partial class Events
+ {
+ public delegate void OnScp079GainLvl(Scp079GainLvlEvent ev);
+ public static event OnScp079GainLvl Scp079GainLvlEvent;
+ internal static void InvokeScp079LvlEvent(Player player, ref int newlvl, ref bool allow)
+ {
+ if (Scp079GainLvlEvent == null) return;
+
+ var ev = new Scp079GainLvlEvent
+ {
+ Allow = allow,
+ NewLvl = newlvl,
+ Player = player
+ };
+
+ Scp079GainLvlEvent.Invoke(ev);
+
+ newlvl = ev.NewLvl;
+ allow = ev.Allow;
+ }
+ }
+}
diff --git a/Synapse/Events/Scp096Events.cs b/Synapse/Events/Scp096Events.cs
new file mode 100644
index 0000000..54efcd7
--- /dev/null
+++ b/Synapse/Events/Scp096Events.cs
@@ -0,0 +1,27 @@
+using Synapse.Events.Classes;
+using Synapse.Api;
+
+namespace Synapse.Events
+{
+ public static partial class Events
+ {
+ public delegate void OnScp096AddTarget(Scp096AddTarget ev);
+ public static event OnScp096AddTarget Scp096AddTarget;
+ internal static void InvokeScp096AddTarget(Player player, Player shyguy, PlayableScps.Scp096PlayerState state, ref bool allow)
+ {
+ if (Scp096AddTarget == null) return;
+
+ var ev = new Scp096AddTarget()
+ {
+ Player = player,
+ ShyGuy = shyguy,
+ RageState = state,
+ Allow = allow
+ };
+
+ Scp096AddTarget.Invoke(ev);
+
+ allow = ev.Allow;
+ }
+ }
+}
diff --git a/Synapse/Events/ScpEvents.cs b/Synapse/Events/Scp106Events.cs
similarity index 52%
rename from Synapse/Events/ScpEvents.cs
rename to Synapse/Events/Scp106Events.cs
index 0ad4a4a..7557ad3 100644
--- a/Synapse/Events/ScpEvents.cs
+++ b/Synapse/Events/Scp106Events.cs
@@ -1,41 +1,44 @@
-using Synapse.Api;
-using Synapse.Events.Classes;
+using Synapse.Events.Classes;
+using Synapse.Api;
namespace Synapse.Events
{
public static partial class Events
{
- /// A Event which is activated when Scp049 respawns a Player
- public delegate void OnScp049Recall(Scp049RecallEvent ev);
- public static event OnScp049Recall Scp049RecallEvent;
-
- internal static void InvokeScp049RecallEvent(Player player, ref Ragdoll ragdoll, ref Player target,
- ref bool allow, ref RoleType role, ref float lives)
+ public delegate void OnScp106Containment(Scp106ContainmentEvent ev);
+ public static event OnScp106Containment Scp106ContainmentEvent;
+ internal static void InvokeScp106ContainmentEvent(Player player, ref bool allow)
{
- if (Scp049RecallEvent == null) return;
+ if (Scp106ContainmentEvent == null) return;
+
+ var ev = new Scp106ContainmentEvent
+ {
+ Player = player,
+ Allow = allow
+ };
+
+ Scp106ContainmentEvent.Invoke(ev);
+
+ allow = ev.Allow;
+ }
- var ev = new Scp049RecallEvent
+ public delegate void OnScp106CreatePortal(Scp106CreatePortalEvent ev);
+ public static event OnScp106CreatePortal Scp106CreatePortalEvent;
+ internal static void InvokeScp106CreatePortalEvent(Player player, ref bool allow)
+ {
+ var ev = new Scp106CreatePortalEvent
{
Allow = allow,
- Ragdoll = ragdoll,
- Target = target,
- RespawnRole = role,
- TargetHealth = lives,
Player = player
};
- Scp049RecallEvent.Invoke(ev);
+ Scp106CreatePortalEvent?.Invoke(ev);
- ragdoll = ev.Ragdoll;
- target = ev.Target;
- role = ev.RespawnRole;
- lives = ev.TargetHealth;
allow = ev.Allow;
}
-
+
public delegate void OnPocketDimensionEnter(PocketDimensionEvent ev);
public static event OnPocketDimensionEnter PocketDimensionEnterEvent;
-
internal static void InvokePocketDimensionEnterEvent(Player player, ref bool allow)
{
if (PocketDimensionEnterEvent == null) return;
@@ -45,65 +48,30 @@ internal static void InvokePocketDimensionEnterEvent(Player player, ref bool all
Player = player,
Allow = allow
};
-
+
PocketDimensionEnterEvent.Invoke(ev);
allow = ev.Allow;
}
- public delegate void OnScp106Containment(Scp106ContainmentEvent ev);
- public static event OnScp106Containment Scp106ContainmentEvent;
-
- internal static void InvokeScp106ContainmentEvent(Player player, ref bool allow)
+ public delegate void OnPocketDimensionLeave(PocketDimensionLeave ev);
+ public static event OnPocketDimensionLeave PocketDimensionLeaveEvent;
+ internal static void InvokePocketDimensionLeave(Player player, ref PocketDimensionTeleport.PDTeleportType type, out bool allow)
{
- if (Scp106ContainmentEvent == null) return;
+ allow = true;
+ if (PocketDimensionLeaveEvent == null) return;
- var ev = new Scp106ContainmentEvent
+ var ev = new PocketDimensionLeave
{
+ Allow = true,
Player = player,
- Allow = allow
+ TeleportType = type
};
-
- Scp106ContainmentEvent.Invoke(ev);
-
- allow = ev.Allow;
- }
-
-
- public delegate void OnScp079GainLvl(Scp079GainLvlEvent ev);
- public static event OnScp079GainLvl Scp079GainLvlEvent;
- internal static void InvokeScp079LvlEvent(Player player,ref int newlvl,ref bool allow)
- {
- if (Scp079GainLvlEvent == null) return;
-
- var ev = new Scp079GainLvlEvent
- {
- Allow = allow,
- NewLvl = newlvl,
- Player = player
- };
-
- Scp079GainLvlEvent.Invoke(ev);
- newlvl = ev.NewLvl;
- allow = ev.Allow;
- }
-
- public delegate void OnScp106CreatePortal(Scp106CreatePortalEvent ev);
-
- public static event OnScp106CreatePortal Scp106CreatePortalEvent;
-
- internal static void InvokeScp106CreatePortalEvent(Player player, ref bool allow)
- {
- var ev = new Scp106CreatePortalEvent
- {
- Allow = allow,
- Player = player
- };
-
- Scp106CreatePortalEvent?.Invoke(ev);
+ PocketDimensionLeaveEvent.Invoke(ev);
allow = ev.Allow;
+ type = ev.TeleportType;
}
}
-}
\ No newline at end of file
+}
diff --git a/Synapse/Events/ServerEvents.cs b/Synapse/Events/ServerEvents.cs
index 9143365..06875c0 100644
--- a/Synapse/Events/ServerEvents.cs
+++ b/Synapse/Events/ServerEvents.cs
@@ -9,38 +9,10 @@ namespace Synapse.Events
[SuppressMessage("ReSharper", "EventNeverSubscribedTo.Global")]
public static partial class Events
{
- public delegate void OnRoundRestart();
- public static event OnRoundRestart RoundRestartEvent;
-
- internal static void InvokeRoundRestart()
- {
- RoundRestartEvent?.Invoke();
- }
-
- ///
- /// A Event which activate when the Round Ends (not a Restart!)
- ///
- public delegate void OnRoundEnd();
- public static event OnRoundEnd RoundEndEvent;
-
- internal static void InvokeRoundEndEvent()
- {
- RoundEndEvent?.Invoke();
- }
-
- public delegate void OnRoundStart();
- public static event OnRoundStart RoundStartEvent;
-
- internal static void InvokeRoundStart()
- {
- RoundStartEvent?.Invoke();
- }
-
/// A Event which is activated when a user send a Command in the Remote Admin
/// It need to hook ref RemoteCommandEvent ev
public delegate void OnRemoteCommand(RemoteCommandEvent ev);
public static event OnRemoteCommand RemoteCommandEvent;
-
internal static void InvokeRemoteCommandEvent(CommandSender sender, string command, ref bool allow)
{
if (RemoteCommandEvent == null) return;
@@ -60,7 +32,6 @@ internal static void InvokeRemoteCommandEvent(CommandSender sender, string comma
/// A Event which is activated when a user send a Command in the Remote Admin
public delegate void OnConsoleCommand(ConsoleCommandEvent ev);
public static event OnConsoleCommand ConsoleCommandEvent;
-
internal static void InvokeConsoleCommandEvent(Player player, string command, out bool allow)
{
allow = true;
@@ -77,7 +48,6 @@ internal static void InvokeConsoleCommandEvent(Player player, string command, ou
public delegate void TeamRespawn(TeamRespawnEvent ev);
public static event TeamRespawn TeamRespawnEvent;
-
internal static void InvokeTeamRespawnEvent(ref List respawnList, ref Respawning.SpawnableTeamType team)
{
if (TeamRespawnEvent == null) return;
@@ -96,7 +66,6 @@ internal static void InvokeTeamRespawnEvent(ref List respawnList, ref Re
public delegate void OnPreAuthenticationEvent(PreAuthenticationEvent ev);
public static event OnPreAuthenticationEvent PreAuthenticationEvent;
-
internal static void InvokePreAuthentication(string userId, ConnectionRequest request, ref bool allow)
{
var ev = new PreAuthenticationEvent
@@ -110,30 +79,5 @@ internal static void InvokePreAuthentication(string userId, ConnectionRequest re
allow = ev.Allow;
}
-
- public delegate void OnWaitingForPlayers();
- public static event OnWaitingForPlayers WaitingForPlayersEvent;
- internal static void InvokeWaitingForPlayers() => WaitingForPlayersEvent?.Invoke();
-
- public delegate void OnCheckRoundEnd(CheckRoundEndEvent ev);
- public static event OnCheckRoundEnd CheckRoundEndEvent;
-
- public static void InvokeCheckRoundEnd(ref bool forceEnd, ref bool allow, ref RoundSummary.LeadingTeam team,
- ref bool teamChanged)
- {
- var ev = new CheckRoundEndEvent
- {
- Allow = allow,
- ForceEnd = forceEnd,
- LeadingTeam = team
- };
-
- CheckRoundEndEvent?.Invoke(ev);
-
- teamChanged = team != ev.LeadingTeam;
- team = ev.LeadingTeam;
- allow = ev.Allow;
- forceEnd = ev.ForceEnd;
- }
}
}
\ No newline at end of file
diff --git a/Synapse/Properties/AssemblyInfo.cs b/Synapse/Properties/AssemblyInfo.cs
index 0736dca..48e8c00 100644
--- a/Synapse/Properties/AssemblyInfo.cs
+++ b/Synapse/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.1")]
-[assembly: AssemblyFileVersion("1.2.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.3.0")]
+[assembly: AssemblyFileVersion("1.3.0")]
\ No newline at end of file
diff --git a/Synapse/Synapse.cs b/Synapse/Synapse.cs
index 83f012b..42688fa 100644
--- a/Synapse/Synapse.cs
+++ b/Synapse/Synapse.cs
@@ -17,8 +17,8 @@ public static class Synapse
{
#region Version
private const int MajorVersion = 1;
- private const int MinorVersion = 2;
- private const int Patch = 1;
+ private const int MinorVersion = 3;
+ private const int Patch = 0;
public static int VersionNumber => MajorVersion * 100 + MinorVersion * 10 + Patch;
public static string Version => $"{MajorVersion}.{MinorVersion}.{Patch}";
diff --git a/Synapse/Synapse.csproj b/Synapse/Synapse.csproj
index 3e5c4da..5d12914 100644
--- a/Synapse/Synapse.csproj
+++ b/Synapse/Synapse.csproj
@@ -49,7 +49,7 @@
..\..\Synapse_Dependencies\Mirror.dll
-
+
..\..\Synapse_Dependencies\NorthwoodLib.dll
@@ -70,6 +70,10 @@
+
+
+
+
@@ -89,12 +93,23 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -167,7 +182,7 @@
-
+