|
7 | 7 | using System; |
8 | 8 | using System.Collections.Generic; |
9 | 9 | using System.Linq; |
| 10 | +using System.Reflection; |
10 | 11 | using TheOtherRoles.Patches; |
11 | | -using TheOtherRoles.Players; |
12 | 12 | using TheOtherRoles.Utilities; |
13 | 13 | using TMPro; |
14 | 14 | using UnityEngine; |
15 | 15 | using UnityEngine.Video; |
16 | 16 | using static TheOtherRoles.Snitch; |
17 | 17 | using static UnityEngine.GraphicsBuffer; |
18 | 18 |
|
| 19 | + |
19 | 20 | namespace TheOtherRoles.CustomGameModes { |
20 | 21 | [HarmonyPatch] |
21 | 22 | class PropHunt { |
@@ -324,29 +325,29 @@ public static Sprite getDisguiseButtonSprite() { |
324 | 325 |
|
325 | 326 | public static Sprite getUnstuckButtonSprite() { |
326 | 327 | if (unstuckButtonSprite) return unstuckButtonSprite; |
327 | | - unstuckButtonSprite = CustomMain.customZips.UnStuck; |
| 328 | + unstuckButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.UnStuck.png", 115f); |
328 | 329 | return unstuckButtonSprite; |
329 | 330 | } |
330 | 331 | public static Sprite getRevealButtonSprite() { |
331 | 332 | if (revealButtonSprite) return revealButtonSprite; |
332 | | - revealButtonSprite = CustomMain.customZips.Reveal; |
| 333 | + revealButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Reveal.png", 115f); |
333 | 334 | return revealButtonSprite; |
334 | 335 | } |
335 | 336 |
|
336 | 337 | public static Sprite getInvisButtonSprite() { |
337 | 338 | if (invisButtonSprite) return invisButtonSprite; |
338 | | - invisButtonSprite = CustomMain.customZips.InvisButton; |
| 339 | + invisButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.InvisButton.png", 115f); |
339 | 340 | return invisButtonSprite; |
340 | 341 | } |
341 | 342 |
|
342 | 343 | public static Sprite getFindButtonSprite() { |
343 | 344 | if (findButtonSprite) return findButtonSprite; |
344 | | - findButtonSprite = CustomMain.customZips.FindButton; |
| 345 | + findButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.FindButton.png", 115f); |
345 | 346 | return findButtonSprite; |
346 | 347 | } |
347 | 348 | public static Sprite getSpeedboostButtonSprite() { |
348 | 349 | if (speedboostButtonSprite) return speedboostButtonSprite; |
349 | | - speedboostButtonSprite = CustomMain.customZips.SpeedboostButton; |
| 350 | + speedboostButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.SpeedboostButton.png", 115f); |
350 | 351 | return speedboostButtonSprite; |
351 | 352 | } |
352 | 353 |
|
@@ -399,7 +400,8 @@ public static void SpeedbostPostfix(PlayerPhysics __instance) { |
399 | 400 |
|
400 | 401 | [HarmonyPatch(typeof(CustomNetworkTransform), nameof(CustomNetworkTransform.FixedUpdate))] |
401 | 402 | [HarmonyPostfix] |
402 | | - public static void PostfixNetworkSpeed(CustomNetworkTransform __instance) { |
| 403 | + public static void PostfixNetworkSpeed(CustomNetworkTransform __instance) |
| 404 | + { |
403 | 405 | if (__instance.AmOwner || !speedboostActive.ContainsKey(__instance.myPlayer.PlayerId)) return; |
404 | 406 | if (GameData.Instance && __instance.myPlayer.CanMove) |
405 | 407 | __instance.body.velocity *= speedboostRatio; |
@@ -459,20 +461,19 @@ public static void IntroCutsceneDestroyPatch(IntroCutscene __instance) |
459 | 461 | }))); |
460 | 462 | } |
461 | 463 |
|
| 464 | + |
462 | 465 | [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))] |
463 | 466 | [HarmonyPostfix] |
464 | | - public static void PlayerControlFixedUpdatePatch(PlayerControl __instance) |
465 | | - { |
| 467 | + public static void PlayerControlFixedUpdatePatch(PlayerControl __instance) { |
466 | 468 | if (!PropHunt.isPropHuntGM) return; |
467 | | - if (__instance.Data.Role.IsImpostor) |
468 | | - { |
469 | | - __instance.GetComponent<CircleCollider2D>().radius = 0.2234f; |
470 | | - return; |
471 | | - } |
472 | | - if (__instance.GetComponent<SpriteRenderer>() != null || __instance.Data.IsDead) return; |
| 469 | + if (__instance.Data.Role.IsImpostor) { |
| 470 | + __instance.GetComponent<CircleCollider2D>().radius = 0.2234f; |
| 471 | + return; |
| 472 | + } |
| 473 | + if (__instance.GetComponent<SpriteRenderer>() != null || __instance.Data.IsDead) return; |
473 | 474 |
|
474 | | - __instance.gameObject.AddComponent<SpriteRenderer>(); |
475 | | - __instance.GetComponent<CircleCollider2D>().radius = 0.00001f; |
| 475 | + __instance.gameObject.AddComponent<SpriteRenderer>(); |
| 476 | + __instance.GetComponent<CircleCollider2D>().radius = 0.00001f; |
476 | 477 | } |
477 | 478 |
|
478 | 479 |
|
@@ -561,7 +562,7 @@ public static bool AdminUsePostfix(MapConsole __instance) { |
561 | 562 | [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.MurderPlayer))] |
562 | 563 | [HarmonyPostfix] |
563 | 564 | public static void MurderPlayerPostfix(PlayerControl __instance, [HarmonyArgument(0)] PlayerControl target) { |
564 | | - if (!PropHunt.isPropHuntGM || target != CachedPlayer.LocalPlayer.PlayerControl) return; |
| 565 | + if (!PropHunt.isPropHuntGM || target != PlayerControl.LocalPlayer) return; |
565 | 566 | try { |
566 | 567 | target.NetTransform.RpcSnapTo(__instance.transform.position); |
567 | 568 | } catch { } |
@@ -597,7 +598,7 @@ public static bool KillButtonClickPatch(KillButton __instance) { |
597 | 598 | if (__instance.currentTarget == null) { |
598 | 599 | PlayerControl.LocalPlayer.SetKillTimer(killCooldownMiss); |
599 | 600 | } else { // There is a target, execute kill! |
600 | | - MurderAttemptResult res = Helpers.checkMurderAttemptAndKill(CachedPlayer.LocalPlayer.PlayerControl, __instance.currentTarget); |
| 601 | + MurderAttemptResult res = Helpers.checkMurderAttemptAndKill(PlayerControl.LocalPlayer, __instance.currentTarget); |
601 | 602 | __instance.SetTarget(null); |
602 | 603 | PlayerControl.LocalPlayer.SetKillTimer(killCooldownHit); |
603 | 604 | } |
|
0 commit comments