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,76 @@
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Shared.Weapons.Melee
{
/// <summary>
/// Raised directed on the used entity when a target entity is click attacked by a user.
/// </summary>
public class ClickAttackEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity used to attack, for broadcast purposes.
/// </summary>
public IEntity Used { get; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
/// <summary>
/// UID of the entity that was attacked.
/// </summary>
public EntityUid Target { get; }
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity? TargetEntity { get; }
public ClickAttackEvent(IEntity used, IEntity user, EntityCoordinates clickLocation, EntityUid target = default)
{
Used = used;
User = user;
ClickLocation = clickLocation;
Target = target;
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity);
TargetEntity = targetEntity;
}
}
/// <summary>
/// Raised directed on the used entity when a target entity is wide attacked by a user.
/// </summary>
public class WideAttackEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity used to attack, for broadcast purposes.
/// </summary>
public IEntity Used { get; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
public WideAttackEvent(IEntity used, IEntity user, EntityCoordinates clickLocation)
{
Used = used;
User = user;
ClickLocation = clickLocation;
}
}
}

View File

@@ -0,0 +1,55 @@
#nullable enable
using System;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Weapons.Melee
{
[Prototype("MeleeWeaponAnimation")]
public sealed class MeleeWeaponAnimationPrototype : IPrototype
{
[ViewVariables]
[DataField("id", required: true)]
public string ID { get; } = default!;
[ViewVariables]
[DataField("state")]
public string State { get; } = string.Empty;
[ViewVariables]
[DataField("prototype")]
public string Prototype { get; } = "WeaponArc";
[ViewVariables]
[DataField("length")]
public TimeSpan Length { get; } = TimeSpan.FromSeconds(0.5f);
[ViewVariables]
[DataField("speed")]
public float Speed { get; } = 1;
[ViewVariables]
[DataField("color")]
public Vector4 Color { get; } = new(1,1,1,1);
[ViewVariables]
[DataField("colorDelta")]
public Vector4 ColorDelta { get; } = Vector4.Zero;
[ViewVariables]
[DataField("arcType")]
public WeaponArcType ArcType { get; } = WeaponArcType.Slash;
[ViewVariables]
[DataField("width")]
public float Width { get; } = 90;
}
public enum WeaponArcType
{
Slash,
Poke,
}
}

View File

@@ -0,0 +1,48 @@
#nullable enable
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Melee
{
public static class MeleeWeaponSystemMessages
{
[Serializable, NetSerializable]
public sealed class PlayMeleeWeaponAnimationMessage : EntityEventArgs
{
public PlayMeleeWeaponAnimationMessage(string arcPrototype, Angle angle, EntityUid attacker, EntityUid source, List<EntityUid> hits, bool textureEffect = false, bool arcFollowAttacker = true)
{
ArcPrototype = arcPrototype;
Angle = angle;
Attacker = attacker;
Source = source;
Hits = hits;
TextureEffect = textureEffect;
ArcFollowAttacker = arcFollowAttacker;
}
public string ArcPrototype { get; }
public Angle Angle { get; }
public EntityUid Attacker { get; }
public EntityUid Source { get; }
public List<EntityUid> Hits { get; }
public bool TextureEffect { get; }
public bool ArcFollowAttacker { get; }
}
[Serializable, NetSerializable]
public sealed class PlayLungeAnimationMessage : EntityEventArgs
{
public Angle Angle { get; }
public EntityUid Source { get; }
public PlayLungeAnimationMessage(Angle angle, EntityUid source)
{
Angle = angle;
Source = source;
}
}
}
}

View File

@@ -0,0 +1,25 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Barrels.Components
{
[Serializable, NetSerializable]
public class BatteryBarrelComponentState : ComponentState
{
public FireRateSelector FireRateSelector { get; }
public (int count, int max)? Magazine { get; }
public BatteryBarrelComponentState(
FireRateSelector fireRateSelector,
(int count, int max)? magazine) :
base(ContentNetIDs.BATTERY_BARREL)
{
FireRateSelector = fireRateSelector;
Magazine = magazine;
}
}
}

View File

@@ -0,0 +1,31 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Barrels.Components
{
[Serializable, NetSerializable]
public class BoltActionBarrelComponentState : ComponentState
{
public (bool chambered, bool spent) Chamber { get; }
public FireRateSelector FireRateSelector { get; }
public (int count, int max)? Magazine { get; }
public string? SoundGunshot { get; }
public BoltActionBarrelComponentState(
(bool chambered, bool spent) chamber,
FireRateSelector fireRateSelector,
(int count, int max)? magazine,
string? soundGunshot) :
base(ContentNetIDs.BOLTACTION_BARREL)
{
Chamber = chamber;
FireRateSelector = fireRateSelector;
Magazine = magazine;
SoundGunshot = soundGunshot;
}
}
}

View File

@@ -0,0 +1,51 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Barrels.Components
{
[Serializable, NetSerializable]
public enum AmmoVisuals
{
AmmoCount,
AmmoMax,
Spent,
}
[Serializable, NetSerializable]
public enum MagazineBarrelVisuals
{
MagLoaded
}
[Serializable, NetSerializable]
public enum BarrelBoltVisuals
{
BoltOpen,
}
[Serializable, NetSerializable]
public class MagazineBarrelComponentState : ComponentState
{
public bool Chambered { get; }
public FireRateSelector FireRateSelector { get; }
public (int count, int max)? Magazine { get; }
public string? SoundGunshot { get; }
public MagazineBarrelComponentState(
bool chambered,
FireRateSelector fireRateSelector,
(int count, int max)? magazine,
string? soundGunshot) :
base(ContentNetIDs.MAGAZINE_BARREL)
{
Chambered = chambered;
FireRateSelector = fireRateSelector;
Magazine = magazine;
SoundGunshot = soundGunshot;
}
}
}

View File

@@ -0,0 +1,31 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Barrels.Components
{
[Serializable, NetSerializable]
public class PumpBarrelComponentState : ComponentState
{
public (bool chambered, bool spent) Chamber { get; }
public FireRateSelector FireRateSelector { get; }
public (int count, int max)? Magazine { get; }
public string? SoundGunshot { get; }
public PumpBarrelComponentState(
(bool chambered, bool spent) chamber,
FireRateSelector fireRateSelector,
(int count, int max)? magazine,
string? soundGunshot) :
base(ContentNetIDs.PUMP_BARREL)
{
Chamber = chamber;
FireRateSelector = fireRateSelector;
Magazine = magazine;
SoundGunshot = soundGunshot;
}
}
}

View File

@@ -0,0 +1,31 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Barrels.Components
{
[Serializable, NetSerializable]
public class RevolverBarrelComponentState : ComponentState
{
public int CurrentSlot { get; }
public FireRateSelector FireRateSelector { get; }
public bool?[] Bullets { get; }
public string? SoundGunshot { get; }
public RevolverBarrelComponentState(
int currentSlot,
FireRateSelector fireRateSelector,
bool?[] bullets,
string? soundGunshot) :
base(ContentNetIDs.REVOLVER_BARREL)
{
CurrentSlot = currentSlot;
FireRateSelector = fireRateSelector;
Bullets = bullets;
SoundGunshot = soundGunshot;
}
}
}

View File

@@ -0,0 +1,29 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Weapons.Ranged.Components
{
public abstract class SharedRangedBarrelComponent : Component
{
[ViewVariables]
public abstract FireRateSelector FireRateSelector { get; }
[ViewVariables]
public abstract FireRateSelector AllRateSelectors { get; }
[ViewVariables]
public abstract float FireRate { get; }
[ViewVariables]
public abstract int ShotsLeft { get; }
[ViewVariables]
public abstract int Capacity { get; }
}
[Flags]
public enum FireRateSelector
{
Safety = 0,
Single = 1 << 0,
Automatic = 1 << 1,
}
}

View File

@@ -0,0 +1,61 @@
#nullable enable
using System;
using Content.Shared.NetIDs;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged.Components
{
public abstract class SharedRangedWeaponComponent : Component
{
// Each RangedWeapon should have a RangedWeapon component +
// some kind of RangedBarrelComponent (this dictates what ammo is retrieved).
public override string Name => "RangedWeapon";
public override uint? NetID => ContentNetIDs.RANGED_WEAPON;
}
[Serializable, NetSerializable]
public sealed class RangedWeaponComponentState : ComponentState
{
public FireRateSelector FireRateSelector { get; }
public RangedWeaponComponentState(
FireRateSelector fireRateSelector
) : base(ContentNetIDs.RANGED_WEAPON)
{
FireRateSelector = fireRateSelector;
}
}
/// <summary>
/// A component message raised when the weapon is fired at a position on the map.
/// </summary>
[Serializable, NetSerializable]
public sealed class FirePosComponentMessage : ComponentMessage
{
/// <summary>
/// If this is not invalid, the target position is relative to the grid.
/// Otherwise, it is a map position.
/// </summary>
public GridId TargetGrid { get; }
/// <summary>
/// If Target Grid is not invalid, this is relative to the grid, otherwise
/// it is a map position.
/// </summary>
public Vector2 TargetPosition { get; }
/// <summary>
/// Constructs a new instance of <see cref="FirePosComponentMessage"/>.
/// </summary>
/// <param name="targetGrid">The grid that the target position is on, if any.</param>
/// <param name="targetPosition">Target position relative to the grid, or a map position if the grid is invalid.</param>
public FirePosComponentMessage(GridId targetGrid, Vector2 targetPosition)
{
TargetGrid = targetGrid;
TargetPosition = targetPosition;
}
}
}

View File

@@ -0,0 +1,13 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Ranged
{
/// <summary>
/// This is sent if the MagazineBarrel AutoEjects the magazine
/// </summary>
[Serializable, NetSerializable]
public sealed class MagazineAutoEjectMessage : ComponentMessage {}
}