Merge remote-tracking branch 'upstream/master'

This commit is contained in:
PrPleGoo
2020-03-07 18:31:28 +01:00
23 changed files with 524 additions and 26 deletions

View File

@@ -121,7 +121,7 @@ namespace Content.Client.GameObjects.EntitySystems
DebugTools.AssertNotNull(_currentPopup);
var buttons = new List<Button>();
var buttons = new Dictionary<string, List<Button>>();
var vBox = _currentPopup.List;
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();
@@ -148,7 +151,13 @@ namespace Content.Client.GameObjects.EntitySystems
continue;
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)));
}
//Get global verbs. Visible for all entities regardless of their components.
@@ -158,17 +167,33 @@ namespace Content.Client.GameObjects.EntitySystems
continue;
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)));
}
if (buttons.Count > 0)
{
buttons.Sort((a, b) => string.Compare(a.Text, b.Text, StringComparison.Ordinal));
foreach (var button in buttons)
foreach (var (category, verbs) 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
@@ -204,6 +229,25 @@ namespace Content.Client.GameObjects.EntitySystems
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()
{
_currentPopup?.Dispose();

View File

@@ -13,6 +13,8 @@ namespace Content.Client.GlobalVerbs
class ViewVariablesVerb : GlobalVerb
{
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 VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

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

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.Construction;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
@@ -12,6 +13,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.ViewVariables;
using static Content.Shared.Construction.ConstructionStepMaterial;
@@ -34,6 +36,8 @@ namespace Content.Server.GameObjects.Components.Construction
#pragma warning disable 649
[Dependency] private IRobustRandom _random;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IServerNotifyManager _notifyManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
public override void Initialize()
@@ -49,8 +53,10 @@ namespace Content.Server.GameObjects.Components.Construction
{
var playerEntity = eventArgs.User;
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;
}

View File

@@ -3,6 +3,7 @@ using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Construction;
using Content.Shared.GameObjects.Components.Construction;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
@@ -10,6 +11,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
@@ -24,6 +26,8 @@ namespace Content.Server.GameObjects.Components.Construction
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IServerEntityManager _serverEntityManager;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly ISharedNotifyManager _notifyManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
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 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;
}

View File

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

View File

@@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.EntitySystems
// TODO: These keys being giant strings is inefficient as hell.
data.Add(new VerbsResponseMessage.VerbData(verb.GetText(userEntity, component),
$"{component.GetType()}:{verb.GetType()}",
$"{component.GetType()}:{verb.GetType()}", verb.GetCategory(userEntity, component),
vis == VerbVisibility.Visible));
}
@@ -121,7 +121,7 @@ namespace Content.Server.GameObjects.EntitySystems
continue;
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);

View File

@@ -16,6 +16,8 @@ namespace Content.Server.GlobalVerbs
public class ControlMobVerb : GlobalVerb
{
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 VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

@@ -15,6 +15,8 @@ namespace Content.Server.GlobalVerbs
class RejuvenateVerb : GlobalVerb
{
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 VerbVisibility GetVisibility(IEntity user, IEntity target)

View File

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

View File

@@ -35,12 +35,14 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
{
public readonly string Text;
public readonly string Key;
public readonly string Category;
public readonly bool Available;
public VerbData(string text, string key, bool available)
public VerbData(string text, string key, string category, bool available)
{
Text = text;
Key = key;
Category = category;
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>
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>
/// Gets the visibility level of this verb in the right click menu.
/// </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>
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>
/// Gets the visibility level of this verb in the right click menu.
/// </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>
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>
/// Gets the visibility level of this verb in the right click menu.
/// </summary>
@@ -84,6 +100,12 @@ namespace Content.Shared.GameObjects
return GetText(user, (T) component);
}
/// <inheritdoc />
public sealed override string GetCategory(IEntity user, IComponent component)
{
return GetCategory(user, (T) component);
}
/// <inheritdoc />
public sealed override VerbVisibility GetVisibility(IEntity user, IComponent component)
{

View File

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

View File

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

View File

@@ -19,7 +19,7 @@
- material: Metal
amount: 2
reverse:
tool: Welder
tool: Wrench
- type: construction
name: Table
@@ -33,3 +33,65 @@
steps:
- material: Metal
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

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

View File

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

View File

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

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
]
]
}
]
}