Merge pull request #1263 from DrSmugleaf/buckle-locker-fix-1262

Fix buckle in general
This commit is contained in:
Víctor Aguilera Puerto
2020-07-09 00:15:28 +02:00
committed by GitHub
53 changed files with 347 additions and 158 deletions

View File

@@ -0,0 +1,34 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems.Click;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
{
public class BuckleSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery(typeof(BuckleComponent));
UpdatesAfter.Add(typeof(InteractionSystem));
UpdatesAfter.Add(typeof(InputSystem));
}
public override void Update(float frameTime)
{
foreach (var entity in RelevantEntities)
{
if (!entity.TryGetComponent(out BuckleComponent buckle))
{
continue;
}
buckle.Update();
}
}
}
}

View File

@@ -11,10 +11,9 @@ using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
@@ -266,6 +265,19 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return;
}
// In a container where the attacked entity is not the container's owner
if (ContainerHelpers.TryGetContainer(player, out var playerContainer) &&
attacked != playerContainer.Owner)
{
// Either the attacked entity is null, not contained or in a different container
if (attacked == null ||
!ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) ||
attackedContainer != playerContainer)
{
return;
}
}
// TODO: Check if client should be able to see that object to click on it in the first place
// Clicked on empty space behavior, try using ranged attack

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Construction;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Stack;

View File

@@ -1,7 +1,5 @@
using System.Linq;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Throw;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.Input;
@@ -10,7 +8,6 @@ using Robust.Server.GameObjects.EntitySystemMessages;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
@@ -20,6 +17,7 @@ using Robust.Shared.Players;
using System;
using Content.Shared.GameObjects.EntitySystems;
using Content.Server.GameObjects;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.EntitySystems.Click;
namespace Content.Server.Interfaces.GameObjects.Components.Interaction

View File

@@ -1,6 +1,7 @@
#nullable enable
using Content.Server.GameObjects;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.GameObjects.Components.Sound;