Skip to content

Commit a0ee794

Browse files
committed
Update v1.1.2.0
1 parent cc6c824 commit a0ee794

File tree

12 files changed

+40
-51
lines changed

12 files changed

+40
-51
lines changed

CHANGELOG.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
v1.1.1.9更新日志
1+
v1.1.2.0更新日志
22

3-
* 新增中立杀手职业:鹈鹕
4-
* 压缩音频资源,减少dll文件大小
5-
* 对选项界面进行优化,使其更加流畅不会持续卡顿
6-
* 怨灵:死亡后的视野仍然与存活时无异(视野无法穿墙)
7-
* 怨灵:使用复活技能后,会自动复活在离玩家最近的出生点
8-
* 警长、捕快:职业优化,允许同时存在多个警长
9-
* 跟班:优化按钮,晋升豺狼时不会再重置击杀按钮cd
10-
* 月下狼人:对按钮分布进行优化,使其使用击杀按钮更方便
11-
* 巨人:修复碰撞体积的问题
12-
* 魅魔:修复胜利条件(第N次修复,这次真的没问题了!)
13-
14-
注:本次仅更新Lite分支
3+
* 修复部分bug。

TheOtherRoles/Buttons/Buttons.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,12 +2262,12 @@ public static void createButtonsPostfix(HudManager __instance)
22622262
(byte)CustomRPC.GrenadierFlash, SendOption.Reliable);
22632263
writer.Write(false);
22642264
AmongUsClient.Instance.FinishRpcImmediately(writer);
2265-
RPCProcedure.grenadierFlash();
2265+
RPCProcedure.grenadierFlash(false);
22662266
},
22672267
() =>
22682268
{
22692269
/* Can See */
2270-
return Grenadier.grenadier != null && Grenadier.grenadier == CachedPlayer.LocalPlayer.PlayerControl
2270+
return Grenadier.Player != null && Grenadier.Player == CachedPlayer.LocalPlayer.PlayerControl
22712271
&& !CachedPlayer.LocalPlayer.Data.IsDead;
22722272
},
22732273
() =>

TheOtherRoles/Patches/PlayerControlPatch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,9 +2116,9 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] Player
21162116
public static void HandleMurderPostfix(PlayerControl __instance, PlayerControl target)
21172117
{
21182118
// Collect dead player info
2119-
var deadPlayer = new DeadPlayer(target, DateTime.UtcNow, CustomDeathReason.Kill, __instance);
2120-
if (__instance == target) deadPlayer = new DeadPlayer(target, DateTime.UtcNow, CustomDeathReason.Suicide, __instance);
2121-
if (DeadPlayers.Any(x => x.Player != target)) DeadPlayers.Add(deadPlayer);
2119+
var deathReason = __instance == target ? CustomDeathReason.Suicide : CustomDeathReason.Kill;
2120+
var deadPlayer = new DeadPlayer(target, DateTime.UtcNow, deathReason, __instance);
2121+
DeadPlayers.Add(deadPlayer);
21222122

21232123
// Reset killer to crewmate if resetToCrewmate
21242124
if (resetToCrewmate) __instance.Data.Role.TeamType = RoleTeamTypes.Crewmate;

TheOtherRoles/Patches/UpdatePatch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ private static void setNameColors()
131131
setPlayerNameColor(WolfLord.Player, WolfLord.color);
132132
}
133133

134-
if (Grenadier.grenadier != null && ((localPlayer.isImpostor() && Grenadier.indicatorsMode)
135-
|| localPlayer == Grenadier.grenadier || shouldShowGhostInfo()))
134+
if (Grenadier.Player != null && ((localPlayer.isImpostor() && Grenadier.indicatorsMode)
135+
|| localPlayer == Grenadier.Player || shouldShowGhostInfo()))
136136
{
137137
foreach (var p in Grenadier.controls)
138138
{

TheOtherRoles/RPC.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public static void setRole(byte roleId, byte playerId)
309309
PartTimer.partTimer = player;
310310
break;
311311
case RoleId.Grenadier:
312-
Grenadier.grenadier = player;
312+
Grenadier.Player = player;
313313
break;
314314
case RoleId.Veteran:
315315
Veteran.veteran = player;
@@ -922,13 +922,13 @@ public static void swapperSwap(byte playerId1, byte playerId2)
922922
}
923923
}
924924

925-
public static void grenadierFlash()
925+
public static void grenadierFlash(bool clear = false)
926926
{
927-
var closestPlayers = GetClosestPlayers(Grenadier.grenadier.GetTruePosition(), Grenadier.radius, true);
927+
var closestPlayers = GetClosestPlayers(Grenadier.Player.GetTruePosition(), Grenadier.radius, true);
928928
Grenadier.controls = closestPlayers;
929929
foreach (var player in closestPlayers)
930930
{
931-
if (CachedPlayer.LocalId == player.PlayerId)
931+
if (PlayerControl.LocalPlayer.PlayerId == player.PlayerId)
932932
{
933933
if (player.isImpostor() && !player.IsDead() && !MeetingHud.Instance)
934934
{
@@ -1164,7 +1164,7 @@ public static void erasePlayerRoles(byte playerId, bool ignoreModifier = true)
11641164
if (player == Blackmailer.blackmailer) Blackmailer.clearAndReload();
11651165
if (player == Terrorist.terrorist) Terrorist.clearAndReload();
11661166
if (player == Gambler.gambler) Gambler.clearAndReload();
1167-
if (player == Grenadier.grenadier) Grenadier.clearAndReload();
1167+
if (player == Grenadier.Player) Grenadier.clearAndReload();
11681168

11691169
// Other roles
11701170
if (player == Jester.jester) Jester.clearAndReload();
@@ -2421,7 +2421,7 @@ private static bool Prefix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)
24212421
RPCProcedure.yoyoMarkLocation(reader.ReadBytesAndSize());
24222422
break;
24232423
case CustomRPC.GrenadierFlash:
2424-
RPCProcedure.grenadierFlash();
2424+
RPCProcedure.grenadierFlash(reader.ReadBoolean());
24252425
break;
24262426
case CustomRPC.WitnessReport:
24272427
Witness.WitnessReport(reader.ReadByte());

TheOtherRoles/Roles/Ghost/Specter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static void TakeRole(byte targetId)
141141
break;
142142
case RoleId.Grenadier:
143143
if (resetRole) Grenadier.clearAndReload();
144-
Grenadier.grenadier = local;
144+
Grenadier.Player = local;
145145
break;
146146
case RoleId.Survivor:
147147
Survivor.Player.Add(local);

TheOtherRoles/Roles/Impostor/Grenadier.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TheOtherRoles.Roles.Impostor;
88

99
public class Grenadier
1010
{
11-
public static PlayerControl grenadier;
11+
public static PlayerControl Player;
1212
public static Color color = Palette.ImpostorRed;
1313
public static Color flash = new Color32(150, 150, 150, byte.MaxValue);
1414
public static List<PlayerControl> controls = new();
@@ -37,12 +37,12 @@ public static void showFlash(Color color, float duration = 10f, float alpha = 1f
3737
if (InMeeting)
3838
{
3939
renderer.enabled = false;
40-
if (CachedPlayer.LocalId == grenadier.PlayerId && controls.Count > 0)
40+
if (PlayerControl.LocalPlayer.PlayerId == Player?.PlayerId && controls?.Count > 0)
4141
{
42-
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
43-
(byte)CustomRPC.GrenadierFlash, SendOption.Reliable);
42+
var writer = StartRPC(PlayerControl.LocalPlayer, CustomRPC.GrenadierFlash);
4443
writer.Write(true);
45-
AmongUsClient.Instance.FinishRpcImmediately(writer);
44+
writer.EndRPC();
45+
RPCProcedure.grenadierFlash(true);
4646
controls.Clear();
4747
}
4848
return;
@@ -58,12 +58,12 @@ public static void showFlash(Color color, float duration = 10f, float alpha = 1f
5858
var fadeOutProgress = (p - (1 - fadeFraction)) / fadeFraction;
5959
if (renderer != null) renderer.color = new Color(color.r, color.g, color.b, Mathf.Clamp01((1 - fadeOutProgress) * alpha));
6060

61-
if (CachedPlayer.LocalId == grenadier.PlayerId && controls.Count > 0)
61+
if (PlayerControl.LocalPlayer.PlayerId == Player?.PlayerId && controls?.Count > 0)
6262
{
63-
var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId,
64-
(byte)CustomRPC.GrenadierFlash, SendOption.Reliable);
63+
var writer = StartRPC(PlayerControl.LocalPlayer, CustomRPC.GrenadierFlash);
6564
writer.Write(true);
66-
AmongUsClient.Instance.FinishRpcImmediately(writer);
65+
writer.EndRPC();
66+
RPCProcedure.grenadierFlash(true);
6767
controls.Clear();
6868
}
6969
}
@@ -78,7 +78,7 @@ public static void showFlash(Color color, float duration = 10f, float alpha = 1f
7878

7979
public static void clearAndReload()
8080
{
81-
grenadier = null;
81+
Player = null;
8282
controls.Clear();
8383
cooldown = CustomOptionHolder.grenadierCooldown.GetFloat();
8484
duration = CustomOptionHolder.grenadierDuration.GetFloat() + 0.5f;

TheOtherRoles/Roles/Modifier/Aftermath.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,32 +348,32 @@ public static void afterTrigger(byte playerId, byte killerId)
348348
SoundEffectsManager.play("morphlingMorph");
349349
camouflagerButton.Timer = camouflagerButton.MaxTimer;
350350
}
351-
else if (Grenadier.grenadier == killer)
351+
else if (Grenadier.Player == killer)
352352
{
353353
var writer = AmongUsClient.Instance.StartRpcImmediately(killer.NetId,
354354
(byte)CustomRPC.GrenadierFlash, SendOption.Reliable);
355355
writer.Write(false);
356356
AmongUsClient.Instance.FinishRpcImmediately(writer);
357-
grenadierFlash();
357+
grenadierFlash(false);
358358
grenadierFlashButton.Timer = grenadierFlashButton.MaxTimer + Grenadier.duration;
359359
}
360360
else if (Swooper.swooper == killer)
361361
{
362-
var invisibleWriter = AmongUsClient.Instance.StartRpcImmediately(killer.NetId,
362+
var writer = AmongUsClient.Instance.StartRpcImmediately(killer.NetId,
363363
(byte)CustomRPC.SetSwoop, SendOption.Reliable);
364-
invisibleWriter.Write(killer.PlayerId);
365-
invisibleWriter.Write(byte.MinValue);
366-
AmongUsClient.Instance.FinishRpcImmediately(invisibleWriter);
364+
writer.Write(killer.PlayerId);
365+
writer.Write(byte.MinValue);
366+
AmongUsClient.Instance.FinishRpcImmediately(writer);
367367
setSwoop(Swooper.swooper.PlayerId, byte.MinValue);
368368
swooperSwoopButton.Timer = swooperSwoopButton.MaxTimer + Swooper.duration;
369369
}
370370
else if (Jackal.jackal.Any(x => x == killer) && Jackal.canSwoop)
371371
{
372-
var invisibleWriter = AmongUsClient.Instance.StartRpcImmediately(killer.NetId,
372+
var writer = AmongUsClient.Instance.StartRpcImmediately(killer.NetId,
373373
(byte)CustomRPC.SetJackalSwoop, SendOption.Reliable);
374-
invisibleWriter.Write(killer.PlayerId);
375-
invisibleWriter.Write(byte.MinValue);
376-
AmongUsClient.Instance.FinishRpcImmediately(invisibleWriter);
374+
writer.Write(killer.PlayerId);
375+
writer.Write(byte.MinValue);
376+
AmongUsClient.Instance.FinishRpcImmediately(writer);
377377
setJackalSwoop(killer.PlayerId, byte.MinValue);
378378
jackalSwoopButton.Timer = jackalSwoopButton.MaxTimer + Jackal.duration;
379379
}

TheOtherRoles/Roles/Neutral/Amnisiac.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static void TakeRole(byte targetId, byte playerId)
161161
break;
162162
case RoleId.Grenadier:
163163
if (resetRole) Grenadier.clearAndReload();
164-
Grenadier.grenadier = local;
164+
Grenadier.Player = local;
165165
break;
166166

167167
case RoleId.Survivor:

TheOtherRoles/Roles/Neutral/Thief.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static void StealsRole(byte playerId)
9797
if (target == Gambler.gambler) Gambler.gambler = thief;
9898
if (target == Cleaner.cleaner) Cleaner.cleaner = thief;
9999
if (target == Warlock.warlock) Warlock.warlock = thief;
100-
if (target == Grenadier.grenadier) Grenadier.grenadier = thief;
100+
if (target == Grenadier.Player) Grenadier.Player = thief;
101101
if (target == WolfLord.Player) WolfLord.Player = thief;
102102
if (target == BountyHunter.bountyHunter) BountyHunter.bountyHunter = thief;
103103
if (target == Witch.witch)

0 commit comments

Comments
 (0)