Added RocketAssemblyStation and ReadyRocket

This commit is contained in:
2026-08-18 16:12:00 +03:00
parent 7a0ee6b519
commit 63d2836dc9
85 changed files with 15087 additions and 3562 deletions
@@ -0,0 +1,49 @@
using Unity.Netcode;
using UnityEngine;
[DisallowMultipleComponent]
public sealed class NetworkUsableHandItemInteractable : NetworkHandItemInteractable
{
[Tooltip("Component on this prefab implementing IHandItemUseAction.")]
[SerializeField] private MonoBehaviour useActionComponent;
private IHandItemUseAction UseAction => useActionComponent as IHandItemUseAction;
protected override void Awake()
{
base.Awake();
ResolveUseAction();
}
private void OnValidate() => ResolveUseAction();
protected override void UseOnServer(NetworkObject playerObject)
{
if (UseAction == null)
{
Debug.LogWarning(
$"{name} was used but has no IHandItemUseAction component assigned.",
this);
return;
}
UseAction.TryUseOnServer(playerObject);
}
private void ResolveUseAction()
{
if (useActionComponent is IHandItemUseAction)
return;
foreach (MonoBehaviour component in GetComponents<MonoBehaviour>())
{
if (component is IHandItemUseAction)
{
useActionComponent = component;
return;
}
}
useActionComponent = null;
}
}