-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from JieGeLovesDengDuaLang/main
更改
- Loading branch information
Showing
10 changed files
with
113 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using COG.Listener; | ||
using COG.Listener.Event.Impl.Player; | ||
using COG.Rpc; | ||
using COG.UI.CustomButton; | ||
using COG.Utils; | ||
using COG.Utils.Coding; | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace COG.Role.Impl.Crewmate; | ||
|
||
[WorkInProgress] | ||
public class Technician : CustomRole | ||
{ | ||
public Technician() : base(Palette.Orange, CampType.Crewmate) | ||
{ | ||
RepairButton = CustomButton.Create(() => | ||
{ | ||
RpcUtils.StartRpcImmediately(PlayerControl.LocalPlayer, KnownRpc.ClearSabotages).Finish(); | ||
RepairSabotages(); | ||
}, | ||
() => RepairButton.ResetCooldown(), | ||
() => true, | ||
() => true, | ||
ResourceUtils.LoadSprite("COG.Resources.InDLL.Images.Buttons.Repair.png")!, | ||
2, | ||
KeyCode.F, | ||
"REPAIR", | ||
() => 0f, | ||
2 | ||
); | ||
|
||
AddButton(RepairButton); | ||
} | ||
|
||
private CustomButton RepairButton { get; } | ||
|
||
[EventHandler(EventHandlerType.Postfix)] | ||
public void OnPlayerFixedUpdate(PlayerFixedUpdateEvent _) | ||
{ | ||
var ventButton = HudManager.Instance.ImpostorVentButton; | ||
if (PlayerControl.LocalPlayer.AllTasksCompleted()) | ||
{ | ||
|
||
} | ||
} | ||
|
||
[EventHandler(EventHandlerType.Postfix)] | ||
public void OnRpcReceived(PlayerHandleRpcEvent @event) | ||
{ | ||
if ((KnownRpc)@event.CallId == KnownRpc.ClearSabotages) | ||
{ | ||
RepairSabotages(); | ||
} | ||
} | ||
|
||
public void RepairSabotages() | ||
{ | ||
var ship = ShipStatus.Instance; | ||
var mapId = (MapNames)(AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay ? | ||
AmongUsClient.Instance.TutorialMapId : | ||
GameUtils.GetGameOptions().MapId); | ||
|
||
ship.RepairCriticalSabotages(); | ||
if (ship.Systems.TryGetValueSafeIl2Cpp(SystemTypes.Electrical, out var system)) | ||
{ | ||
var elecSystem = system.TryCast<SwitchSystem>(); | ||
if (elecSystem != null) | ||
elecSystem.ActualSwitches = elecSystem.ExpectedSwitches; | ||
} | ||
|
||
ship.UpdateSystem(SystemTypes.Comms, PlayerControl.LocalPlayer, 16 | 0); | ||
ship.UpdateSystem(SystemTypes.Comms, PlayerControl.LocalPlayer, 16 | 1); | ||
|
||
if (mapId != MapNames.Mira) | ||
ship.AllDoors.ForEach(d => d.SetDoorway(true)); | ||
|
||
if (mapId == MapNames.Fungle) | ||
{ | ||
var mixup = ship.Cast<FungleShipStatus>().specialSabotage; | ||
if (mixup.IsActive) | ||
mixup.currentSecondsUntilHeal = 0.1f; | ||
} | ||
} | ||
|
||
public override CustomRole NewInstance() | ||
{ | ||
return new Technician(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters