This repository was archived by the owner on Jan 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoWarheadPatch.cs
More file actions
70 lines (65 loc) · 3 KB
/
Copy pathAutoWarheadPatch.cs
File metadata and controls
70 lines (65 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System.Collections.Generic;
using helpers.Patching;
using Mirror;
using Interactables.Interobjects.DoorUtils;
using Compendium.Features;
using Interactables.Interobjects;
using PlayerRoles.PlayableScps.Scp079;
using PlayerRoles.PlayableScps.Scp079.Cameras;
namespace AutoWarhead {
public static class AutoWarheadPatch {
[Patch(typeof(Scp079DoorAbility), nameof(Scp079DoorAbility.ValidateAction), PatchType.Prefix, "SCP-079 door patch")]
public static bool DoorPatch(ref bool __result, DoorAction action, DoorVariant door, Scp079Camera currentCamera) {
if (!Scp079DoorAbility.CheckVisibility(door, currentCamera)) {
__result = false;
return false;
}
if (NetworkServer.active && AlphaWarheadController.InProgress && !AlphaWarheadController.Detonated) {
__result = false;
return false;
}
DoorLockMode mode = DoorLockUtils.GetMode((DoorLockReason)door.ActiveLocks);
IDamageableDoor damageableDoor = door as IDamageableDoor;
if (damageableDoor != null && damageableDoor.IsDestroyed) {
__result = false;
return false;
}
if (mode.HasFlagFast(DoorLockMode.ScpOverride)) {
__result = true;
return false;
}
switch (action) {
case DoorAction.Opened:
__result = mode.HasFlagFast(DoorLockMode.CanOpen);
return false;
case DoorAction.Closed:
__result = mode.HasFlagFast(DoorLockMode.CanClose);
return false;
case DoorAction.Locked:
__result = mode != DoorLockMode.FullLock && !(door is CheckpointDoor);
return false;
case DoorAction.Unlocked:
__result = true;
return false;
}
__result = false;
return false;
}
[Patch(typeof(AlphaWarheadController), nameof(AlphaWarheadController.Detonate), PatchType.Prefix, "SCP-079 Camera change")]
public static bool CameraChange() {
List<Scp079Camera> surfaceCameras = new List<Scp079Camera>();
foreach (Scp079InteractableBase scp079InteractableBase in Scp079InteractableBase.AllInstances) {
Scp079Camera scp079Camera = scp079InteractableBase as Scp079Camera;
if (scp079Camera != null && scp079Camera.Room.Zone == MapGeneration.FacilityZone.Surface) {
surfaceCameras.Add(scp079Camera);
}
}
if (surfaceCameras.Count < 1) return true;
foreach (Scp079Role scp079role in Scp079Role.ActiveInstances) {
if (scp079role._curCamSync.CurrentCamera.Room.Zone != MapGeneration.FacilityZone.Surface)
scp079role._curCamSync.CurrentCamera = surfaceCameras[0];
}
return true;
}
}
}