Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 3e5e940

Browse files
committed
a lot of smaller fixes
1 parent 934e472 commit 3e5e940

24 files changed

Lines changed: 95 additions & 64 deletions

Synapse3.SynapseModule/Config/SerializedObjects.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public SerializedItem(uint id, float durability, uint weaponAttachment, Vector3
5050
FireArm =
5151
{
5252
Attachments = WeaponAttachments
53-
}
53+
},
54+
Scale = new Vector3(XSize, YSize, ZSize)
5455
};
5556

5657
public static explicit operator SynapseItem(SerializedItem item) => item.Parse();

Synapse3.SynapseModule/DebugService.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
using Synapse3.SynapseModule.Events;
55
using Synapse3.SynapseModule.Teams;
66
using System;
7+
using System.Linq;
78
using Synapse3.SynapseModule.Enums;
9+
using Synapse3.SynapseModule.Map;
10+
using Synapse3.SynapseModule.Player;
811
using UnityEngine;
912

1013

@@ -52,7 +55,11 @@ public override void Enable()
5255
reactor.Value.SubscribeUnsafe(this, method);
5356
}
5457
_player.KeyPress.Subscribe(OnKeyPress);
55-
_player.Pickup.Subscribe(ev => ev.Allow = false);
58+
_item.ConsumeItem.Subscribe(ev =>
59+
{
60+
if (ev.State == ItemInteractState.Finalize)
61+
ev.Allow = false;
62+
});
5663
}
5764

5865
public void Event(IEvent ev)
@@ -65,12 +72,11 @@ private void OnKeyPress(KeyPressEvent ev)
6572
switch (ev.KeyCode)
6673
{
6774
case KeyCode.Alpha1:
68-
ev.Player.Invisible += 1;
69-
if (ev.Player.Invisible > InvisibleMode.Full) ev.Player.Invisible = InvisibleMode.None;
75+
Synapse.Get<NukeService>().StartDetonation();
7076
break;
7177

7278
case KeyCode.Alpha2:
73-
ev.Player.MaxHealth = 98;
79+
Synapse.Get<NukeService>().InstantDetonation();
7480

7581
break;
7682
case KeyCode.Alpha3:

Synapse3.SynapseModule/Enums/DoorType.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public enum DoorType
1111
Scp096,
1212
Scp106Primary,
1313
Scp106Secondary,
14-
Scp106Bottom,
1514
Scp173Armory,
1615
Scp173Connector,
1716
Scp173Gate,

Synapse3.SynapseModule/Events/RoundEvents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public class FirstSpawnEvent : IEvent
119119
public Team[] HumanQueue { get; set; }
120120
public bool EnableLateJoin { get; set; } = true;
121121
public bool EnableNormalSpawning { get; set; } = true;
122-
public bool CustomSpawning { get; set; } = false;
122+
public List<SynapsePlayer> PlayersBlockedFromSpawning { get; set; } = new();
123123
}
124124

125125
public class DecontaminationEvent : IEvent

Synapse3.SynapseModule/Item/SynapseItemAPI.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public partial class SynapseItem
1919
{
2020
public void EquipItem(SynapsePlayer player, bool dropWhenFull = true, bool provideFully = false)
2121
{
22-
if(player.RoleType is RoleTypeId.Spectator or RoleTypeId.None) return;
23-
2422
if (player.Inventory.Items.Count >= 8)
2523
{
2624
if (dropWhenFull)
@@ -96,7 +94,7 @@ public void Drop(Vector3 position)
9694

9795
if(!InventoryItemLoader.AvailableItems.TryGetValue(ItemType, out var exampleBase)) return;
9896

99-
if (owner is not null)
97+
if (owner != null)
10098
{
10199
rot = owner.CameraReference.rotation * exampleBase.PickupDropModel.transform.rotation;
102100
}

Synapse3.SynapseModule/Map/MapService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ public DoorType GetDoorByName(string doorName)
202202

203203
{ "106_PRIMARY", DoorType.Scp106Primary },
204204
{ "106_SECONDARY", DoorType.Scp106Secondary },
205-
{ "106_BOTTOM", DoorType.Scp106Bottom },
206-
205+
207206
{ "Unsecured Pryable GateDoor", DoorType.Scp049Gate },
208207
{ "049_ARMORY", DoorType.Scp049Armory },
209208

Synapse3.SynapseModule/Map/NukeService.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,17 @@ public NukeState State
6262
WarheadController.CooldownEndTime <= NetworkTime.time && !WarheadController.IsLocked;
6363

6464
public void StartDetonation()
65-
=> WarheadController.StartDetonation();
65+
{
66+
WarheadController.InstantPrepare();
67+
WarheadController.StartDetonation();
68+
}
6669

6770
public void CancelDetonation()
6871
=> WarheadController.CancelDetonation();
6972

7073
public void Shake() => WarheadController.RpcShake(true);
71-
72-
public void InstantDetonation()
73-
{
74-
WarheadController.InstantPrepare();
75-
WarheadController.StartDetonation(false, true);
76-
}
74+
75+
public void InstantDetonation() => WarheadController.ForceTime(0f);
7776

7877
public class NukeInsidePanel
7978
{

Synapse3.SynapseModule/Patching/Patches/EventPlayerPatches.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ public static bool LockerInteract(Locker __instance, ReferenceHub ply, byte coll
751751
{
752752
if (colliderId >= __instance.Chambers.Length || !__instance.Chambers[colliderId].CanInteract) return false;
753753
var player = ply.GetSynapsePlayer();
754-
var hasPerms = __instance.Chambers[colliderId].RequiredPermissions.CheckPermission(player);
754+
var hasPerms = __instance.Chambers[colliderId].RequiredPermissions.CheckPermission(player, true);
755755
var locker = __instance.GetSynapseLocker();
756756
var ev = new LockerUseEvent(player, hasPerms, locker, locker.Chambers[colliderId])
757757
{

Synapse3.SynapseModule/Patching/Patches/EventRoundPatches.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static bool RoundSummaryOverride(RoundSummary __instance, ref IEnumerator
5050
[SynapsePatch("FirstSpawn", PatchType.RoundEvent)]
5151
public static class FirstSpawnPatch
5252
{
53+
internal static List<SynapsePlayer> _blockedPlayer = new();
5354
private static readonly RoundEvents _round;
5455
static FirstSpawnPatch() => _round = Synapse.Get<RoundEvents>();
5556

@@ -98,10 +99,11 @@ public static bool OnRoundStarted()
9899
HumanQueue = RoleAssigner._humanQueue
99100
};
100101
_round.FirstSpawn.RaiseSafely(ev);
102+
_blockedPlayer = ev.PlayersBlockedFromSpawning;
101103
if (ev.EnableLateJoin)
102104
{
103105
RoleAssigner._spawned = true;
104-
RoleAssigner.LateJoinTimer.Reset();
106+
RoleAssigner.LateJoinTimer.Restart();
105107
}
106108

107109
if (!ev.EnableNormalSpawning) return false;
@@ -112,7 +114,7 @@ public static bool OnRoundStarted()
112114
{
113115
RoleAssigner.AlreadySpawnedPlayers.Add(hub.characterClassManager.UserId);
114116
}
115-
117+
_blockedPlayer.Clear();
116118
return false;
117119
}
118120
catch (Exception ex)
@@ -121,6 +123,14 @@ public static bool OnRoundStarted()
121123
return true;
122124
}
123125
}
126+
127+
[HarmonyPostfix]
128+
[HarmonyPatch(typeof(RoleAssigner), nameof(RoleAssigner.CheckPlayer))]
129+
public static void CheckPlayer(ref bool __result, ReferenceHub hub)
130+
{
131+
if (_blockedPlayer.Any(x => x.Hub == hub))
132+
__result = false;
133+
}
124134
}
125135

126136
[Automatic]

Synapse3.SynapseModule/Patching/Patches/RemoteAdminListPatches.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,12 @@ private static string GenerateList(List<RemoteAdminPlayer> players, CommandSende
175175
var colors = ServerService.Colors;
176176
color = colors.ElementAt(Random.Range(0, colors.Count)).Value;
177177
}
178-
color = ServerService.GetColorHexCode(color);
178+
else
179+
{
180+
color = ServerService.GetColorHexCode(color);
181+
}
179182

180-
text += "<align=center><size=0>(" + group.GroupId + ")</size> <size=20><color=" + color + ">[" +
183+
text += "<align=center><size=0>(-" + group.GroupId + ")</size> <size=20><color=" + color + ">[" +
181184
group.Name +
182185
"]</color></size>\n</align>";
183186

0 commit comments

Comments
 (0)