Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,9 @@
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.Hands.Components
{
public interface ISharedHandsComponent : IComponent
{
}
}

View File

@@ -0,0 +1,147 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.Hands.Components
{
public abstract class SharedHandsComponent : Component, ISharedHandsComponent
{
public sealed override string Name => "Hands";
public sealed override uint? NetID => ContentNetIDs.HANDS;
/// <returns>true if the item is in one of the hands</returns>
public abstract bool IsHolding(IEntity item);
}
[Serializable, NetSerializable]
public sealed class SharedHand
{
public readonly int Index;
public readonly string Name;
public readonly EntityUid? EntityUid;
public readonly HandLocation Location;
public readonly bool Enabled;
public SharedHand(int index, string name, EntityUid? entityUid, HandLocation location, bool enabled)
{
Index = index;
Name = name;
EntityUid = entityUid;
Location = location;
Enabled = enabled;
}
}
// The IDs of the items get synced over the network.
[Serializable, NetSerializable]
public class HandsComponentState : ComponentState
{
public readonly SharedHand[] Hands;
public readonly string? ActiveIndex;
public HandsComponentState(SharedHand[] hands, string? activeIndex) : base(ContentNetIDs.HANDS)
{
Hands = hands;
ActiveIndex = activeIndex;
}
}
/// <summary>
/// A message that calls the use interaction on an item in hand, presumed for now the interaction will occur only on the active hand.
/// </summary>
[Serializable, NetSerializable]
public class UseInHandMsg : ComponentMessage
{
public UseInHandMsg()
{
Directed = true;
}
}
/// <summary>
/// A message that calls the activate interaction on the item in Index.
/// </summary>
[Serializable, NetSerializable]
public class ActivateInHandMsg : ComponentMessage
{
public string Index { get; }
public ActivateInHandMsg(string index)
{
Directed = true;
Index = index;
}
}
[Serializable, NetSerializable]
public class ClientAttackByInHandMsg : ComponentMessage
{
public string Index { get; }
public ClientAttackByInHandMsg(string index)
{
Directed = true;
Index = index;
}
}
[Serializable, NetSerializable]
public class ClientChangedHandMsg : ComponentMessage
{
public string Index { get; }
public ClientChangedHandMsg(string index)
{
Directed = true;
Index = index;
}
}
[Serializable, NetSerializable]
public class HandEnabledMsg : ComponentMessage
{
public string Name { get; }
public HandEnabledMsg(string name)
{
Name = name;
}
}
[Serializable, NetSerializable]
public class HandDisabledMsg : ComponentMessage
{
public string Name { get; }
public HandDisabledMsg(string name)
{
Name = name;
}
}
public enum HandLocation : byte
{
Left,
Middle,
Right
}
/// <summary>
/// Component message for displaying an animation of an entity flying towards the owner of a HandsComponent
/// </summary>
[Serializable, NetSerializable]
public class AnimatePickupEntityMessage : ComponentMessage
{
public readonly EntityUid EntityId;
public readonly EntityCoordinates EntityPosition;
public AnimatePickupEntityMessage(EntityUid entity, EntityCoordinates entityPosition)
{
Directed = true;
EntityId = entity;
EntityPosition = entityPosition;
}
}
}

View File

@@ -0,0 +1,62 @@
#nullable enable
using System;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Hands
{
/// <summary>
/// This interface gives components behavior when their entity is put in a hand inventory slot,
/// even if it came from another hand slot (which would also fire <see cref="IUnequippedHand"/>).
/// This includes moving the entity from a non-hand slot into a hand slot
/// (which would also fire <see cref="IUnequipped"/>).
/// </summary>
[RequiresExplicitImplementation]
public interface IEquippedHand
{
[Obsolete("Use EquippedHandMessage instead")]
void EquippedHand(EquippedHandEventArgs eventArgs);
}
public class EquippedHandEventArgs : UserEventArgs
{
public EquippedHandEventArgs(IEntity user, SharedHand hand) : base(user)
{
Hand = hand;
}
public SharedHand Hand { get; }
}
/// <summary>
/// Raised when putting an entity into a hand slot
/// </summary>
[PublicAPI]
public class EquippedHandEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that equipped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was equipped.
/// </summary>
public IEntity Equipped { get; }
/// <summary>
/// Hand that the item was placed into.
/// </summary>
public SharedHand Hand { get; }
public EquippedHandEvent(IEntity user, IEntity equipped, SharedHand hand)
{
User = user;
Equipped = equipped;
Hand = hand;
}
}
}

View File

@@ -0,0 +1,51 @@
#nullable enable
using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Hands
{
/// <summary>
/// This interface gives components behavior when they're held on a deselected hand.
/// </summary>
[RequiresExplicitImplementation]
public interface IHandDeselected
{
[Obsolete("Use HandDeselectedMessage instead")]
void HandDeselected(HandDeselectedEventArgs eventArgs);
}
public class HandDeselectedEventArgs : EventArgs
{
public HandDeselectedEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// Raised when an entity item in a hand is deselected.
/// </summary>
[PublicAPI]
public class HandDeselectedEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that owns the deselected hand.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item in the hand that was deselected.
/// </summary>
public IEntity Item { get; }
public HandDeselectedEvent(IEntity user, IEntity item)
{
User = user;
Item = item;
}
}
}

View File

@@ -0,0 +1,51 @@
#nullable enable
using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Hands
{
/// <summary>
/// This interface gives components behavior when they're held on the selected hand.
/// </summary>
[RequiresExplicitImplementation]
public interface IHandSelected
{
[Obsolete("Use HandSelectedMessage instead")]
void HandSelected(HandSelectedEventArgs eventArgs);
}
public class HandSelectedEventArgs : EventArgs
{
public HandSelectedEventArgs(IEntity user)
{
User = user;
}
public IEntity User { get; }
}
/// <summary>
/// Raised when an item entity held by a hand is selected.
/// </summary>
[PublicAPI]
public class HandSelectedEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that owns the selected hand.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item in the hand that was selected.
/// </summary>
public IEntity Item { get; }
public HandSelectedEvent(IEntity user, IEntity item)
{
User = user;
Item = item;
}
}
}

View File

@@ -0,0 +1,61 @@
#nullable enable
using System;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Hands
{
/// <summary>
/// This interface gives components behavior when their entity is removed from a hand slot,
/// even if it is going into another hand slot (which would also fire <see cref="IEquippedHand"/>).
/// This includes moving the entity from a hand slot into a non-hand slot (which would also fire <see cref="IEquipped"/>).
/// </summary>
[RequiresExplicitImplementation]
public interface IUnequippedHand
{
[Obsolete("Use UnequippedHandMessage instead")]
void UnequippedHand(UnequippedHandEventArgs eventArgs);
}
public class UnequippedHandEventArgs : UserEventArgs
{
public UnequippedHandEventArgs(IEntity user, SharedHand hand) : base(user)
{
Hand = hand;
}
public SharedHand Hand { get; }
}
/// <summary>
/// Raised when removing an entity from an inventory slot.
/// </summary>
[PublicAPI]
public class UnequippedHandEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that equipped the item.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Item that was unequipped.
/// </summary>
public IEntity Unequipped { get; }
/// <summary>
/// Hand that the item is removed from.
/// </summary>
public SharedHand Hand { get; }
public UnequippedHandEvent(IEntity user, IEntity unequipped, SharedHand hand)
{
User = user;
Unequipped = unequipped;
Hand = hand;
}
}
}