New mod: PlayerPickUp

This commit is contained in:
SDraw 2025-04-28 21:53:37 +03:00
parent e9ed898b9a
commit fd9809bd62
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
19 changed files with 793 additions and 23 deletions

32
ml_ppu/GrabDetector.cs Normal file
View file

@ -0,0 +1,32 @@
using ABI.CCK.Components;
using ABI_RC.Core.Networking.IO.Social;
using ABI_RC.Core.Player;
using UnityEngine;
namespace ml_ppu
{
class GrabDetector : MonoBehaviour
{
void OnTriggerEnter(Collider p_collider)
{
if(!Settings.Enabled)
return;
CVRPointer l_pointer = p_collider.GetComponent<CVRPointer>();
if((l_pointer != null) && (l_pointer.type == "grab") && RestrictionsCheck(p_collider.transform.root))
PickUpManager.Instance?.OnGrabDetected(p_collider, l_pointer);
}
static bool RestrictionsCheck(Transform p_transform)
{
if(p_transform == PlayerSetup.Instance.transform)
return false;
PlayerDescriptor l_playerDescriptor = p_transform.GetComponent<PlayerDescriptor>();
if(l_playerDescriptor != null)
return (!Settings.FriendsOnly || Friends.FriendsWith(l_playerDescriptor.ownerId));
return false;
}
}
}