Merge branch 'master' into RefactorMouseFilterMode

This commit is contained in:
Pieter-Jan Briers
2020-03-25 02:27:28 +01:00
38 changed files with 851 additions and 75 deletions

View File

@@ -120,7 +120,6 @@ namespace Content.Client.GameObjects.Components.Doors
{ {
animPlayer.Play(OpenAnimation, AnimationKey); animPlayer.Play(OpenAnimation, AnimationKey);
} }
break; break;
case DoorVisualState.Open: case DoorVisualState.Open:
sprite.LayerSetState(DoorVisualLayers.Base, "open"); sprite.LayerSetState(DoorVisualLayers.Base, "open");

View File

@@ -0,0 +1,107 @@
using System;
using Content.Shared.GameObjects.Components.Power;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Power
{
public class AutolatheVisualizer2D : AppearanceVisualizer
{
private const string AnimationKey = "autolathe_animation";
private Animation _buildingAnimation;
private Animation _insertingMetalAnimation;
private Animation _insertingGlassAnimation;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
_buildingAnimation = PopulateAnimation("autolathe_building", "autolathe_building_unlit", 0.5f);
_insertingMetalAnimation = PopulateAnimation("autolathe_inserting_metal_plate", "autolathe_inserting_unlit", 0.9f);
_insertingGlassAnimation = PopulateAnimation("autolathe_inserting_glass_plate", "autolathe_inserting_unlit", 0.9f);
}
private Animation PopulateAnimation(string sprite, string spriteUnlit, float length)
{
var animation = new Animation {Length = TimeSpan.FromSeconds(length)};
var flick = new AnimationTrackSpriteFlick();
animation.AnimationTracks.Add(flick);
flick.LayerKey = AutolatheVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(sprite, 0f));
var flickUnlit = new AnimationTrackSpriteFlick();
animation.AnimationTracks.Add(flickUnlit);
flickUnlit.LayerKey = AutolatheVisualLayers.BaseUnlit;
flickUnlit.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(spriteUnlit, 0f));
return animation;
}
public override void InitializeEntity(IEntity entity)
{
if (!entity.HasComponent<AnimationPlayerComponent>())
{
entity.AddComponent<AnimationPlayerComponent>();
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = component.Owner.GetComponent<ISpriteComponent>();
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
{
state = LatheVisualState.Idle;
}
switch (state)
{
case LatheVisualState.Idle:
if (animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Stop(AnimationKey);
}
sprite.LayerSetState(AutolatheVisualLayers.Base, "autolathe");
sprite.LayerSetState(AutolatheVisualLayers.BaseUnlit, "autolathe_unlit");
break;
case LatheVisualState.Producing:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_buildingAnimation, AnimationKey);
}
break;
case LatheVisualState.InsertingMetal:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_insertingMetalAnimation, AnimationKey);
}
break;
case LatheVisualState.InsertingGlass:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_insertingGlassAnimation, AnimationKey);
}
break;
default:
throw new ArgumentOutOfRangeException();
}
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
sprite.LayerSetVisible(AutolatheVisualLayers.BaseUnlit, glowingPartsVisible);
}
public enum AutolatheVisualLayers
{
Base,
BaseUnlit
}
}
}

View File

@@ -0,0 +1,104 @@
using System;
using Content.Shared.GameObjects.Components.Power;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Power
{
public class ProtolatheVisualizer2D : AppearanceVisualizer
{
private const string AnimationKey = "protolathe_animation";
private Animation _buildingAnimation;
private Animation _insertingMetalAnimation;
private Animation _insertingGlassAnimation;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
_buildingAnimation = PopulateAnimation("protolathe_building", 0.9f);
_insertingMetalAnimation = PopulateAnimation("protolathe_metal", 0.9f);
_insertingGlassAnimation = PopulateAnimation("protolathe_glass", 0.9f);
}
private Animation PopulateAnimation(string sprite, float length)
{
var animation = new Animation {Length = TimeSpan.FromSeconds(length)};
var flick = new AnimationTrackSpriteFlick();
animation.AnimationTracks.Add(flick);
flick.LayerKey = ProtolatheVisualLayers.AnimationLayer;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(sprite, 0f));
return animation;
}
public override void InitializeEntity(IEntity entity)
{
if (!entity.HasComponent<AnimationPlayerComponent>())
{
entity.AddComponent<AnimationPlayerComponent>();
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = component.Owner.GetComponent<ISpriteComponent>();
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
{
state = LatheVisualState.Idle;
}
sprite.LayerSetVisible(ProtolatheVisualLayers.AnimationLayer, true);
switch (state)
{
case LatheVisualState.Idle:
if (animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Stop(AnimationKey);
}
sprite.LayerSetState(ProtolatheVisualLayers.Base, "protolathe");
sprite.LayerSetState(ProtolatheVisualLayers.BaseUnlit, "protolathe_unlit");
sprite.LayerSetVisible(ProtolatheVisualLayers.AnimationLayer, false);
break;
case LatheVisualState.Producing:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_buildingAnimation, AnimationKey);
}
break;
case LatheVisualState.InsertingMetal:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_insertingMetalAnimation, AnimationKey);
}
break;
case LatheVisualState.InsertingGlass:
if (!animPlayer.HasRunningAnimation(AnimationKey))
{
animPlayer.Play(_insertingGlassAnimation, AnimationKey);
}
break;
default:
throw new ArgumentOutOfRangeException();
}
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
sprite.LayerSetVisible(ProtolatheVisualLayers.BaseUnlit, glowingPartsVisible);
}
public enum ProtolatheVisualLayers
{
Base,
BaseUnlit,
AnimationLayer
}
}
}

View File

@@ -121,7 +121,7 @@ namespace Content.Client.GameObjects.EntitySystems
DebugTools.AssertNotNull(_currentPopup); DebugTools.AssertNotNull(_currentPopup);
var buttons = new List<Button>(); var buttons = new Dictionary<string, List<Button>>();
var vBox = _currentPopup.List; var vBox = _currentPopup.List;
vBox.DisposeAllChildren(); vBox.DisposeAllChildren();
@@ -137,7 +137,10 @@ namespace Content.Client.GameObjects.EntitySystems
}; };
} }
buttons.Add(button); if(!buttons.ContainsKey(data.Category))
buttons[data.Category] = new List<Button>();
buttons[data.Category].Add(button);
} }
var user = GetUserEntity(); var user = GetUserEntity();
@@ -148,7 +151,13 @@ namespace Content.Client.GameObjects.EntitySystems
continue; continue;
var disabled = verb.GetVisibility(user, component) != VerbVisibility.Visible; var disabled = verb.GetVisibility(user, component) != VerbVisibility.Visible;
buttons.Add(CreateVerbButton(verb.GetText(user, component), disabled, verb.ToString(), var category = verb.GetCategory(user, component);
if(!buttons.ContainsKey(category))
buttons[category] = new List<Button>();
buttons[category].Add(CreateVerbButton(verb.GetText(user, component), disabled, verb.ToString(),
entity.ToString(), () => verb.Activate(user, component))); entity.ToString(), () => verb.Activate(user, component)));
} }
//Get global verbs. Visible for all entities regardless of their components. //Get global verbs. Visible for all entities regardless of their components.
@@ -158,17 +167,33 @@ namespace Content.Client.GameObjects.EntitySystems
continue; continue;
var disabled = globalVerb.GetVisibility(user, entity) != VerbVisibility.Visible; var disabled = globalVerb.GetVisibility(user, entity) != VerbVisibility.Visible;
buttons.Add(CreateVerbButton(globalVerb.GetText(user, entity), disabled, globalVerb.ToString(), var category = globalVerb.GetCategory(user, entity);
if(!buttons.ContainsKey(category))
buttons[category] = new List<Button>();
buttons[category].Add(CreateVerbButton(globalVerb.GetText(user, entity), disabled, globalVerb.ToString(),
entity.ToString(), () => globalVerb.Activate(user, entity))); entity.ToString(), () => globalVerb.Activate(user, entity)));
} }
if (buttons.Count > 0) if (buttons.Count > 0)
{ {
buttons.Sort((a, b) => string.Compare(a.Text, b.Text, StringComparison.Ordinal)); foreach (var (category, verbs) in buttons)
foreach (var button in buttons)
{ {
vBox.AddChild(button); if (string.IsNullOrEmpty(category))
continue;
vBox.AddChild(CreateCategoryButton(category, verbs));
}
if (buttons.ContainsKey(""))
{
buttons[""].Sort((a, b) => string.Compare(a.Text, b.Text, StringComparison.Ordinal));
foreach (var verb in buttons[""])
{
vBox.AddChild(verb);
}
} }
} }
else else
@@ -204,6 +229,25 @@ namespace Content.Client.GameObjects.EntitySystems
return button; return button;
} }
private Button CreateCategoryButton(string text, List<Button> verbButtons)
{
verbButtons.Sort((a, b) => string.Compare(a.Text, b.Text, StringComparison.Ordinal));
var button = new Button
{
Text = $"{text}...",
};
button.OnPressed += _ =>
{
_currentPopup.List.DisposeAllChildren();
foreach (var verb in verbButtons)
{
_currentPopup.List.AddChild(verb);
}
};
return button;
}
private void CloseContextMenu() private void CloseContextMenu()
{ {
_currentPopup?.Dispose(); _currentPopup?.Dispose();

View File

@@ -13,6 +13,8 @@ namespace Content.Client.GlobalVerbs
class ViewVariablesVerb : GlobalVerb class ViewVariablesVerb : GlobalVerb
{ {
public override string GetText(IEntity user, IEntity target) => "View variables"; public override string GetText(IEntity user, IEntity target) => "View variables";
public override string GetCategory(IEntity user, IEntity target) => "Debug";
public override bool RequireInteractionRange => false; public override bool RequireInteractionRange => false;
public override VerbVisibility GetVisibility(IEntity user, IEntity target) public override VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

@@ -208,7 +208,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
if (SolutionValidReaction(reaction, out int unitReactions)) if (SolutionValidReaction(reaction, out int unitReactions))
{ {
PerformReaction(reaction, unitReactions); PerformReaction(reaction, unitReactions);
checkForNewReaction = true; checkForNewReaction = true;
break; break;
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Interactable.Tools; using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.GameObjects.Components.Stack; using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.Construction; using Content.Shared.Construction;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems; using Robust.Server.GameObjects.EntitySystems;
@@ -12,6 +13,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components; using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Random; using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
using static Content.Shared.Construction.ConstructionStepMaterial; using static Content.Shared.Construction.ConstructionStepMaterial;
@@ -34,6 +36,8 @@ namespace Content.Server.GameObjects.Components.Construction
#pragma warning disable 649 #pragma warning disable 649
[Dependency] private IRobustRandom _random; [Dependency] private IRobustRandom _random;
[Dependency] private readonly IEntitySystemManager _entitySystemManager; [Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IServerNotifyManager _notifyManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649 #pragma warning restore 649
public override void Initialize() public override void Initialize()
@@ -49,8 +53,10 @@ namespace Content.Server.GameObjects.Components.Construction
{ {
var playerEntity = eventArgs.User; var playerEntity = eventArgs.User;
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>(); var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
if (!interactionSystem.InRangeUnobstructed(playerEntity.Transform.MapPosition, Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: true)) if (!interactionSystem.InRangeUnobstructed(playerEntity.Transform.MapPosition, Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: Prototype.CanBuildInImpassable))
{ {
_notifyManager.PopupMessage(Owner.Transform.GridPosition, playerEntity,
_localizationManager.GetString("You can't reach there!"));
return false; return false;
} }

View File

@@ -3,6 +3,7 @@ using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Construction; using Content.Shared.Construction;
using Content.Shared.GameObjects.Components.Construction; using Content.Shared.GameObjects.Components.Construction;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects.EntitySystems; using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -10,6 +11,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network; using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -24,6 +26,8 @@ namespace Content.Server.GameObjects.Components.Construction
[Dependency] private readonly IMapManager _mapManager; [Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IServerEntityManager _serverEntityManager; [Dependency] private readonly IServerEntityManager _serverEntityManager;
[Dependency] private readonly IEntitySystemManager _entitySystemManager; [Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly ISharedNotifyManager _notifyManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649 #pragma warning restore 649
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null) public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
@@ -44,8 +48,10 @@ namespace Content.Server.GameObjects.Components.Construction
var transform = Owner.Transform; var transform = Owner.Transform;
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>(); var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
if (!interactionSystem.InRangeUnobstructed(loc.ToMap(_mapManager), Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: true)) if (!interactionSystem.InRangeUnobstructed(loc.ToMap(_mapManager), Owner.Transform.WorldPosition, ignoredEnt: Owner, insideBlockerValid: prototype.CanBuildInImpassable))
{ {
_notifyManager.PopupMessage(transform.GridPosition, Owner,
_localizationManager.GetString("You can't reach there!"));
return; return;
} }

View File

@@ -1,18 +1,22 @@
// Only unused on .NET Core due to KeyValuePair.Deconstruct // Only unused on .NET Core due to KeyValuePair.Deconstruct
// ReSharper disable once RedundantUsingDirective // ReSharper disable once RedundantUsingDirective
using System;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Stack; using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Materials; using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.GameObjects.Components.Research; using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research; using Content.Shared.Research;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player; using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Timers; using Robust.Shared.Timers;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -32,16 +36,28 @@ namespace Content.Server.GameObjects.Components.Research
[ViewVariables] [ViewVariables]
public bool Producing { get; private set; } = false; public bool Producing { get; private set; } = false;
private AppearanceComponent _appearance;
private LatheState _state = LatheState.Base;
protected virtual LatheState State
{
get => _state;
set => _state = value;
}
private LatheRecipePrototype _producingRecipe = null; private LatheRecipePrototype _producingRecipe = null;
private PowerDeviceComponent _powerDevice; private PowerDeviceComponent _powerDevice;
private bool Powered => _powerDevice.Powered; private bool Powered => _powerDevice.Powered;
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(LatheUiKey.Key); _userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(LatheUiKey.Key);
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage; _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
_powerDevice = Owner.GetComponent<PowerDeviceComponent>(); _powerDevice = Owner.GetComponent<PowerDeviceComponent>();
_appearance = Owner.GetComponent<AppearanceComponent>();
} }
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message) private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
@@ -100,12 +116,17 @@ namespace Content.Server.GameObjects.Components.Research
_userInterface.SendMessage(new LatheProducingRecipeMessage(recipe.ID)); _userInterface.SendMessage(new LatheProducingRecipeMessage(recipe.ID));
State = LatheState.Producing;
SetAppearance(LatheVisualState.Producing);
Timer.Spawn(recipe.CompleteTime, () => Timer.Spawn(recipe.CompleteTime, () =>
{ {
Producing = false; Producing = false;
_producingRecipe = null; _producingRecipe = null;
Owner.EntityManager.SpawnEntity(recipe.Result, Owner.Transform.GridPosition); Owner.EntityManager.SpawnEntity(recipe.Result, Owner.Transform.GridPosition);
_userInterface.SendMessage(new LatheStoppedProducingRecipeMessage()); _userInterface.SendMessage(new LatheStoppedProducingRecipeMessage());
State = LatheState.Base;
SetAppearance(LatheVisualState.Idle);
}); });
return true; return true;
@@ -125,7 +146,6 @@ namespace Content.Server.GameObjects.Components.Research
return; return;
} }
OpenUserInterface(actor.playerSession); OpenUserInterface(actor.playerSession);
return;
} }
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
{ {
@@ -151,15 +171,37 @@ namespace Content.Server.GameObjects.Components.Research
foreach (var mat in material.MaterialTypes.Values) foreach (var mat in material.MaterialTypes.Values)
{ {
storage.InsertMaterial(mat.ID, VolumePerSheet * multiplier); storage.InsertMaterial(mat.ID, VolumePerSheet * multiplier);
} }
State = LatheState.Inserting;
switch (material.MaterialTypes.Values.First().Name)
{
case "Steel":
SetAppearance(LatheVisualState.InsertingMetal);
break;
case "Glass":
SetAppearance(LatheVisualState.InsertingGlass);
break;
}
Timer.Spawn(InsertionTime, async () =>
{
State = LatheState.Base;
SetAppearance(LatheVisualState.Idle);
});
eventArgs.AttackWith.Delete(); eventArgs.AttackWith.Delete();
return false; return false;
} }
private void SetAppearance(LatheVisualState state)
{
if (_appearance != null || Owner.TryGetComponent(out _appearance))
_appearance.SetData(PowerDeviceVisuals.VisualState, state);
}
private Queue<string> GetIDQueue() private Queue<string> GetIDQueue()
{ {
var queue = new Queue<string>(); var queue = new Queue<string>();
@@ -170,5 +212,12 @@ namespace Content.Server.GameObjects.Components.Research
return queue; return queue;
} }
protected enum LatheState
{
Base,
Inserting,
Producing
}
} }
} }

View File

@@ -40,6 +40,8 @@ namespace Content.Server.GameObjects.Components
return "Rotate clockwise"; return "Rotate clockwise";
} }
protected override string GetCategory(IEntity user, RotatableComponent component) => "Rotate";
protected override VerbVisibility GetVisibility(IEntity user, RotatableComponent component) protected override VerbVisibility GetVisibility(IEntity user, RotatableComponent component)
{ {
return VerbVisibility.Visible; return VerbVisibility.Visible;
@@ -59,6 +61,8 @@ namespace Content.Server.GameObjects.Components
return "Rotate counter-clockwise"; return "Rotate counter-clockwise";
} }
protected override string GetCategory(IEntity user, RotatableComponent component) => "Rotate";
protected override VerbVisibility GetVisibility(IEntity user, RotatableComponent component) protected override VerbVisibility GetVisibility(IEntity user, RotatableComponent component)
{ {
return VerbVisibility.Visible; return VerbVisibility.Visible;

View File

@@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.EntitySystems
// TODO: These keys being giant strings is inefficient as hell. // TODO: These keys being giant strings is inefficient as hell.
data.Add(new VerbsResponseMessage.VerbData(verb.GetText(userEntity, component), data.Add(new VerbsResponseMessage.VerbData(verb.GetText(userEntity, component),
$"{component.GetType()}:{verb.GetType()}", $"{component.GetType()}:{verb.GetType()}", verb.GetCategory(userEntity, component),
vis == VerbVisibility.Visible)); vis == VerbVisibility.Visible));
} }
@@ -121,7 +121,7 @@ namespace Content.Server.GameObjects.EntitySystems
continue; continue;
data.Add(new VerbsResponseMessage.VerbData(globalVerb.GetText(userEntity, entity), data.Add(new VerbsResponseMessage.VerbData(globalVerb.GetText(userEntity, entity),
globalVerb.GetType().ToString(), vis == VerbVisibility.Visible)); globalVerb.GetType().ToString(), globalVerb.GetCategory(userEntity, entity), vis == VerbVisibility.Visible));
} }
var response = new VerbsResponseMessage(data, req.EntityUid); var response = new VerbsResponseMessage(data, req.EntityUid);

View File

@@ -16,6 +16,8 @@ namespace Content.Server.GlobalVerbs
public class ControlMobVerb : GlobalVerb public class ControlMobVerb : GlobalVerb
{ {
public override string GetText(IEntity user, IEntity target) => "Control Mob"; public override string GetText(IEntity user, IEntity target) => "Control Mob";
public override string GetCategory(IEntity user, IEntity target) => "Debug";
public override bool RequireInteractionRange => false; public override bool RequireInteractionRange => false;
public override VerbVisibility GetVisibility(IEntity user, IEntity target) public override VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

@@ -15,6 +15,8 @@ namespace Content.Server.GlobalVerbs
class RejuvenateVerb : GlobalVerb class RejuvenateVerb : GlobalVerb
{ {
public override string GetText(IEntity user, IEntity target) => "Rejuvenate"; public override string GetText(IEntity user, IEntity target) => "Rejuvenate";
public override string GetCategory(IEntity user, IEntity target) => "Debug";
public override bool RequireInteractionRange => false; public override bool RequireInteractionRange => false;
public override VerbVisibility GetVisibility(IEntity user, IEntity target) public override VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

@@ -21,6 +21,7 @@ namespace Content.Shared.Construction
private string _id; private string _id;
private string _result; private string _result;
private string _placementMode; private string _placementMode;
private bool _canBuildInImpassable;
/// <summary> /// <summary>
/// Friendly name displayed in the construction GUI. /// Friendly name displayed in the construction GUI.
@@ -37,6 +38,11 @@ namespace Content.Shared.Construction
/// </summary> /// </summary>
public SpriteSpecifier Icon => _icon; public SpriteSpecifier Icon => _icon;
/// <summary>
/// If you can start building or complete steps on impassable terrain.
/// </summary>
public bool CanBuildInImpassable => _canBuildInImpassable;
/// <summary> /// <summary>
/// A list of keywords that are used for searching. /// A list of keywords that are used for searching.
/// </summary> /// </summary>
@@ -81,6 +87,7 @@ namespace Content.Shared.Construction
ser.DataField(ref _type, "objecttype", ConstructionType.Structure); ser.DataField(ref _type, "objecttype", ConstructionType.Structure);
ser.DataField(ref _result, "result", null); ser.DataField(ref _result, "result", null);
ser.DataField(ref _placementMode, "placementmode", "PlaceFree"); ser.DataField(ref _placementMode, "placementmode", "PlaceFree");
ser.DataField(ref _canBuildInImpassable, "canbuildinimpassable", false);
_keywords = ser.ReadDataField<List<string>>("keywords", new List<string>()); _keywords = ser.ReadDataField<List<string>>("keywords", new List<string>());
{ {

View File

@@ -0,0 +1,14 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Power
{
[Serializable, NetSerializable]
public enum LatheVisualState
{
Idle,
Producing,
InsertingMetal,
InsertingGlass
}
}

View File

@@ -6,6 +6,7 @@ namespace Content.Shared.GameObjects.Components.Power
[Serializable, NetSerializable] [Serializable, NetSerializable]
public enum PowerDeviceVisuals public enum PowerDeviceVisuals
{ {
VisualState,
Powered Powered
} }
} }

View File

@@ -35,12 +35,14 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
{ {
public readonly string Text; public readonly string Text;
public readonly string Key; public readonly string Key;
public readonly string Category;
public readonly bool Available; public readonly bool Available;
public VerbData(string text, string key, bool available) public VerbData(string text, string key, string category, bool available)
{ {
Text = text; Text = text;
Key = key; Key = key;
Category = category;
Available = available; Available = available;
} }
} }

View File

@@ -27,6 +27,13 @@ namespace Content.Shared.GameObjects
/// <returns>The text string that is shown in the right click menu for this verb.</returns> /// <returns>The text string that is shown in the right click menu for this verb.</returns>
public abstract string GetText(IEntity user, IEntity target); public abstract string GetText(IEntity user, IEntity target);
/// <summary>
/// Gets the category of this verb.
/// </summary>
/// <param name="user">The entity of the user opening this menu.</param>
/// <returns>The category of this verb.</returns>
public virtual string GetCategory(IEntity user, IEntity target) => "";
/// <summary> /// <summary>
/// Gets the visibility level of this verb in the right click menu. /// Gets the visibility level of this verb in the right click menu.
/// </summary> /// </summary>

View File

@@ -31,6 +31,14 @@ namespace Content.Shared.GameObjects
/// <returns>The text string that is shown in the right click menu for this verb.</returns> /// <returns>The text string that is shown in the right click menu for this verb.</returns>
public abstract string GetText(IEntity user, IComponent component); public abstract string GetText(IEntity user, IComponent component);
/// <summary>
/// Gets the category of this verb.
/// </summary>
/// <param name="user">The entity of the user opening this menu.</param>
/// <param name="component">The component instance for which this verb is being loaded.</param>
/// <returns>The category of this verb.</returns>
public virtual string GetCategory(IEntity user, IComponent component) => "";
/// <summary> /// <summary>
/// Gets the visibility level of this verb in the right click menu. /// Gets the visibility level of this verb in the right click menu.
/// </summary> /// </summary>
@@ -63,6 +71,14 @@ namespace Content.Shared.GameObjects
/// <returns>The text string that is shown in the right click menu for this verb.</returns> /// <returns>The text string that is shown in the right click menu for this verb.</returns>
protected abstract string GetText(IEntity user, T component); protected abstract string GetText(IEntity user, T component);
/// <summary>
/// Gets the category of this verb.
/// </summary>
/// <param name="user">The entity of the user opening this menu.</param>
/// <param name="component">The component instance for which this verb is being loaded.</param>
/// <returns>The category of this verb.</returns>
protected virtual string GetCategory(IEntity user, T component) => "";
/// <summary> /// <summary>
/// Gets the visibility level of this verb in the right click menu. /// Gets the visibility level of this verb in the right click menu.
/// </summary> /// </summary>
@@ -84,6 +100,12 @@ namespace Content.Shared.GameObjects
return GetText(user, (T) component); return GetText(user, (T) component);
} }
/// <inheritdoc />
public sealed override string GetCategory(IEntity user, IComponent component)
{
return GetCategory(user, (T) component);
}
/// <inheritdoc /> /// <inheritdoc />
public sealed override VerbVisibility GetVisibility(IEntity user, IComponent component) public sealed override VerbVisibility GetVisibility(IEntity user, IComponent component)
{ {

View File

@@ -5,6 +5,7 @@
category: Machines category: Machines
description: A simple wall-mounted light fixture. description: A simple wall-mounted light fixture.
placementmode: SnapgridBorder placementmode: SnapgridBorder
canbuildinimpassable: true
icon: icon:
sprite: Objects/Lighting/lighting.rsi sprite: Objects/Lighting/lighting.rsi
state: on state: on
@@ -17,6 +18,7 @@
sprite: Objects/Lighting/lighting.rsi sprite: Objects/Lighting/lighting.rsi
state: construct state: construct
- material: Cable - material: Cable
amount: 1 amount: 1
icon: icon:

View File

@@ -41,6 +41,7 @@
category: Machines/Power category: Machines/Power
placementmode: SnapgridCenter placementmode: SnapgridCenter
description: Provides power from the grid wirelessly to other machines in the area. description: Provides power from the grid wirelessly to other machines in the area.
canbuildinimpassable: true
icon: icon:
sprite: Buildings/apc.rsi sprite: Buildings/apc.rsi
state: apc0 state: apc0

View File

@@ -19,7 +19,7 @@
- material: Metal - material: Metal
amount: 2 amount: 2
reverse: reverse:
tool: Welder tool: Wrench
- type: construction - type: construction
name: Table name: Table
@@ -33,3 +33,65 @@
steps: steps:
- material: Metal - material: Metal
amount: 2 amount: 2
- type: construction
name: Window
id: window
category: Structures
description: Clear.
icon:
sprite: Buildings/window.rsi
state: full
objecttype: Structure
result: window
placementmode: SnapgridCenter
steps:
- material: Glass
amount: 2
- type: construction
name: Low Wall
id: low_wall
category: Structures
description: A low wall used for mounting windows.
icon:
sprite: Buildings/low_wall.rsi
state: metal
objecttype: Structure
result: low_wall
placementmode: SnapgridCenter
steps:
- material: Metal
amount: 2
icon: Buildings/wall_girder.png
reverse:
tool: Wrench
- material: Metal
amount: 2
reverse:
tool: Wrench
- type: construction
name: Rein Window
id: rwindow
category: Structures
description: Clear but tough.
icon:
sprite: Buildings/rwindow.rsi
state: full
objecttype: Structure
result: rwindow
placementmode: SnapgridCenter
steps:
- material: Glass
amount: 2
reverse:
tool: Wrench
# Should be replaced with Metal Rods when someone puts them in.
- material: Metal
amount: 2
reverse:
# Should be replaced with Wirecutter when someone makes it work.
tool: Wrench

View File

@@ -25,9 +25,10 @@
sprite: Buildings/autolathe.rsi sprite: Buildings/autolathe.rsi
layers: layers:
- state: autolathe - state: autolathe
map: ["enum.AutolatheVisualLayers.Base"]
- state: autolathe_unlit - state: autolathe_unlit
shader: unshaded shader: unshaded
map: ["enum.PowerDeviceVisualLayers.Powered"] map: ["enum.AutolatheVisualLayers.BaseUnlit"]
- type: Icon - type: Icon
sprite: Buildings/autolathe.rsi sprite: Buildings/autolathe.rsi
state: autolathe state: autolathe
@@ -56,7 +57,7 @@
- Multitool - Multitool
- type: Appearance - type: Appearance
visuals: visuals:
- type: PowerDeviceVisualizer2D - type: AutolatheVisualizer2D
- type: entity - type: entity
parent: BaseLathe parent: BaseLathe
@@ -67,9 +68,12 @@
sprite: Buildings/research.rsi sprite: Buildings/research.rsi
layers: layers:
- state: protolathe - state: protolathe
map: ["enum.ProtolatheVisualLayers.Base"]
- state: protolathe_unlit - state: protolathe_unlit
shader: unshaded shader: unshaded
map: ["enum.PowerDeviceVisualLayers.Powered"] map: ["enum.ProtolatheVisualLayers.BaseUnlit"]
- state: protolathe
map: ["enum.ProtolatheVisualLayers.AnimationLayer"]
- type: Icon - type: Icon
sprite: Buildings/research.rsi sprite: Buildings/research.rsi
state: protolathe state: protolathe
@@ -104,4 +108,4 @@
type: ResearchClientBoundUserInterface type: ResearchClientBoundUserInterface
- type: Appearance - type: Appearance
visuals: visuals:
- type: PowerDeviceVisualizer2D - type: ProtolatheVisualizer2D

View File

@@ -13,8 +13,10 @@
- type: Sprite - type: Sprite
netsync: false netsync: false
drawdepth: Walls drawdepth: Walls
- type: Icon - type: Icon
state: full state: full
- type: Collidable - type: Collidable
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
@@ -26,6 +28,7 @@
- type: Occluder - type: Occluder
sizeX: 32 sizeX: 32
sizeY: 32 sizeY: 32
- type: SnapGrid - type: SnapGrid
offset: Center offset: Center

View File

@@ -2,6 +2,10 @@
id: window id: window
name: Window name: Window
description: Don't smudge up the glass down there. description: Don't smudge up the glass down there.
placement:
mode: SnapgridCenter
snap:
- Window
components: components:
- type: Clickable - type: Clickable
- type: InteractionOutline - type: InteractionOutline
@@ -13,7 +17,7 @@
- type: Icon - type: Icon
sprite: Buildings/window.rsi sprite: Buildings/window.rsi
state: window0 state: full
- type: Collidable - type: Collidable
shapes: shapes:
@@ -30,10 +34,6 @@
- type: Window - type: Window
base: window base: window
placement:
snap:
- Wall
- type: entity - type: entity
id: rwindow id: rwindow
name: Reinforced Window name: Reinforced Window
@@ -48,4 +48,4 @@
- type: Icon - type: Icon
sprite: Buildings/rwindow.rsi sprite: Buildings/rwindow.rsi
state: rwindow0 state: full

View File

@@ -456,8 +456,8 @@
- type: entity - type: entity
parent: GlovesBase parent: GlovesBase
id: GlovesLeather id: GlovesLeather
name: Leather gloves name: 'Botanist''s leather gloves'
description: '' description: 'These leather gloves protect against thorns, barbs, prickles, spikes and other harmful objects of floral origin. They''re also quite warm.'
components: components:
- type: Sprite - type: Sprite
sprite: Clothing/Gloves/leather.rsi sprite: Clothing/Gloves/leather.rsi
@@ -465,6 +465,7 @@
sprite: Clothing/Gloves/leather.rsi sprite: Clothing/Gloves/leather.rsi
- type: Clothing - type: Clothing
sprite: Clothing/Gloves/leather.rsi sprite: Clothing/Gloves/leather.rsi
HeatResistance: 1400
- type: entity - type: entity
parent: GlovesBase parent: GlovesBase
@@ -776,5 +777,4 @@
- type: Icon - type: Icon
sprite: Clothing/Gloves/yellow.rsi sprite: Clothing/Gloves/yellow.rsi
- type: Clothing - type: Clothing
HeatResistance: 1500
sprite: Clothing/Gloves/yellow.rsi sprite: Clothing/Gloves/yellow.rsi

View File

@@ -11,7 +11,7 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25" bounds: "-0.25,-0.25,0.25,0.25"
mask: 26 mask: 0
layer: 32 layer: 32
IsScrapingFloor: true IsScrapingFloor: true
- type: Physics - type: Physics

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -28,15 +28,15 @@
"directions": 1, "directions": 1,
"delays": [ "delays": [
[ [
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15 0.055
] ]
] ]
}, },
@@ -45,20 +45,37 @@
"directions": 1, "directions": 1,
"delays": [ "delays": [
[ [
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15, 0.055,
0.15 0.055
] ]
] ]
}, },
{ {
"name": "autolathe_inserting", "name": "autolathe_inserting_metal_plate",
"directions": 1,
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
},
{
"name": "autolathe_inserting_glass_plate",
"directions": 1, "directions": 1,
"delays": [ "delays": [
[ [
@@ -99,23 +116,6 @@
1.0 1.0
] ]
] ]
},
{
"name": "autolathe_r",
"directions": 1,
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
} }
] ]
} }

View File

@@ -259,7 +259,7 @@
] ]
}, },
{ {
"name": "protolathe_n", "name": "protolathe_building",
"directions": 1, "directions": 1,
"delays": [ "delays": [
[ [
@@ -314,7 +314,7 @@
] ]
}, },
{ {
"name": "protolathe_t", "name": "protolathe_open",
"directions": 1, "directions": 1,
"delays": [ "delays": [
[ [

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View File

@@ -1 +1,164 @@
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/icons/obj/structures/windows.dmi", "states": [{"name": "rwindow0", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow1", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow2", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow3", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow4", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow5", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow6", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "rwindow7", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}]} {
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/icons/obj/structures/windows.dmi",
"states": [
{
"name": "full",
"directions": 1,
"delays": [
[
1
]
]
},
{
"name": "rwindow0",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow1",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow2",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow3",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow4",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow5",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow6",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "rwindow7",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

View File

@@ -1 +1,164 @@
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/icons/obj/structures/windows.dmi", "states": [{"name": "window0", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window1", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window2", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window3", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window4", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window5", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window6", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "window7", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}]} {
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/icons/obj/structures/windows.dmi",
"states": [
{
"name": "full",
"directions": 1,
"delays": [
[
1
]
]
},
{
"name": "window0",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window1",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window2",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window3",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window4",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window5",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window6",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "window7",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
}
]
}