Merge branch 'master' into 20-06-24-movement-prediction
This commit is contained in:
@@ -35,6 +35,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
MASK,
|
||||
OUTERCLOTHING,
|
||||
INNERCLOTHING,
|
||||
NECK,
|
||||
BACKPACK,
|
||||
BELT,
|
||||
GLOVES,
|
||||
@@ -69,17 +70,18 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
MASK = 1 << 4,
|
||||
OUTERCLOTHING = 1 << 5,
|
||||
INNERCLOTHING = 1 << 6,
|
||||
BACK = 1 << 7,
|
||||
BACKPACK = 1 << 7,
|
||||
BELT = 1 << 8,
|
||||
GLOVES = 1 << 9,
|
||||
HAND = 1 << 9,
|
||||
IDCARD = 1 << 10,
|
||||
POCKET = 1 << 11,
|
||||
LEGS = 1 << 12,
|
||||
SHOES = 1 << 13,
|
||||
FEET = 1 << 13,
|
||||
EXOSUITSTORAGE = 1 << 14
|
||||
NECK = 1 << 7,
|
||||
BACK = 1 << 8,
|
||||
BACKPACK = 1 << 8,
|
||||
BELT = 1 << 9,
|
||||
GLOVES = 1 << 10,
|
||||
HAND = 1 << 10,
|
||||
IDCARD = 1 << 11,
|
||||
POCKET = 1 << 12,
|
||||
LEGS = 1 << 13,
|
||||
SHOES = 1 << 14,
|
||||
FEET = 1 << 14,
|
||||
EXOSUITSTORAGE = 1 << 15
|
||||
}
|
||||
|
||||
public static readonly IReadOnlyDictionary<Slots, string> SlotNames = new Dictionary<Slots, string>()
|
||||
@@ -90,6 +92,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
{Slots.MASK, "Mask"},
|
||||
{Slots.OUTERCLOTHING, "Outer Clothing"},
|
||||
{Slots.INNERCLOTHING, "Inner Clothing"},
|
||||
{Slots.NECK, "Neck"},
|
||||
{Slots.BACKPACK, "Backpack"},
|
||||
{Slots.BELT, "Belt"},
|
||||
{Slots.GLOVES, "Gloves"},
|
||||
@@ -117,6 +120,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
{Slots.MASK, SlotFlags.MASK},
|
||||
{Slots.OUTERCLOTHING, SlotFlags.OUTERCLOTHING},
|
||||
{Slots.INNERCLOTHING, SlotFlags.INNERCLOTHING},
|
||||
{Slots.NECK, SlotFlags.NECK},
|
||||
{Slots.BACKPACK, SlotFlags.BACK},
|
||||
{Slots.BELT, SlotFlags.BELT},
|
||||
{Slots.GLOVES, SlotFlags.GLOVES},
|
||||
@@ -140,6 +144,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
"Inventory_MASK",
|
||||
"Inventory_OUTERCLOTHING",
|
||||
"Inventory_INNERCLOTHING",
|
||||
"Inventory_NECK",
|
||||
"Inventory_BACKPACK",
|
||||
"Inventory_BELT",
|
||||
"Inventory_GLOVES",
|
||||
|
||||
@@ -28,11 +28,12 @@ namespace Content.Shared.GameObjects
|
||||
|
||||
private static readonly Dictionary<Slots, int> _slotDrawingOrder = new Dictionary<Slots, int>
|
||||
{
|
||||
{Slots.POCKET1, 12},
|
||||
{Slots.POCKET2, 11},
|
||||
{Slots.HEAD, 10},
|
||||
{Slots.MASK, 9},
|
||||
{Slots.EARS, 8},
|
||||
{Slots.POCKET1, 13},
|
||||
{Slots.POCKET2, 12},
|
||||
{Slots.HEAD, 11},
|
||||
{Slots.MASK, 10},
|
||||
{Slots.EARS, 9},
|
||||
{Slots.NECK, 8},
|
||||
{Slots.BACKPACK, 7},
|
||||
{Slots.EYES, 6},
|
||||
{Slots.OUTERCLOTHING, 5},
|
||||
@@ -46,9 +47,10 @@ namespace Content.Shared.GameObjects
|
||||
public override IReadOnlyList<Slots> SlotMasks { get; } = new List<Slots>()
|
||||
{
|
||||
Slots.EYES, Slots.HEAD, Slots.EARS,
|
||||
Slots.OUTERCLOTHING, Slots.MASK, Slots.INNERCLOTHING,
|
||||
Slots.OUTERCLOTHING, Slots.MASK, Slots.INNERCLOTHING,
|
||||
Slots.BACKPACK, Slots.BELT, Slots.GLOVES,
|
||||
Slots.NONE, Slots.SHOES, Slots.IDCARD, Slots.POCKET1, Slots.POCKET2
|
||||
Slots.NONE, Slots.SHOES, Slots.IDCARD, Slots.POCKET1, Slots.POCKET2,
|
||||
Slots.NECK
|
||||
};
|
||||
|
||||
public override int SlotDrawingOrder(Slots slot)
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
/// <param name="enabled">If the direction is active.</param>
|
||||
void SetVelocityDirection(Direction direction, ushort subTick, bool enabled);
|
||||
|
||||
void SetSprinting(ushort subTick, bool enabled);
|
||||
void SetSprinting(ushort subTick, bool walking);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
|
||||
public float CurrentPushSpeed => 5;
|
||||
public float GrabRange => 0.2f;
|
||||
public bool Sprinting => !_heldMoveButtons.HasFlag(MoveButtons.Sprint);
|
||||
public bool Sprinting => !_heldMoveButtons.HasFlag(MoveButtons.Walk);
|
||||
|
||||
/// <summary>
|
||||
/// Calculated linear velocity direction of the entity.
|
||||
@@ -207,11 +207,11 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public void SetSprinting(ushort subTick, bool enabled)
|
||||
public void SetSprinting(ushort subTick, bool walking)
|
||||
{
|
||||
// Logger.Info($"[{_gameTiming.CurTick}/{subTick}] Sprint: {enabled}");
|
||||
|
||||
SetMoveInput(subTick, enabled, MoveButtons.Sprint);
|
||||
SetMoveInput(subTick, walking, MoveButtons.Walk);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
@@ -281,7 +281,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
Down = 2,
|
||||
Left = 4,
|
||||
Right = 8,
|
||||
Sprint = 16,
|
||||
Walk = 16,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,9 @@ namespace Content.Shared.GameObjects.Components.Sound
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
if (!serializer.Reading)
|
||||
return;
|
||||
|
||||
Filename = serializer.ReadDataField("filename", "");
|
||||
Delay = serializer.ReadDataField("delay", 0u);
|
||||
RandomDelay = serializer.ReadDataField("randomdelay", 0u);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Utensil
|
||||
{
|
||||
[Flags]
|
||||
public enum UtensilType : byte
|
||||
{
|
||||
None = 0,
|
||||
Fork = 1,
|
||||
Spoon = 1 << 1,
|
||||
Knife = 1 << 2
|
||||
}
|
||||
|
||||
public class SharedUtensilComponent : Component
|
||||
{
|
||||
public override string Name => "Utensil";
|
||||
|
||||
public virtual UtensilType Types { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public class BallisticMagazineWeaponComponentState : ComponentState
|
||||
{
|
||||
/// <summary>
|
||||
/// True if a bullet is chambered.
|
||||
/// </summary>
|
||||
public bool Chambered { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Count of bullets in the magazine.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Null if no magazine is inserted.
|
||||
/// </remarks>
|
||||
public (int count, int max)? MagazineCount { get; }
|
||||
|
||||
public BallisticMagazineWeaponComponentState(bool chambered, (int count, int max)? magazineCount) : base(ContentNetIDs.BALLISTIC_MAGAZINE_WEAPON)
|
||||
{
|
||||
Chambered = chambered;
|
||||
MagazineCount = magazineCount;
|
||||
}
|
||||
}
|
||||
|
||||
// BMW is "Ballistic Magazine Weapon" here.
|
||||
/// <summary>
|
||||
/// Fired server -> client when the magazine in a Ballistic Magazine Weapon got auto-ejected.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class BmwComponentAutoEjectedMessage : ComponentMessage
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
/// <summary>
|
||||
/// This is sent if the MagazineBarrel AutoEjects the magazine
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class MagazineAutoEjectMessage : ComponentMessage {}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum BallisticMagazineVisuals
|
||||
{
|
||||
AmmoCapacity,
|
||||
AmmoLeft,
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum BallisticMagazineWeaponVisuals
|
||||
{
|
||||
MagazineLoaded,
|
||||
AmmoCapacity,
|
||||
AmmoLeft,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
public abstract class SharedRangedBarrelComponent : Component
|
||||
{
|
||||
public abstract FireRateSelector FireRateSelector { get; }
|
||||
public abstract FireRateSelector AllRateSelectors { get; }
|
||||
public abstract float FireRate { get; }
|
||||
public abstract int ShotsLeft { get; }
|
||||
public abstract int Capacity { get; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FireRateSelector
|
||||
{
|
||||
Safety = 0,
|
||||
Single = 1 << 0,
|
||||
Automatic = 1 << 1,
|
||||
}
|
||||
}
|
||||
@@ -5,40 +5,35 @@ using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
|
||||
{
|
||||
public class SharedRangedWeaponComponent : Component
|
||||
public abstract class SharedRangedWeaponComponent : Component
|
||||
{
|
||||
private float _fireRate;
|
||||
private bool _automatic;
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true, this weapon is fully automatic, holding down left mouse button will keep firing it.
|
||||
/// </summary>
|
||||
public bool Automatic => _automatic;
|
||||
|
||||
/// <summary>
|
||||
/// If the weapon is automatic, controls how many shots can be fired per second.
|
||||
/// </summary>
|
||||
public float FireRate => _fireRate;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class RangedWeaponComponentState : ComponentState
|
||||
{
|
||||
public FireRateSelector FireRateSelector { get; }
|
||||
|
||||
public RangedWeaponComponentState(
|
||||
FireRateSelector fireRateSelector
|
||||
) : base(ContentNetIDs.RANGED_WEAPON)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _fireRate, "firerate", 4);
|
||||
serializer.DataField(ref _automatic, "automatic", false);
|
||||
FireRateSelector = fireRateSelector;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected class SyncFirePosMessage : ComponentMessage
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class FirePosComponentMessage : ComponentMessage
|
||||
{
|
||||
public GridCoordinates Target { get; }
|
||||
|
||||
public FirePosComponentMessage(GridCoordinates target)
|
||||
{
|
||||
public readonly GridCoordinates Target;
|
||||
|
||||
public SyncFirePosMessage(GridCoordinates target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Weapons
|
||||
{
|
||||
public class SharedFlashableComponent : Component
|
||||
{
|
||||
public override string Name => "Flashable";
|
||||
public override uint? NetID => ContentNetIDs.FLASHABLE;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class FlashComponentState : ComponentState
|
||||
{
|
||||
public double Duration { get; }
|
||||
public TimeSpan Time { get; }
|
||||
|
||||
public FlashComponentState(double duration, TimeSpan time) : base(ContentNetIDs.FLASHABLE)
|
||||
{
|
||||
Duration = duration;
|
||||
Time = time;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user