Merge branch 'master' into expl_int_analyzer
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Content.Shared
|
||||
GameLobbyEnabled = CVarDef.Create("game.lobbyenabled", false, CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<int>
|
||||
GameLobbyDuration = CVarDef.Create("game.lobbyduration", 20, CVar.ARCHIVE);
|
||||
GameLobbyDuration = CVarDef.Create("game.lobbyduration", 60, CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<string>
|
||||
GameLobbyDefaultPreset = CVarDef.Create("game.defaultpreset", "Suspicion", CVar.ARCHIVE);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Tag;
|
||||
using Content.Shared.Physics;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
|
||||
namespace Content.Shared.Construction.ConstructionConditions
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class WallmountCondition : IConstructionCondition
|
||||
{
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
||||
|
||||
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
// get blueprint and user position
|
||||
var userWorldPosition = user.Transform.WorldPosition;
|
||||
var objWorldPosition = location.ToMap(entManager).Position;
|
||||
|
||||
// find direction from user to blueprint
|
||||
var userToObject = (objWorldPosition - userWorldPosition);
|
||||
|
||||
// dot product will be positive if user direction and blueprint are co-directed
|
||||
var dotProd = Vector2.Dot(direction.ToVec(), userToObject);
|
||||
if (dotProd > 0)
|
||||
return false;
|
||||
|
||||
// now we need to check that user actually tries to build wallmount on a wall
|
||||
var physics = IoCManager.Resolve<IPhysicsManager>();
|
||||
var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable);
|
||||
var length = userToObject.Length;
|
||||
var userToObjRaycastResults = physics.IntersectRayWithPredicate(user.Transform.MapID, rUserToObj, maxLength: length,
|
||||
predicate: (e) => !e.HasTag("Wall"));
|
||||
if (!userToObjRaycastResults.Any())
|
||||
return false;
|
||||
|
||||
// get this wall entity
|
||||
var targetWall = userToObjRaycastResults.First().HitEntity;
|
||||
|
||||
// check that we didn't try to build wallmount that facing another adjacent wall
|
||||
var rAdjWall = new CollisionRay(objWorldPosition, direction.ToVec(), (int) CollisionGroup.Impassable);
|
||||
var adjWallRaycastResults = physics.IntersectRayWithPredicate(user.Transform.MapID, rAdjWall, maxLength: 0.5f,
|
||||
predicate: (e) => e == targetWall || !e.HasTag("Wall"));
|
||||
return !adjWallRaycastResults.Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Damage
|
||||
|
||||
@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.ActionBlocking
|
||||
{
|
||||
public class SharedHandcuffComponent : Component
|
||||
public abstract class SharedHandcuffComponent : Component
|
||||
{
|
||||
public override string Name => "Handcuff";
|
||||
public override uint? NetID => ContentNetIDs.HANDCUFFS;
|
||||
|
||||
@@ -12,13 +12,13 @@ namespace Content.Shared.GameObjects.Components.GUI
|
||||
{
|
||||
public override string Name => "Stripping";
|
||||
|
||||
public bool CanDragDropOn(DragDropEventArgs eventArgs)
|
||||
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Dragged.TryGetComponent(out SharedStrippableComponent? strippable)) return false;
|
||||
return strippable.CanBeStripped(Owner);
|
||||
}
|
||||
|
||||
public bool DragDropOn(DragDropEventArgs eventArgs)
|
||||
bool IDragDropOn.DragDropOn(DragDropEventArgs eventArgs)
|
||||
{
|
||||
// Handled by StrippableComponent
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.Speech
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SharedEmotingComponent : Component, IActionBlocker
|
||||
{
|
||||
private bool _enabled = true;
|
||||
public override string Name => "Emoting";
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => _enabled;
|
||||
set
|
||||
{
|
||||
if (_enabled == value) return;
|
||||
_enabled = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
bool IActionBlocker.CanEmote() => Enabled;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Enabled, "enabled", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.Speech
|
||||
{
|
||||
/// <summary>
|
||||
/// Component required for entities to be able to speak.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class SharedSpeechComponent : Component, IActionBlocker
|
||||
{
|
||||
private bool _enabled = true;
|
||||
public override string Name => "Speech";
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => _enabled;
|
||||
set
|
||||
{
|
||||
if (_enabled == value) return;
|
||||
_enabled = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
bool IActionBlocker.CanSpeak() => Enabled;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Enabled, "enabled", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Movement
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IMoverComponent))]
|
||||
public class SharedDummyInputMoverComponent : Component, IMoverComponent
|
||||
{
|
||||
public override string Name => "DummyInputMover";
|
||||
public float CurrentWalkSpeed => 0f;
|
||||
public float CurrentSprintSpeed => 0f;
|
||||
public float CurrentPushSpeed => 0f;
|
||||
public float GrabRange => 0f;
|
||||
public bool Sprinting => false;
|
||||
public (Vector2 walking, Vector2 sprinting) VelocityDir => (Vector2.Zero, Vector2.Zero);
|
||||
public EntityCoordinates LastPosition { get; set; }
|
||||
public float StepSoundDistance { get; set; }
|
||||
|
||||
public void SetVelocityDirection(Direction direction, ushort subTick, bool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetSprinting(ushort subTick, bool walking)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Tag
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public class TagComponentState : ComponentState
|
||||
{
|
||||
public TagComponentState(string[] tags) : base(ContentNetIDs.TAG)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
using Content.Shared.GameObjects.Components.Mobs.Speech;
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -62,6 +63,9 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
|
||||
public static bool CanSpeak(IEntity entity)
|
||||
{
|
||||
if (!entity.HasComponent<SharedSpeechComponent>())
|
||||
return false;
|
||||
|
||||
var canSpeak = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
@@ -98,6 +102,9 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
|
||||
public static bool CanEmote(IEntity entity)
|
||||
{
|
||||
if (!entity.HasComponent<SharedEmotingComponent>())
|
||||
return false;
|
||||
|
||||
var canEmote = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
@@ -23,7 +24,6 @@ namespace Content.Shared.Physics
|
||||
GhostImpassable = 1 << 6, // 64 Things impassible by ghosts/observers, ie blessed tiles or forcefields
|
||||
Underplating = 1 << 7, // 128 Things that are under plating
|
||||
Passable = 1 << 8, // 256 Things that are passable
|
||||
ExplosivePassable = 1 << 9, // 512 Things that let the pressure of a explosion through
|
||||
MapGrid = MapGridHelpers.CollisionGroup, // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
|
||||
|
||||
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Shared.Prototypes.Tag
|
||||
{
|
||||
public string ID { get; [UsedImplicitly] private set; } = default!;
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.ID, "id", "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user