This commit is contained in:
Julian Giebel
2020-08-16 13:16:06 +02:00
844 changed files with 11970 additions and 5397 deletions

View File

@@ -2,9 +2,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Inventory;
using JetBrains.Annotations;

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.Access;

View File

@@ -1,5 +1,5 @@
#nullable enable
using Content.Shared.Jobs;
using Content.Shared.Roles;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;

View File

@@ -1,11 +1,9 @@
using System;
using Content.Server.Atmos;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -42,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Atmos
base.ExposeData(serializer);
serializer.DataField(ref _airBlocked, "airBlocked", true);
serializer.DataField(ref _fixVacuum, "fixVacuum", false);
serializer.DataField(ref _fixVacuum, "fixVacuum", true);
}
public override void Initialize()
@@ -59,15 +57,6 @@ namespace Content.Server.GameObjects.Components.Atmos
UpdatePosition();
}
public override void OnRemove()
{
base.OnRemove();
_airBlocked = false;
UpdatePosition();
}
public void MapInit()
{
_snapGrid.OnPositionChanged += OnTransformMove;
@@ -82,6 +71,11 @@ namespace Content.Server.GameObjects.Components.Atmos
_airBlocked = false;
_snapGrid.OnPositionChanged -= OnTransformMove;
if(_fixVacuum)
EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?
.FixVacuum(_snapGrid.Position);
UpdatePosition();
}

View File

@@ -1,10 +1,11 @@
using System.Runtime.CompilerServices;
using CannyFastMath;
using System;
using System.Runtime.CompilerServices;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.Atmos;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;

View File

@@ -1,8 +1,8 @@
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Utility;
using Content.Shared.Atmos;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
@@ -16,8 +16,6 @@ using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using System.Collections.Generic;
namespace Content.Server.GameObjects.Components.Atmos
{

View File

@@ -28,7 +28,6 @@ namespace Content.Server.GameObjects.Components.Atmos
[RegisterComponent, Serializable]
public class GridAtmosphereComponent : Component, IGridAtmosphereComponent
{
[Robust.Shared.IoC.Dependency] private IGameTiming _gameTiming = default!;
[Robust.Shared.IoC.Dependency] private IMapManager _mapManager = default!;
/// <summary>
@@ -65,6 +64,9 @@ namespace Content.Server.GameObjects.Components.Atmos
[ViewVariables]
private readonly HashSet<TileAtmosphere> _hotspotTiles = new HashSet<TileAtmosphere>(1000);
[ViewVariables]
private readonly HashSet<TileAtmosphere> _superconductivityTiles = new HashSet<TileAtmosphere>(1000);
[ViewVariables]
private readonly HashSet<MapIndices> _invalidatedCoords = new HashSet<MapIndices>(1000);
@@ -81,6 +83,7 @@ namespace Content.Server.GameObjects.Components.Atmos
ExcitedGroups,
HighPressureDelta,
Hotspots,
Superconductivity,
}
/// <inheritdoc />
@@ -150,13 +153,14 @@ namespace Content.Server.GameObjects.Components.Atmos
if (tile == null)
{
tile = new TileAtmosphere(this, _grid.Index, indices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C});
_tiles.Add(indices, tile);
_tiles[indices] = tile;
}
if (IsSpace(indices))
{
tile.Air = new GasMixture(GetVolumeForCells(1));
tile.Air.MarkImmutable();
_tiles[indices] = tile;
} else if (IsAirBlocked(indices))
{
@@ -170,17 +174,7 @@ namespace Content.Server.GameObjects.Components.Atmos
{
if (tile.Air == null && obs.FixVacuum)
{
var adjacent = GetAdjacentTiles(indices);
tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
var ratio = 1f / adjacent.Count;
foreach (var (direction, adj) in adjacent)
{
var mix = adj.Air.RemoveRatio(ratio);
tile.Air.Merge(mix);
adj.Air.Merge(mix);
}
FixVacuum(tile.GridIndices);
}
}
@@ -202,6 +196,25 @@ namespace Content.Server.GameObjects.Components.Atmos
_invalidatedCoords.Clear();
}
/// <inheritdoc />
public void FixVacuum(MapIndices indices)
{
var tile = GetTile(indices);
if (tile?.GridIndex != _grid.Index) return;
var adjacent = GetAdjacentTiles(indices);
tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
_tiles[indices] = tile;
var ratio = 1f / adjacent.Count;
foreach (var (direction, adj) in adjacent)
{
var mix = adj.Air.RemoveRatio(ratio);
tile.Air.Merge(mix);
adj.Air.Merge(mix);
}
}
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddActiveTile(TileAtmosphere tile)
@@ -237,6 +250,18 @@ namespace Content.Server.GameObjects.Components.Atmos
_hotspotTiles.Remove(tile);
}
public void AddSuperconductivityTile(TileAtmosphere tile)
{
if (tile?.GridIndex != _grid.Index) return;
_superconductivityTiles.Add(tile);
}
public void RemoveSuperconductivityTile(TileAtmosphere tile)
{
if (tile == null) return;
_superconductivityTiles.Remove(tile);
}
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddHighPressureDelta(TileAtmosphere tile)
@@ -302,14 +327,14 @@ namespace Content.Server.GameObjects.Components.Atmos
return _grid.GetTileRef(indices).Tile.IsEmpty;
}
public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices)
public Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false)
{
var sides = new Dictionary<Direction, TileAtmosphere>();
foreach (var dir in Cardinal)
{
var side = indices.Offset(dir);
var tile = GetTile(side);
if(tile?.Air != null)
if(tile?.Air != null || includeAirBlocked)
sides[dir] = tile;
}
@@ -361,6 +386,10 @@ namespace Content.Server.GameObjects.Components.Atmos
break;
case ProcessState.Hotspots:
ProcessHotspots();
_state = ProcessState.Superconductivity;
break;
case ProcessState.Superconductivity:
ProcessSuperconductivity();
_state = ProcessState.TileEqualize;
break;
}
@@ -463,6 +492,23 @@ namespace Content.Server.GameObjects.Components.Atmos
}
}
private void ProcessSuperconductivity()
{
_stopwatch.Restart();
var number = 0;
foreach (var superconductivity in _superconductivityTiles.ToArray())
{
superconductivity.Superconduct();
if (number++ < LagCheckIterations) continue;
number = 0;
// Process the rest next time.
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return;
}
}
private AirtightComponent GetObstructingComponent(MapIndices indices)
{
foreach (var v in _grid.GetSnapGridCell(indices, SnapGridOffset.Center))

View File

@@ -7,11 +7,11 @@ using Content.Server.GameObjects.Components.Strap;
using Content.Server.Interfaces;
using Content.Server.Mobs;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Buckle;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Strap;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystemMessages;

View File

@@ -1,10 +1,5 @@
using Content.Shared.GameObjects.Components.Cargo;
using Robust.Shared.GameObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Content.Server.GameObjects.Components.Cargo
{

View File

@@ -1,30 +1,30 @@
using System;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Maths;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Chemistry
{

View File

@@ -1,27 +1,28 @@
using System;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Server.Interfaces.GameObjects.Components.Items;
namespace Content.Server.GameObjects.Components.Chemistry
{

View File

@@ -1,12 +1,17 @@
using Content.Server.Chemistry;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Chemistry;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Utility;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -15,12 +20,6 @@ using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Content.Server.GameObjects.EntitySystems.Click;
namespace Content.Server.GameObjects.Components.Chemistry
{

View File

@@ -1,4 +1,4 @@
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Chemistry;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,36 +1,22 @@
using Content.Server.GameObjects.Components.Fluids;
using System.Linq;
using Content.Server.GameObjects.Components.Fluids;
using Content.Shared.Chemistry;
using Content.Shared.Physics;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore.Update.Internal;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Server.GameObjects.Components.Chemistry
{
[RegisterComponent]
class VaporComponent : Component, ICollideBehavior
{
#pragma warning disable 649
[Dependency] private readonly IMapManager _mapManager = default!;
#pragma warning enable 649
public override string Name => "Vapor";
[ViewVariables]
@@ -78,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
{
var worldBounds = collidable.WorldAABB;
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
var tiles = mapGrid.GetTilesIntersecting(worldBounds);
var amount = _transferAmount / ReagentUnit.New(tiles.Count());
foreach (var tile in tiles)

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Command;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.UserInterface;

View File

@@ -1,10 +1,7 @@
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Shared.Construction;
using Content.Shared.Construction;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -17,9 +14,6 @@ namespace Content.Server.GameObjects.Components.Construction
[RegisterComponent]
public class ConstructionComponent : Component, IExamine
{
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _loc;
#pragma warning restore 649
/// <inheritdoc />
public override string Name => "Construction";

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Conveyor;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;

View File

@@ -1,14 +1,14 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces.GameObjects;
using System;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.Audio;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
@@ -19,6 +19,7 @@ namespace Content.Server.GameObjects.Components.Damage
public class DamageOnHighSpeedImpactComponent : Component, ICollideBehavior
{
[Dependency] private IRobustRandom _robustRandom = default!;
[Dependency] private IGameTiming _gameTiming = default!;
public override string Name => "DamageOnHighSpeedImpact";
@@ -29,7 +30,9 @@ namespace Content.Server.GameObjects.Components.Damage
public string SoundHit { get; set; } = "";
public float StunChance { get; set; } = 0.25f;
public int StunMinimumDamage { get; set; } = 10;
public float StunSeconds { get; set; }
public float StunSeconds { get; set; } = 1f;
public float DamageCooldown { get; set; } = 2f;
private TimeSpan _lastHit = TimeSpan.Zero;
public override void ExposeData(ObjectSerializer serializer)
{
@@ -42,6 +45,7 @@ namespace Content.Server.GameObjects.Components.Damage
serializer.DataField(this, x => SoundHit, "soundHit", "");
serializer.DataField(this, x => StunChance, "stunChance", 0.25f);
serializer.DataField(this, x => StunSeconds, "stunSeconds", 1f);
serializer.DataField(this, x => DamageCooldown, "damageCooldown", 2f);
serializer.DataField(this, x => StunMinimumDamage, "stunMinimumDamage", 10);
}
@@ -53,11 +57,16 @@ namespace Content.Server.GameObjects.Components.Damage
if (speed < MinimumSpeed) return;
var damage = (int) (BaseDamage * (speed / MinimumSpeed) * Factor);
if(!string.IsNullOrEmpty(SoundHit))
EntitySystem.Get<AudioSystem>().PlayFromEntity(SoundHit, collidedWith, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if ((_gameTiming.CurTime - _lastHit).TotalSeconds < DamageCooldown)
return;
_lastHit = _gameTiming.CurTime;
var damage = (int) (BaseDamage * (speed / MinimumSpeed) * Factor);
if (Owner.TryGetComponent(out StunnableComponent stun) && _robustRandom.Prob(StunChance))
stun.Stun(StunSeconds);

View File

@@ -1,9 +1,10 @@
using Content.Server.GameObjects.Components.Interactable;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using System.Collections.Generic;
using Content.Shared.Interfaces.GameObjects.Components;
namespace Content.Server.GameObjects.Components.Damage
{
@@ -56,9 +57,9 @@ namespace Content.Server.GameObjects.Components.Damage
{
if (eventArgs.Target.TryGetComponent<DamageableComponent>(out var damageable))
{
if(tool.HasQuality(ToolQuality.Welding)) damageable.TakeDamage(Shared.GameObjects.DamageType.Heat, Damage, eventArgs.Using, eventArgs.User);
if(tool.HasQuality(ToolQuality.Welding)) damageable.TakeDamage(DamageType.Heat, Damage, eventArgs.Using, eventArgs.User);
else
damageable.TakeDamage(Shared.GameObjects.DamageType.Brute, Damage, eventArgs.Using, eventArgs.User);
damageable.TakeDamage(DamageType.Brute, Damage, eventArgs.Using, eventArgs.User);
return true;
}
return false;

View File

@@ -1,9 +1,8 @@
using System;
using Content.Shared.GameObjects;
using JetBrains.Annotations;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Damage
{
/// <summary>
/// Triggers an event when values rise above or drop below this threshold

View File

@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Content.Server.Interfaces.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Damage
{
//TODO: add support for component add/remove

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
@@ -12,7 +12,7 @@ using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Destructible
namespace Content.Server.GameObjects.Components.Damage
{
/// <summary>
/// Deletes the entity once a certain damage threshold has been reached.

View File

@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Damage
{
/// <summary>
/// Resistance set used by damageable objects.
@@ -35,7 +35,7 @@ namespace Content.Server.GameObjects
{
_resistances[damageType] = resistanceSetting;
});
}
}
}
/// <summary>

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Server.Interfaces;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;

View File

@@ -1,5 +1,7 @@
#nullable enable
using System.Linq;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;

View File

@@ -1,9 +1,9 @@
#nullable enable
using System;
using System.Linq;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Disposal;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Robust.Server.Console;
using Robust.Server.GameObjects;
@@ -217,7 +217,7 @@ namespace Content.Server.GameObjects.Components.Disposal
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _clangSound, "clangSound", "/Audio/effects/clang.ogg");
serializer.DataField(ref _clangSound, "clangSound", "/Audio/Effects/clang.ogg");
}
public override void Initialize()

View File

@@ -4,12 +4,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Disposal;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
@@ -92,7 +94,7 @@ namespace Content.Server.GameObjects.Components.Disposal
collidable.Anchored;
[ViewVariables]
private State State => _pressure >= 1 ? State.Ready : State.Pressurizing;
private PressureState State => _pressure >= 1 ? PressureState.Ready : PressureState.Pressurizing;
[ViewVariables]
private bool Engaged

View File

@@ -1,6 +1,6 @@
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Content.Shared.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.Interfaces.GameObjects;
@@ -38,20 +38,20 @@ namespace Content.Server.GameObjects.Components
{
return;
}
foreach (var (doAfter, id) in _doAfters)
{
// THE ALMIGHTY PYRAMID
var message = new DoAfterMessage(
id,
id,
doAfter.UserGrid,
doAfter.TargetGrid,
doAfter.StartTime,
doAfter.EventArgs.Delay,
doAfter.EventArgs.BreakOnUserMove,
doAfter.StartTime,
doAfter.EventArgs.Delay,
doAfter.EventArgs.BreakOnUserMove,
doAfter.EventArgs.BreakOnTargetMove,
doAfter.EventArgs.Target?.Uid ?? EntityUid.Invalid);
SendNetworkMessage(message, connectedClient);
}
}
@@ -59,7 +59,7 @@ namespace Content.Server.GameObjects.Components
private bool TryGetConnectedClient(out INetChannel? connectedClient)
{
connectedClient = null;
if (!Owner.TryGetComponent(out IActorComponent actorComponent))
{
return false;
@@ -81,15 +81,15 @@ namespace Content.Server.GameObjects.Components
if (TryGetConnectedClient(out var connectedClient))
{
var message = new DoAfterMessage(
_runningIndex,
_runningIndex,
doAfter.UserGrid,
doAfter.TargetGrid,
doAfter.StartTime,
doAfter.EventArgs.Delay,
doAfter.EventArgs.BreakOnUserMove,
doAfter.StartTime,
doAfter.EventArgs.Delay,
doAfter.EventArgs.BreakOnUserMove,
doAfter.EventArgs.BreakOnTargetMove,
doAfter.EventArgs.Target?.Uid ?? EntityUid.Invalid);
SendNetworkMessage(message, connectedClient);
}
@@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.Components
var message = new CancelledDoAfterMessage(index);
SendNetworkMessage(message, connectedClient);
}
_doAfters.Remove(doAfter);
}
@@ -127,4 +127,4 @@ namespace Content.Server.GameObjects.Components
_doAfters.Remove(doAfter);
}
}
}
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Linq;
using System.Threading;
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.Components.Atmos;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.Interfaces.GameObjects.Components;
@@ -17,11 +19,10 @@ using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
using CancellationTokenSource = System.Threading.CancellationTokenSource;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Doors
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
@@ -237,7 +238,7 @@ namespace Content.Server.GameObjects
if (percentage < 0.1f)
continue;
damage.TakeDamage(Shared.GameObjects.DamageType.Brute, DoorCrushDamage);
damage.TakeDamage(DamageType.Brute, DoorCrushDamage);
stun.Paralyze(DoorStunTime);
hitSomeone = true;
}

View File

@@ -1,5 +1,5 @@
using Content.Server.Explosions;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,6 +1,6 @@
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Weapon;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;

View File

@@ -1,9 +1,7 @@
using System;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;

View File

@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Physics;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
@@ -24,7 +24,6 @@ using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using Timer = Robust.Shared.Timers.Timer;
using Content.Shared.GameObjects.EntitySystems;
namespace Content.Server.GameObjects.Components.Fluids
{

View File

@@ -1,7 +1,6 @@
#nullable enable
using Content.Shared.Chemistry;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;

View File

@@ -1,21 +1,13 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.Interfaces;
using Content.Shared.Chemistry;
using Content.Shared.Interfaces.GameObjects.Components;
using Microsoft.EntityFrameworkCore.Update.Internal;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;

View File

@@ -3,14 +3,15 @@ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Items;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.BodySystem;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Health.BodySystem;
using Content.Shared.Physics;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
@@ -41,6 +42,8 @@ namespace Content.Server.GameObjects.Components.GUI
private string? _activeHand;
private uint _nextHand;
public event Action? OnItemChanged;
[ViewVariables(VVAccess.ReadWrite)]
public string? ActiveHand
{
@@ -59,6 +62,8 @@ namespace Content.Server.GameObjects.Components.GUI
[ViewVariables] private readonly List<Hand> _hands = new List<Hand>();
public IEnumerable<string> Hands => _hands.Select(h => h.Name);
// Mostly arbitrary.
public const float PickupRange = 2;
@@ -104,6 +109,12 @@ namespace Content.Server.GameObjects.Components.GUI
return GetHand(handName)?.Entity?.GetComponent<ItemComponent>();
}
public bool TryGetItem(string handName, [MaybeNullWhen(false)] out ItemComponent item)
{
item = GetItem(handName);
return item != null;
}
public ItemComponent? GetActiveHand => ActiveHand == null
? null
: GetItem(ActiveHand);
@@ -135,6 +146,8 @@ namespace Content.Server.GameObjects.Components.GUI
{
if (PutInHand(item, hand, false))
{
OnItemChanged?.Invoke();
return true;
}
}
@@ -155,6 +168,7 @@ namespace Content.Server.GameObjects.Components.GUI
if (success)
{
item.Owner.Transform.LocalPosition = Vector2.Zero;
OnItemChanged?.Invoke();
}
_entitySystemManager.GetEntitySystem<InteractionSystem>().HandSelectedInteraction(Owner, item.Owner);
@@ -202,7 +216,7 @@ namespace Content.Server.GameObjects.Components.GUI
if (!interactionSystem.TryDroppedInteraction(Owner, item.Owner))
return false;
}
interactionSystem.DroppedInteraction(Owner, item.Owner);
return true;
}
@@ -249,6 +263,8 @@ namespace Content.Server.GameObjects.Components.GUI
container.Insert(item.Owner);
}
OnItemChanged?.Invoke();
Dirty();
return true;
}
@@ -299,6 +315,8 @@ namespace Content.Server.GameObjects.Components.GUI
container.Insert(item.Owner);
}
OnItemChanged?.Invoke();
Dirty();
return true;
}
@@ -363,6 +381,8 @@ namespace Content.Server.GameObjects.Components.GUI
throw new InvalidOperationException();
}
OnItemChanged?.Invoke();
Dirty();
return true;
}
@@ -414,6 +434,8 @@ namespace Content.Server.GameObjects.Components.GUI
ActiveHand ??= name;
OnItemChanged?.Invoke();
Dirty();
}
@@ -434,6 +456,8 @@ namespace Content.Server.GameObjects.Components.GUI
_activeHand = _hands.FirstOrDefault()?.Name;
}
OnItemChanged?.Invoke();
Dirty();
}
@@ -644,13 +668,13 @@ namespace Content.Server.GameObjects.Components.GUI
Dirty();
if (!message.Entity.TryGetComponent(out IPhysicsComponent physics))
if (!message.Entity.TryGetComponent(out ICollidableComponent collidable))
{
return;
}
// set velocity to zero
physics.Stop();
collidable.Stop();
return;
}
}

View File

@@ -1,4 +1,3 @@
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Items.Storage;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
@@ -7,7 +6,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Timers;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.GUI
{
// Handles the special behavior of pockets/ID card slot and their relation to uniforms.
[RegisterComponent]

View File

@@ -1,7 +1,7 @@
using Robust.Shared.Interfaces.GameObjects;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.GUI
{
/// <summary>
/// Allows for overriding inventory-related behavior on an entity.

View File

@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Server.GameObjects.Components.Items.Clothing;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
@@ -22,9 +20,9 @@ using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.ViewVariables;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventoryMessage;
using static Content.Shared.GameObjects.Components.Inventory.SharedInventoryComponent.ClientInventoryMessage;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.GUI
{
[RegisterComponent]
public class InventoryComponent : SharedInventoryComponent, IExAct, IEffectBlocker, IPressureProtection
@@ -35,9 +33,13 @@ namespace Content.Server.GameObjects
#pragma warning restore 649
[ViewVariables]
private readonly Dictionary<Slots, ContainerSlot> SlotContainers = new Dictionary<Slots, ContainerSlot>();
private readonly Dictionary<Slots, ContainerSlot> _slotContainers = new Dictionary<Slots, ContainerSlot>();
private KeyValuePair<Slots, (EntityUid entity, bool fits)>? HoverEntity;
private KeyValuePair<Slots, (EntityUid entity, bool fits)>? _hoverEntity;
public IEnumerable<Slots> Slots => _slotContainers.Keys;
public event Action OnItemChanged;
public override void Initialize()
{
@@ -45,7 +47,7 @@ namespace Content.Server.GameObjects
foreach (var slotName in InventoryInstance.SlotMasks)
{
if (slotName != Slots.NONE)
if (slotName != EquipmentSlotDefines.Slots.NONE)
{
AddSlot(slotName);
}
@@ -60,7 +62,7 @@ namespace Content.Server.GameObjects
{
var multiplier = 1f;
foreach (var (slot, containerSlot) in SlotContainers)
foreach (var (slot, containerSlot) in _slotContainers)
{
foreach (var entity in containerSlot.ContainedEntities)
{
@@ -83,7 +85,7 @@ namespace Content.Server.GameObjects
{
var multiplier = 1f;
foreach (var (slot, containerSlot) in SlotContainers)
foreach (var (slot, containerSlot) in _slotContainers)
{
foreach (var entity in containerSlot.ContainedEntities)
{
@@ -112,7 +114,7 @@ namespace Content.Server.GameObjects
public override void OnRemove()
{
var slots = SlotContainers.Keys.ToList();
var slots = _slotContainers.Keys.ToList();
foreach (var slot in slots)
{
RemoveSlot(slot);
@@ -142,15 +144,15 @@ namespace Content.Server.GameObjects
}
public T GetSlotItem<T>(Slots slot) where T : ItemComponent
{
if (!SlotContainers.ContainsKey(slot))
if (!_slotContainers.ContainsKey(slot))
{
return null;
}
var containedEntity = SlotContainers[slot].ContainedEntity;
var containedEntity = _slotContainers[slot].ContainedEntity;
if (containedEntity?.Deleted == true)
{
SlotContainers[slot] = null;
_slotContainers[slot] = null;
containedEntity = null;
Dirty();
}
@@ -171,7 +173,7 @@ namespace Content.Server.GameObjects
/// </remarks>
/// <param name="slot">The slot to put the item in.</param>
/// <param name="item">The item to insert into the slot.</param>
/// <param name="reason">The translated reason why the item cannot be equiped, if this function returns false. Can be null.</param>
/// <param name="reason">The translated reason why the item cannot be equipped, if this function returns false. Can be null.</param>
/// <returns>True if the item was successfully inserted, false otherwise.</returns>
public bool Equip(Slots slot, ItemComponent item, out string reason)
{
@@ -186,7 +188,7 @@ namespace Content.Server.GameObjects
return false;
}
var inventorySlot = SlotContainers[slot];
var inventorySlot = _slotContainers[slot];
if (!inventorySlot.Insert(item.Owner))
{
return false;
@@ -194,6 +196,8 @@ namespace Content.Server.GameObjects
_entitySystemManager.GetEntitySystem<InteractionSystem>().EquippedInteraction(Owner, item.Owner, slot);
OnItemChanged?.Invoke();
Dirty();
return true;
@@ -241,7 +245,7 @@ namespace Content.Server.GameObjects
reason = Loc.GetString("You can't equip this!");
}
return pass && SlotContainers[slot].CanInsert(item.Owner);
return pass && _slotContainers[slot].CanInsert(item.Owner);
}
public bool CanEquip(Slots slot, ItemComponent item) => CanEquip(slot, item, out var _);
@@ -260,7 +264,7 @@ namespace Content.Server.GameObjects
return false;
}
var inventorySlot = SlotContainers[slot];
var inventorySlot = _slotContainers[slot];
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
if (!inventorySlot.Remove(inventorySlot.ContainedEntity))
{
@@ -273,6 +277,8 @@ namespace Content.Server.GameObjects
_entitySystemManager.GetEntitySystem<InteractionSystem>().UnequippedInteraction(Owner, item.Owner, slot);
OnItemChanged?.Invoke();
Dirty();
return true;
@@ -290,7 +296,7 @@ namespace Content.Server.GameObjects
if (!ActionBlockerSystem.CanUnequip(Owner))
return false;
var InventorySlot = SlotContainers[slot];
var InventorySlot = _slotContainers[slot];
return InventorySlot.ContainedEntity != null && InventorySlot.CanRemove(InventorySlot.ContainedEntity);
}
@@ -309,7 +315,12 @@ namespace Content.Server.GameObjects
}
Dirty();
return SlotContainers[slot] = ContainerManagerComponent.Create<ContainerSlot>(GetSlotString(slot), Owner);
_slotContainers[slot] = ContainerManagerComponent.Create<ContainerSlot>(GetSlotString(slot), Owner);
OnItemChanged?.Invoke();
return _slotContainers[slot];
}
/// <summary>
@@ -333,7 +344,10 @@ namespace Content.Server.GameObjects
"Unable to remove slot as the contained clothing could not be dropped");
}
SlotContainers.Remove(slot);
_slotContainers.Remove(slot);
OnItemChanged?.Invoke();
Dirty();
}
@@ -344,7 +358,7 @@ namespace Content.Server.GameObjects
/// <returns>True if the slot exists, false otherwise.</returns>
public bool HasSlot(Slots slot)
{
return SlotContainers.ContainsKey(slot);
return _slotContainers.ContainsKey(slot);
}
/// <summary>
@@ -356,7 +370,7 @@ namespace Content.Server.GameObjects
// make sure this is one of our containers.
// Technically the correct way would be to enumerate the possible slot names
// comparing with this container, but I might as well put the dictionary to good use.
if (!(container is ContainerSlot slot) || !SlotContainers.ContainsValue(slot))
if (!(container is ContainerSlot slot) || !_slotContainers.ContainsValue(slot))
return;
if (entity.TryGetComponent(out ItemComponent itemComp))
@@ -364,6 +378,8 @@ namespace Content.Server.GameObjects
itemComp.RemovedFromSlot();
}
OnItemChanged?.Invoke();
Dirty();
}
@@ -419,7 +435,7 @@ namespace Content.Server.GameObjects
if (activeHand != null && GetSlotItem(msg.Inventoryslot) == null)
{
var canEquip = CanEquip(msg.Inventoryslot, activeHand, out var reason);
HoverEntity = new KeyValuePair<Slots, (EntityUid entity, bool fits)>(msg.Inventoryslot, (activeHand.Owner.Uid, canEquip));
_hoverEntity = new KeyValuePair<Slots, (EntityUid entity, bool fits)>(msg.Inventoryslot, (activeHand.Owner.Uid, canEquip));
Dirty();
}
@@ -478,7 +494,7 @@ namespace Content.Server.GameObjects
public override ComponentState GetComponentState()
{
var list = new List<KeyValuePair<Slots, EntityUid>>();
foreach (var (slot, container) in SlotContainers)
foreach (var (slot, container) in _slotContainers)
{
if (container.ContainedEntity != null)
{
@@ -486,8 +502,8 @@ namespace Content.Server.GameObjects
}
}
var hover = HoverEntity;
HoverEntity = null;
var hover = _hoverEntity;
_hoverEntity = null;
return new InventoryComponentState(list, hover);
}
@@ -499,7 +515,7 @@ namespace Content.Server.GameObjects
return;
}
foreach (var slot in SlotContainers.Values.ToList())
foreach (var slot in _slotContainers.Values.ToList())
{
foreach (var entity in slot.ContainedEntities)
{

View File

@@ -0,0 +1,372 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Content.Server.Interfaces;
using Content.Shared.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.ViewVariables;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Server.GameObjects.Components.GUI
{
[RegisterComponent]
public sealed class StrippableComponent : SharedStrippableComponent, IDragDrop
{
[Dependency] private IServerNotifyManager _notifyManager = default!;
public const float StripDelay = 2f;
[ViewVariables]
private BoundUserInterface _userInterface;
private InventoryComponent _inventoryComponent;
private HandsComponent _handsComponent;
public override void Initialize()
{
base.Initialize();
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(StrippingUiKey.Key);
_userInterface.OnReceiveMessage += HandleUserInterfaceMessage;
_inventoryComponent = Owner.GetComponent<InventoryComponent>();
_handsComponent = Owner.GetComponent<HandsComponent>();
_inventoryComponent.OnItemChanged += UpdateSubscribed;
// Initial update.
UpdateSubscribed();
}
private void UpdateSubscribed()
{
var inventory = GetInventorySlots();
var hands = GetHandSlots();
_userInterface.SetState(new StrippingBoundUserInterfaceState(inventory, hands));
}
public bool CanDragDrop(DragDropEventArgs eventArgs)
{
return eventArgs.User.HasComponent<HandsComponent>()
&& eventArgs.Target != eventArgs.Dropped && eventArgs.Target == eventArgs.User;
}
public bool DragDrop(DragDropEventArgs eventArgs)
{
if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) return false;
OpenUserInterface(actor.playerSession);
return true;
}
private Dictionary<Slots, string> GetInventorySlots()
{
var dictionary = new Dictionary<Slots, string>();
foreach (var slot in _inventoryComponent.Slots)
{
dictionary[slot] = _inventoryComponent.GetSlotItem(slot)?.Owner.Name ?? "None";
}
return dictionary;
}
private Dictionary<string, string> GetHandSlots()
{
var dictionary = new Dictionary<string, string>();
foreach (var hand in _handsComponent.Hands)
{
dictionary[hand] = _handsComponent.GetItem(hand)?.Owner.Name ?? "None";
}
return dictionary;
}
private void OpenUserInterface(IPlayerSession session)
{
_userInterface.Open(session);
}
/// <summary>
/// Places item in user's active hand to an inventory slot.
/// </summary>
private async void PlaceActiveHandItemInInventory(IEntity user, Slots slot)
{
var inventory = Owner.GetComponent<InventoryComponent>();
var userHands = user.GetComponent<HandsComponent>();
var item = userHands.GetActiveHand;
bool Check()
{
if (!ActionBlockerSystem.CanInteract(user))
return false;
if (item == null)
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("You aren't holding anything!"));
return false;
}
if (!userHands.CanDrop(userHands.ActiveHand!))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("You can't drop that!"));
return false;
}
if (!inventory.HasSlot(slot))
return false;
if (inventory.TryGetSlotItem(slot, out ItemComponent _))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} already {0:have} something there!", Owner));
return false;
}
if (!inventory.CanEquip(slot, item))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot equip that there!", Owner));
return false;
}
return true;
}
var doAfterSystem = EntitySystem.Get<DoAfterSystem>();
var doAfterArgs = new DoAfterEventArgs(user, StripDelay, CancellationToken.None, Owner)
{
ExtraCheck = Check,
BreakOnStun = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
BreakOnUserMove = true,
NeedHand = true,
};
var result = await doAfterSystem.DoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished) return;
userHands.Drop(item!.Owner, false);
inventory.Equip(slot, item!.Owner);
UpdateSubscribed();
}
/// <summary>
/// Places item in user's active hand in one of the entity's hands.
/// </summary>
private async void PlaceActiveHandItemInHands(IEntity user, string hand)
{
var hands = Owner.GetComponent<HandsComponent>();
var userHands = user.GetComponent<HandsComponent>();
var item = userHands.GetActiveHand;
bool Check()
{
if (!ActionBlockerSystem.CanInteract(user))
return false;
if (item == null)
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("You aren't holding anything!"));
return false;
}
if (!userHands.CanDrop(userHands.ActiveHand!))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("You can't drop that!"));
return false;
}
if (!hands.HasHand(hand))
return false;
if (hands.TryGetItem(hand, out var _))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} already {0:have} something there!", Owner));
return false;
}
if (!hands.CanPutInHand(item, hand))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot put that there!", Owner));
return false;
}
return true;
}
var doAfterSystem = EntitySystem.Get<DoAfterSystem>();
var doAfterArgs = new DoAfterEventArgs(user, StripDelay, CancellationToken.None, Owner)
{
ExtraCheck = Check,
BreakOnStun = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
BreakOnUserMove = true,
NeedHand = true,
};
var result = await doAfterSystem.DoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished) return;
userHands.Drop(hand, false);
hands.PutInHand(item, hand, false);
UpdateSubscribed();
}
/// <summary>
/// Takes an item from the inventory and places it in the user's active hand.
/// </summary>
private async void TakeItemFromInventory(IEntity user, Slots slot)
{
var inventory = Owner.GetComponent<InventoryComponent>();
var userHands = user.GetComponent<HandsComponent>();
bool Check()
{
if (!ActionBlockerSystem.CanInteract(user))
return false;
if (!inventory.HasSlot(slot))
return false;
if (!inventory.TryGetSlotItem(slot, out ItemComponent itemToTake))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} {0:have} nothing there!", Owner));
return false;
}
if (!inventory.CanUnequip(slot))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot unequip that!", Owner));
return false;
}
return true;
}
var doAfterSystem = EntitySystem.Get<DoAfterSystem>();
var doAfterArgs = new DoAfterEventArgs(user, StripDelay, CancellationToken.None, Owner)
{
ExtraCheck = Check,
BreakOnStun = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
BreakOnUserMove = true,
};
var result = await doAfterSystem.DoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished) return;
var item = inventory.GetSlotItem(slot);
inventory.Unequip(slot);
userHands.PutInHandOrDrop(item);
UpdateSubscribed();
}
/// <summary>
/// Takes an item from a hand and places it in the user's active hand.
/// </summary>
private async void TakeItemFromHands(IEntity user, string hand)
{
var hands = Owner.GetComponent<HandsComponent>();
var userHands = user.GetComponent<HandsComponent>();
bool Check()
{
if (!ActionBlockerSystem.CanInteract(user))
return false;
if (!hands.HasHand(hand))
return false;
if (!hands.TryGetItem(hand, out var heldItem))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} {0:have} nothing there!", Owner));
return false;
}
if (!hands.CanDrop(hand))
{
_notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot drop that!", Owner));
return false;
}
return true;
}
var doAfterSystem = EntitySystem.Get<DoAfterSystem>();
var doAfterArgs = new DoAfterEventArgs(user, StripDelay, CancellationToken.None, Owner)
{
ExtraCheck = Check,
BreakOnStun = true,
BreakOnDamage = true,
BreakOnTargetMove = true,
BreakOnUserMove = true,
};
var result = await doAfterSystem.DoAfter(doAfterArgs);
if (result != DoAfterStatus.Finished) return;
var item = hands.GetItem(hand);
hands.Drop(hand, false);
userHands.PutInHandOrDrop(item);
UpdateSubscribed();
}
private void HandleUserInterfaceMessage(ServerBoundUserInterfaceMessage obj)
{
var user = obj.Session.AttachedEntity;
if (user == null || !(user.TryGetComponent(out HandsComponent userHands))) return;
var placingItem = userHands.GetActiveHand != null;
switch (obj.Message)
{
case StrippingInventoryButtonPressed inventoryMessage:
var inventory = Owner.GetComponent<InventoryComponent>();
if (inventory.TryGetSlotItem(inventoryMessage.Slot, out ItemComponent _))
placingItem = false;
if(placingItem)
PlaceActiveHandItemInInventory(user, inventoryMessage.Slot);
else
TakeItemFromInventory(user, inventoryMessage.Slot);
break;
case StrippingHandButtonPressed handMessage:
var hands = Owner.GetComponent<HandsComponent>();
if (hands.TryGetItem(handMessage.Hand, out _))
placingItem = false;
if(placingItem)
PlaceActiveHandItemInHands(user, handMessage.Hand);
else
TakeItemFromHands(user, handMessage.Hand);
break;
default:
break;
}
}
}
}

View File

@@ -1,7 +1,7 @@
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.GameObjects.Components.Gravity;
using Content.Shared.GameObjects.Components.Interactable;

View File

@@ -1,11 +1,12 @@
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Weapon.Melee
namespace Content.Server.GameObjects.Components.Healing
{
[RegisterComponent]
public class HealingComponent : Component, IAfterInteract, IUse

View File

@@ -1,10 +1,11 @@
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Clothing;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;

View File

@@ -2,9 +2,8 @@
using System;
using Content.Server.Atmos;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects;
@@ -21,7 +20,6 @@ using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using Robust.Shared.Serialization;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.Components.Interactable
{
@@ -212,13 +210,22 @@ namespace Content.Server.GameObjects.Components.Interactable
}
}
protected override void Shutdown()
{
base.Shutdown();
_welderSystem.Unsubscribe(this);
}
public void OnUpdate(float frameTime)
{
if (!HasQuality(ToolQuality.Welding) || !WelderLit)
if (!HasQuality(ToolQuality.Welding) || !WelderLit || Owner.Deleted)
return;
_solutionComponent?.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
Owner.Transform.GridPosition
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
if (Fuel == 0)
ToggleWelderStatus();

View File

@@ -1,19 +1,18 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Items.Clothing
{
[RegisterComponent]
[ComponentReference(typeof(ItemComponent))]

View File

@@ -1,5 +1,4 @@
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Shared.Audio;
using Content.Shared.Audio;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;

View File

@@ -0,0 +1,61 @@
using System;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Items.RCD
{
[RegisterComponent]
public class RCDAmmoComponent : Component, IAfterInteract, IExamine
{
#pragma warning disable 649
[Dependency] private IServerNotifyManager _serverNotifyManager;
#pragma warning restore 649
public override string Name => "RCDAmmo";
//How much ammo we refill
[ViewVariables(VVAccess.ReadWrite)] private int refillAmmo = 5;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref refillAmmo, "refillAmmo", 5);
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("It holds {0} charges.", refillAmmo));
}
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (eventArgs.Target == null || !eventArgs.Target.TryGetComponent(out RCDComponent rcdComponent) || !eventArgs.User.TryGetComponent(out IHandsComponent hands))
{
return;
}
if (rcdComponent.maxAmmo - rcdComponent._ammo < refillAmmo)
{
_serverNotifyManager.PopupMessage(rcdComponent.Owner, eventArgs.User, "The RCD is full!");
return;
}
rcdComponent._ammo = Math.Min(rcdComponent.maxAmmo, rcdComponent._ammo + refillAmmo);
_serverNotifyManager.PopupMessage(rcdComponent.Owner, eventArgs.User, "You refill the RCD.");
//Deleting a held item causes a lot of errors
hands.Drop(Owner, false);
Owner.Delete();
}
}
}

View File

@@ -0,0 +1,241 @@
using System;
using System.Threading;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Items.RCD
{
[RegisterComponent]
public class RCDComponent : Component, IAfterInteract, IUse, IExamine
{
#pragma warning disable 649
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IServerEntityManager _serverEntityManager;
[Dependency] private IServerNotifyManager _serverNotifyManager;
#pragma warning restore 649
public override string Name => "RCD";
private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct.
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
[ViewVariables(VVAccess.ReadWrite)] public int maxAmmo;
public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo.
[ViewVariables(VVAccess.ReadWrite)] private float _delay;
private DoAfterSystem doAfterSystem;
///Enum to store the different mode states for clarity.
private enum RcdMode
{
Floors,
Walls,
Airlock,
Deconstruct
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref maxAmmo, "maxAmmo", 5);
serializer.DataField(ref _delay, "delay", 2f);
}
public override void Initialize()
{
base.Initialize();
_ammo = maxAmmo;
doAfterSystem = EntitySystem.Get<DoAfterSystem>();
}
///<summary>
/// Method called when the RCD is clicked in-hand, this will cycle the RCD mode.
///</summary>
public bool UseEntity(UseEntityEventArgs eventArgs)
{
SwapMode(eventArgs);
return true;
}
///<summary>
///Method to allow the user to swap the mode of the RCD by clicking it in hand, the actual in hand clicking bit is done over on UseEntity()
///@param UseEntityEventArgs = The entity which triggered this method call, used to know where to play the "click" sound.
///</summary>
public void SwapMode(UseEntityEventArgs eventArgs)
{
_entitySystemManager.GetEntitySystem<AudioSystem>().PlayFromEntity("/Audio/Items/genhit.ogg", Owner);
int mode = (int) _mode; //Firstly, cast our RCDmode mode to an int (enums are backed by ints anyway by default)
mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state
_mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it.
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"The RCD is now set to {this._mode} mode."); //Prints an overhead message above the RCD
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("It's currently on {0} mode, and holds {1} charges.",_mode.ToString(), this._ammo));
}
public async void AfterInteract(AfterInteractEventArgs eventArgs)
{
//No changing mode mid-RCD
var startingMode = _mode;
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
var snapPos = mapGrid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
//Using an RCD isn't instantaneous
var cancelToken = new CancellationTokenSource();
var doAfterEventArgs = new DoAfterEventArgs(eventArgs.User, _delay, cancelToken.Token, eventArgs.Target)
{
BreakOnDamage = true,
BreakOnStun = true,
NeedHand = true,
ExtraCheck = () => IsRCDStillValid(eventArgs, mapGrid, tile, snapPos, startingMode) //All of the sanity checks are here
};
var result = await doAfterSystem.DoAfter(doAfterEventArgs);
if (result == DoAfterStatus.Cancelled)
{
return;
}
switch (_mode)
{
//Floor mode just needs the tile to be a space tile (subFloor)
case RcdMode.Floors:
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(_tileDefinitionManager["floor_steel"].TileId));
break;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct:
if (!tile.IsBlockedTurf(true)) //Delete the turf
{
mapGrid.SetTile(snapPos, Tile.Empty);
}
else //Delete what the user targeted
{
eventArgs.Target.Delete();
}
break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
case RcdMode.Walls:
var ent = _serverEntityManager.SpawnEntity("solid_wall", mapGrid.GridTileToLocal(snapPos));
ent.Transform.LocalRotation = Owner.Transform.LocalRotation; //Now apply icon smoothing.
break;
case RcdMode.Airlock:
var airlock = _serverEntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
airlock.Transform.LocalRotation = Owner.Transform.LocalRotation; //Now apply icon smoothing.
break;
default:
return; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}
_entitySystemManager.GetEntitySystem<AudioSystem>().PlayFromEntity("/Audio/Items/deconstruct.ogg", Owner);
_ammo--;
}
private bool IsRCDStillValid(AfterInteractEventArgs eventArgs, IMapGrid mapGrid, TileRef tile, MapIndices snapPos, RcdMode startingMode)
{
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
if (_ammo <= 0)
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"The RCD is out of ammo!");
return false;
}
if (_mode != startingMode)
{
return false;
}
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
if (coordinates == GridCoordinates.InvalidGrid || !InteractionChecks.InRangeUnobstructed(eventArgs))
{
return false;
}
switch (_mode)
{
//Floor mode just needs the tile to be a space tile (subFloor)
case RcdMode.Floors:
if (!tile.Tile.IsEmpty)
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"You can only build a floor on space!");
return false;
}
return true;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct:
if (tile.Tile.IsEmpty)
{
return false;
}
//They tried to decon a turf but the turf is blocked
if (eventArgs.Target == null && tile.IsBlockedTurf(true))
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!");
return false;
}
//They tried to decon a non-turf but it's not in the whitelist
if (eventArgs.Target != null && !eventArgs.Target.TryGetComponent(out RCDDeconstructWhitelist rcd_decon))
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"You can't deconstruct that!");
return false;
}
return true;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
case RcdMode.Walls:
if (tile.Tile.IsEmpty)
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"Cannot build a wall on space!");
return false;
}
if (tile.IsBlockedTurf(true))
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!");
return false;
}
return true;
case RcdMode.Airlock:
if (tile.Tile.IsEmpty)
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"Cannot build an airlock on space!");
return false;
}
if (tile.IsBlockedTurf(true))
{
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!");
return false;
}
return true;
default:
return false; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}
}
}
}

View File

@@ -0,0 +1,10 @@
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Items.RCD
{
[RegisterComponent]
public class RCDDeconstructWhitelist : Component
{
public override string Name => "RCDDeconstructWhitelist";
}
}

View File

@@ -1,151 +0,0 @@
using System;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Items
{
[RegisterComponent]
public class RCDComponent : Component, IAfterInteract, IUse, IExamine
{
#pragma warning disable 649
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IServerEntityManager _serverEntityManager;
[Dependency] private IServerNotifyManager _serverNotifyManager;
#pragma warning restore 649
public override string Name => "RCD";
private string _outputTile = "floor_steel";
private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct.
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
private int _ammo = 5; //How much "ammo" we have left. You can refille this with RCD ammo.
///Enum to store the different mode states for clarity.
private enum RcdMode
{
Floors,
Walls,
Deconstruct
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _outputTile, "output", "floor_steel");
}
///<summary>
/// Method called when the RCD is clicked in-hand, this will swap the RCD's mode from "floors" to "walls".
///</summary>
public bool UseEntity(UseEntityEventArgs eventArgs)
{
SwapMode(eventArgs);
return true;
}
///<summary>
///Method to allow the user to swap the mode of the RCD by clicking it in hand, the actual in hand clicking bit is done over on UseEntity()
///@param UseEntityEventArgs = The entity which triggered this method call, used to know where to play the "click" sound.
///</summary>
public void SwapMode(UseEntityEventArgs eventArgs)
{
_entitySystemManager.GetEntitySystem<AudioSystem>().PlayFromEntity("/Audio/Items/genhit.ogg", Owner);
int mode = (int) this._mode; //Firstly, cast our RCDmode mode to an int (enums are backed by ints anyway by default)
mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state
this._mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it.
switch (this._mode)
{
case RcdMode.Floors:
_outputTile = "floor_steel";
break;
case RcdMode.Walls:
_outputTile = "base_wall";
break;
case RcdMode.Deconstruct:
_outputTile = "space";
break;
}
_serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"The RCD is now set to {this._mode} mode."); //Prints an overhead message above the RCD
}
///<summary>
///Method called when the user examines this object, it'll simply add the mode that it's in to the object's description
///@params message = The original message from examining, like ..() in BYOND's examine
///</summary>
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("It's currently on {0} mode, and holds {1} charges.",_mode.ToString(), this._ammo));
}
///<summary>
/// Method to handle clicking on a tile to then appropriately RCD it. This can have several behaviours depending on mode.
/// @param eventAargs = An action event telling us what tile was clicked on. We use this to exrapolate where to place the new tile / remove the old one etc.
///</summary>
public void AfterInteract(AfterInteractEventArgs eventArgs)
{
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
if (_ammo <= 0 || coordinates == GridCoordinates.InvalidGrid || !InteractionChecks.InRangeUnobstructed(eventArgs))
{
return;
}
var targetTile = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
var canPlaceTile = targetTile.IsSubFloor; //Boolean to check if we're able to build the desired tile. This defaults to checking for subfloors, but is overridden by "deconstruct" which sets it to the inverse.
switch (this._mode)
{
//Floor mode just needs the tile to be a space tile (subFloor)
case RcdMode.Floors:
break;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct:
canPlaceTile = !targetTile.IsSubFloor;
break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
case RcdMode.Walls:
var snapPos = mapGrid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
var ent = _serverEntityManager.SpawnEntity("solid_wall", mapGrid.GridTileToLocal(snapPos));
ent.Transform.LocalRotation = Owner.Transform.LocalRotation; //Now apply icon smoothing.
_entitySystemManager.GetEntitySystem<AudioSystem>().PlayFromEntity("/Audio/Items/deconstruct.ogg", Owner);
_ammo--;
return; //Alright we're done here
default:
return; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}
ITileDefinition desiredTile = null;
desiredTile = _tileDefinitionManager[_outputTile];
if (canPlaceTile) //If desiredTile is null by this point, something has gone horribly wrong and you need to fix it.
{
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
_entitySystemManager.GetEntitySystem<AudioSystem>().PlayFromEntity("/Audio/Items/deconstruct.ogg", Owner);
_ammo--;
}
}
}
}

View File

@@ -1,16 +1,12 @@
using System.Linq;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Microsoft.EntityFrameworkCore.Internal;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage

View File

@@ -2,14 +2,14 @@
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Physics;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystems;
@@ -49,8 +49,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage
private bool _occludesLight;
private bool _open;
private bool _isWeldedShut;
private int _collisionMaskStorage;
private int _collisionLayerStorage;
[ViewVariables]
protected Container Contents;
@@ -201,18 +199,13 @@ namespace Content.Server.GameObjects.Components.Items.Storage
{
if (!_isCollidableWhenOpen && Owner.TryGetComponent<ICollidableComponent>(out var collidableComponent))
{
var physShape = collidableComponent.PhysicsShapes[0];
if (Open)
{
_collisionMaskStorage = physShape.CollisionMask;
physShape.CollisionMask = (int)CollisionGroup.Impassable;
_collisionLayerStorage = physShape.CollisionLayer;
physShape.CollisionLayer = (int)CollisionGroup.None;
collidableComponent.Hard = false;
}
else
{
physShape.CollisionMask = _collisionMaskStorage;
physShape.CollisionLayer = _collisionLayerStorage;
collidableComponent.Hard = true;
}
}

View File

@@ -2,7 +2,6 @@ using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
{

View File

@@ -1,9 +1,7 @@
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill
{

View File

@@ -1,6 +1,5 @@
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Random;

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill

View File

@@ -1,7 +1,6 @@
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components.Items.Storage.Fill

View File

@@ -1,12 +1,12 @@
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Throw;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Items;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Containers;
@@ -14,11 +14,10 @@ using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components
namespace Content.Server.GameObjects.Components.Items.Storage
{
[RegisterComponent]
[ComponentReference(typeof(StorableComponent))]
@@ -29,7 +28,6 @@ namespace Content.Server.GameObjects.Components
public override uint? NetID => ContentNetIDs.ITEM;
#pragma warning disable 649
[Dependency] private readonly IRobustRandom _robustRandom;
[Dependency] private readonly IMapManager _mapManager;
#pragma warning restore 649
@@ -93,7 +91,7 @@ namespace Content.Server.GameObjects.Components
return false;
}
if (Owner.TryGetComponent(out PhysicsComponent physics) &&
if (Owner.TryGetComponent(out CollidableComponent physics) &&
physics.Anchored)
{
return false;

View File

@@ -1,8 +1,8 @@
using Content.Server.GameObjects.Components.Access;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Storage;

View File

@@ -1,34 +1,36 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.BodySystem;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.Chemistry;
using Robust.Shared.Serialization;
using Robust.Shared.Interfaces.GameObjects;
using Content.Shared.Prototypes.Kitchen;
using Content.Shared.Kitchen;
using Robust.Shared.Timers;
using Robust.Server.GameObjects;
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Localization;
using Content.Server.Interfaces;
using Robust.Shared.Audio;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.Chat;
using Content.Shared.BodySystem;
using Robust.Shared.GameObjects.Systems;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Health.BodySystem;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.Health.BodySystem;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Kitchen;
using Content.Shared.Prototypes.Kitchen;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Kitchen
{
@@ -311,7 +313,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
(_currentCookTimerTime == (uint)recipeToCook.CookTime);
SetAppearance(MicrowaveVisualState.Cooking);
_audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), (System.Action)(() =>
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() =>
{
if (_lostPower)
{

View File

@@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components
{

View File

@@ -8,10 +8,10 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Logger = Robust.Shared.Log.Logger;
namespace Content.Server.GameObjects.Components.Markers
{

View File

@@ -1,5 +1,5 @@
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.Jobs;
using Content.Shared.Roles;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;

View File

@@ -1,18 +1,13 @@
using System;
using Content.Server.GameObjects.Components.Markers;
using System.Collections.Generic;
using Content.Server.GameTicking;
using Content.Server.Interfaces.GameTicking;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Maths;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using Logger = Robust.Shared.Log.Logger;
namespace Content.Server.GameObjects.Components.Markers
{

View File

@@ -1,5 +1,4 @@
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;

View File

@@ -1,8 +1,13 @@
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Medical;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
@@ -11,8 +16,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Shared.Interfaces.GameObjects.Components;
namespace Content.Server.GameObjects.Components.Medical
{

View File

@@ -1,6 +1,6 @@
using System.Linq;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;

View File

@@ -1,5 +1,6 @@
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;

View File

@@ -1,12 +1,11 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Mobs;
using Content.Server.Mobs;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Mobs
{
/// <summary>
/// Defines the blocking effect of each damage state, and what effects to apply upon entering or exiting the state

View File

@@ -1,7 +1,8 @@
using System.Collections.Generic;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Damage;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Mobs.DamageThresholdTemplates
{
/// <summary>
/// Defines the threshold values for each damage state for any kind of species

View File

@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.GameObjects;
using Content.Server.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using JetBrains.Annotations;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Mobs.DamageThresholdTemplates
{
[UsedImplicitly]
public class Human : DamageTemplates

View File

@@ -1,8 +1,10 @@
using Content.Shared.GameObjects.Components.Inventory;
using System;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Clothing;
using Content.Shared.GameObjects.Components.Inventory;
using Robust.Shared.GameObjects;
using Math = CannyFastMath.Math;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Mobs
{
[RegisterComponent]
public class HeatResistanceComponent : Component

View File

@@ -1,19 +1,18 @@
#nullable enable
using Content.Server.GameObjects.Components.Observer;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Mobs;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using Content.Shared.GameObjects.EntitySystems;
namespace Content.Server.GameObjects.Components.Mobs
{
@@ -133,12 +132,12 @@ namespace Content.Server.GameObjects.Components.Mobs
if (!HasMind)
{
message.AddMarkup(!dead
? $"[color=red]" + Loc.GetString("{0:They} are totally catatonic. The stresses of life in deep-space must have been too much for {0:them}. Any recovery is unlikely.", Owner) + "[/color]"
? $"[color=red]" + Loc.GetString("{0:They} {0:are} totally catatonic. The stresses of life in deep-space must have been too much for {0:them}. Any recovery is unlikely.", Owner) + "[/color]"
: $"[color=purple]" + Loc.GetString("{0:Their} soul has departed.", Owner) + "[/color]");
}
else if (Mind?.Session == null)
{
message.AddMarkup("[color=yellow]" + Loc.GetString("{0:They} have a blank, absent-minded stare and appears completely unresponsive to anything. {0:They} may snap out of it soon.", Owner) + "[/color]");
message.AddMarkup("[color=yellow]" + Loc.GetString("{0:They} {0:have} a blank, absent-minded stare and appears completely unresponsive to anything. {0:They} may snap out of it soon.", Owner) + "[/color]");
}
}
}

View File

@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Players;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Mobs

View File

@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs.DamageThresholdTemplates;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Observer;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.EntitySystems;
@@ -15,7 +16,7 @@ using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects
namespace Content.Server.GameObjects.Components.Mobs
{
[RegisterComponent]
[ComponentReference(typeof(SharedSpeciesComponent))]
@@ -50,7 +51,7 @@ namespace Content.Server.GameObjects
serializer.DataField(ref templatename, "Template", "Human");
var type = typeof(SpeciesComponent).Assembly.GetType("Content.Server.GameObjects." + templatename);
var type = typeof(SpeciesComponent).Assembly.GetType("Content.Server.GameObjects.Components.Mobs.DamageThresholdTemplates." + templatename);
DamageTemplate = (DamageTemplates) Activator.CreateInstance(type);
serializer.DataFieldCached(ref _heatResistance, "HeatResistance", 323);
}

View File

@@ -1,11 +1,10 @@
using Content.Server.Mobs;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using Timer = Robust.Shared.Timers.Timer;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.Timers;
namespace Content.Server.GameObjects.Components.Mobs
{

View File

@@ -42,9 +42,9 @@ namespace Content.Server.GameObjects.Components.Movement
{
base.Initialize();
// This component requires a physics component.
if (!Owner.HasComponent<IPhysicsComponent>())
Owner.AddComponent<PhysicsComponent>();
// This component requires a collidable component.
if (!Owner.HasComponent<ICollidableComponent>())
Owner.AddComponent<CollidableComponent>();
}
/// <inheritdoc />

View File

@@ -1,5 +1,5 @@
using Robust.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Movement
{

View File

@@ -12,7 +12,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.Timers;
using Robust.Shared.ViewVariables;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Movement
{

View File

@@ -71,22 +71,15 @@ namespace Content.Server.GameObjects.Components.Movement
_entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
{
//TODO: Switch to shuttle component
if (!gridEntity.TryGetComponent(out IPhysicsComponent physComp))
if (!gridEntity.TryGetComponent(out ICollidableComponent collidable))
{
physComp = gridEntity.AddComponent<PhysicsComponent>();
physComp.Mass = 1;
collidable = gridEntity.AddComponent<CollidableComponent>();
collidable.Mass = 1;
collidable.CanCollide = true;
collidable.PhysicsShapes.Add(new PhysShapeGrid(grid));
}
//TODO: Is this always true?
if (!gridEntity.HasComponent<ICollidableComponent>())
{
var collideComp = gridEntity.AddComponent<CollidableComponent>();
collideComp.CanCollide = true;
//collideComp.IsHardCollidable = true;
collideComp.PhysicsShapes.Add(new PhysShapeGrid(grid));
}
var controller = physComp.EnsureController<ShuttleController>();
var controller = collidable.EnsureController<ShuttleController>();
controller.Push(CalcNewVelocity(direction, enabled), CurrentWalkSpeed);
}
}

View File

@@ -1,8 +1,8 @@
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
namespace Content.Server.GameObjects.Components.NodeContainer
{

View File

@@ -1,9 +1,9 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{

View File

@@ -1,7 +1,7 @@
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.Components.Power;
namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{

View File

@@ -1,7 +1,7 @@
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{

View File

@@ -1,8 +1,8 @@
using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
using System;
using System;
using System.Collections.Generic;
using System.Reflection;
using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{

View File

@@ -1,9 +1,9 @@
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{

View File

@@ -1,6 +1,6 @@
using Robust.Shared.GameObjects.Components.Transform;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.GameObjects.Components.Transform;
namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
{

View File

@@ -1,13 +1,13 @@
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
{

View File

@@ -1,7 +1,6 @@
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Fluids;
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Nutrition;

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Utensil;
using Content.Server.Utility;
using Content.Shared.Chemistry;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Shared.GameObjects.Components.Nutrition;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.Components.Nutrition;
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
[ViewVariables(VVAccess.ReadOnly)]
public override HungerThreshold CurrentHungerThreshold => _currentHungerThreshold;
private HungerThreshold _currentHungerThreshold;
private HungerThreshold _lastHungerThreshold;
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Damage;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.Components.Nutrition;
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
[ViewVariables(VVAccess.ReadOnly)]
public override ThirstThreshold CurrentThirstThreshold => _currentThirstThreshold;
private ThirstThreshold _currentThirstThreshold;
private ThirstThreshold _lastThirstThreshold;
[ViewVariables(VVAccess.ReadWrite)]
@@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
"/Textures/Interface/StatusEffects/Thirst/Parched.png",
"/Textures/Interface/StatusEffects/Thirst/Dead.png",
};
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);

View File

@@ -5,11 +5,12 @@ using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces;
using Content.Server.Interfaces.PDA;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.PDA;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;

View File

@@ -1,5 +1,4 @@
using Content.Server.GameObjects.EntitySystems.Click;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects;
@@ -8,7 +7,7 @@ using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Interactable
namespace Content.Server.GameObjects.Components.Paper
{
[RegisterComponent]
public class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing, IUse

View File

@@ -1,7 +1,6 @@
using Content.Shared.GameObjects.Components;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Interactable
namespace Content.Server.GameObjects.Components.Paper
{
[RegisterComponent]
public class WriteComponent : Component

Some files were not shown because too many files have changed in this diff Show More