quantum-space-buddies/QSB/ItemSync/ItemState.cs

44 lines
1018 B
C#
Raw Normal View History

2022-07-25 12:09:51 +00:00
using QSB.Player;
using UnityEngine;
namespace QSB.ItemSync;
2022-07-25 16:20:44 +00:00
/// <summary>
/// used for initial state sync.
2022-07-25 16:33:27 +00:00
/// we have to store this separately because it's not saved in the item itself, unfortunately.
2022-08-18 19:46:21 +00:00
///
/// BUG: there are some cases (like remote unsocket) where HasBeenInteractedWith or other state isn't set.
2022-07-25 16:20:44 +00:00
/// </summary>
2022-07-25 12:09:51 +00:00
public class ItemState
{
2022-07-25 16:20:44 +00:00
/// <summary>
/// if this is false, there's no need to sync initial state for this item
/// </summary>
public bool HasBeenInteractedWith;
2022-07-25 12:09:51 +00:00
2022-07-25 16:20:44 +00:00
public ItemStateType State;
2022-07-25 12:09:51 +00:00
// on ground
public Transform Parent;
public Vector3 LocalPosition;
public Vector3 WorldPosition => Parent.TransformPoint(LocalPosition);
public Vector3 LocalNormal;
public Vector3 WorldNormal => Parent.TransformDirection(LocalNormal);
public Sector Sector;
public IItemDropTarget CustomDropTarget;
public OWRigidbody Rigidbody;
// held
public PlayerInfo HoldingPlayer;
// socketed
public OWItemSocket Socket;
}
public enum ItemStateType
{
OnGround,
Held,
Socketed
2022-07-25 16:20:44 +00:00
}