Advertisement
glados123123123123

Untitled

Jan 17th, 2024
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1.         public override void ItemActivate(bool used, bool buttonDown = true)
  2.         {
  3.             base.ItemActivate(used, buttonDown);
  4.             if (NetworkManager.Singleton.IsServer)
  5.             {
  6.                 ServerRCPThrow();
  7.             }
  8.             else { ClientRequestDiscardHeldObject(); }
  9.  
  10.         }
  11.  
  12.         [ClientRpc]
  13.         public void ClientRequestDiscardHeldObject()
  14.         {
  15.             ServerRCPThrow();
  16.         }
  17.  
  18.         [ServerRpc]
  19.         public void ServerRCPThrow()
  20.         {
  21.             if (!canThrowWhenNotCharged && insertedBattery.charge <= 0)
  22.             {
  23.                 return;
  24.             }
  25.             if (isThrown || instaThrow)
  26.             {
  27.                 playerHeldBy.DiscardHeldObject(placeObject: true, null, GetThrowDestination());
  28.                 itemUsedUp = true;
  29.             }
  30.             isThrown = true;
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement