Merge branch 'master' into 2020-08-31-click-attack

This commit is contained in:
Víctor Aguilera Puerto
2020-09-01 03:25:14 +02:00
25 changed files with 325 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
using Content.Shared.GameObjects.Components.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Shared.GameObjects.Components.Renderable;
@@ -10,7 +10,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos

View File

@@ -0,0 +1,85 @@
using Content.Shared.GameObjects.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos
{
[UsedImplicitly]
public class PumpVisualizer : AppearanceVisualizer
{
private RSI _pumpRSI;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
var rsiString = node.GetNode("pumpRSI").ToString();
var rsiPath = SharedSpriteComponent.TextureRoot / rsiString;
try
{
var resourceCache = IoCManager.Resolve<IResourceCache>();
var resource = resourceCache.GetResource<RSIResource>(rsiPath);
_pumpRSI = resource.RSI;
}
catch (Exception e)
{
Logger.ErrorS("go.pumpvisualizer", "Unable to load RSI '{0}'. Trace:\n{1}", rsiPath, e);
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
{
return;
}
if (!component.TryGetData(PumpVisuals.VisualState, out PumpVisualState pumpVisualState))
{
return;
}
var pumpBaseState = "pump";
pumpBaseState += pumpVisualState.InletDirection.ToString();
pumpBaseState += ((int) pumpVisualState.InletConduitLayer).ToString();
pumpBaseState += pumpVisualState.OutletDirection.ToString();
pumpBaseState += ((int) pumpVisualState.OutletConduitLayer).ToString();
sprite.LayerMapReserveBlank(Layer.PumpBase);
var basePumpLayer = sprite.LayerMapGet(Layer.PumpBase);
sprite.LayerSetRSI(basePumpLayer, _pumpRSI);
sprite.LayerSetState(basePumpLayer, pumpBaseState);
sprite.LayerSetVisible(basePumpLayer, true);
var pumpEnabledAnimationState = "pumpEnabled";
pumpEnabledAnimationState += pumpVisualState.InletDirection.ToString();
pumpEnabledAnimationState += ((int) pumpVisualState.InletConduitLayer).ToString();
pumpEnabledAnimationState += pumpVisualState.OutletDirection.ToString();
pumpEnabledAnimationState += ((int) pumpVisualState.OutletConduitLayer).ToString();
sprite.LayerMapReserveBlank(Layer.PumpEnabled);
var pumpEnabledAnimationLayer = sprite.LayerMapGet(Layer.PumpEnabled);
sprite.LayerSetRSI(pumpEnabledAnimationLayer, _pumpRSI);
sprite.LayerSetState(pumpEnabledAnimationLayer, pumpEnabledAnimationState);
sprite.LayerSetVisible(pumpEnabledAnimationLayer, pumpVisualState.PumpEnabled);
}
private enum Layer
{
PumpBase,
PumpEnabled,
}
}
}

View File

@@ -139,12 +139,15 @@ namespace Content.Server.Chat
damageableComponent.ChangeDamage(kind switch
{
SuicideKind.Blunt => DamageType.Blunt,
SuicideKind.Slash => DamageType.Slash,
SuicideKind.Piercing => DamageType.Piercing,
SuicideKind.Heat => DamageType.Heat,
SuicideKind.Disintegration => DamageType.Disintegration,
SuicideKind.Cellular => DamageType.Cellular,
SuicideKind.DNA => DamageType.DNA,
SuicideKind.Shock => DamageType.Shock,
SuicideKind.Cold => DamageType.Cold,
SuicideKind.Poison => DamageType.Poison,
SuicideKind.Radiation => DamageType.Radiation,
SuicideKind.Asphyxiation => DamageType.Asphyxiation,
SuicideKind.Bloodloss => DamageType.Bloodloss,
_ => DamageType.Blunt
},
500,

View File

@@ -2,6 +2,8 @@
using Content.Server.GameObjects.Components.NodeContainer;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Shared.GameObjects.Components.Atmos;
using Content.Shared.GameObjects.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -14,6 +16,21 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
/// </summary>
public abstract class BasePumpComponent : PipeNetDeviceComponent
{
/// <summary>
/// If the pump is currently pumping.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool PumpEnabled
{
get => _pumpEnabled;
set
{
_pumpEnabled = value;
UpdateAppearance();
}
}
private bool _pumpEnabled = true;
/// <summary>
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="Pipe"/> on this entity.
/// </summary>
@@ -32,6 +49,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
[ViewVariables]
private PipeNode _outletPipe;
private AppearanceComponent _appearance;
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
@@ -57,13 +76,23 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
Logger.Error($"{typeof(BasePumpComponent)} on entity {Owner.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
return;
}
Owner.TryGetComponent(out _appearance);
UpdateAppearance();
}
public override void Update()
{
if (!PumpEnabled)
return;
PumpGas(_inletPipe.Air, _outletPipe.Air);
}
protected abstract void PumpGas(GasMixture inletGas, GasMixture outletGas);
private void UpdateAppearance()
{
_appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer, PumpEnabled));
}
}
}

View File

@@ -246,9 +246,12 @@ namespace Content.Server.GameObjects.Components.Instruments
public void HandSelected(HandSelectedEventArgs eventArgs)
{
var session = eventArgs.User?.GetComponent<BasicActorComponent>()?.playerSession;
if (eventArgs.User == null || !eventArgs.User.TryGetComponent(out BasicActorComponent? actor))
return;
if (session == null) return;
var session = actor.playerSession;
if (session.Status != SessionStatus.InGame) return;
InstrumentPlayer = session;
}

View File

@@ -7,7 +7,7 @@ namespace Content.Server.GameObjects.EntitySystems
[UsedImplicitly]
public class BarotraumaSystem : EntitySystem
{
private const float TimePerUpdate = 0.5f;
private const float TimePerUpdate = 3f;
private float _timer = 0f;

View File

@@ -9,9 +9,14 @@ using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.PDA;
using Content.Server.GameObjects.Components.Suspicion;
using Content.Server.Mobs.Roles;
using Content.Server.Mobs.Roles.Suspicion;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.PDA;
using Content.Shared.Roles;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Configuration;
@@ -32,6 +37,9 @@ namespace Content.Server.GameTicking.GamePresets
public int MinTraitors { get; set; }
public int PlayersPerTraitor { get; set; }
public int TraitorStartingBalance { get; set; }
public override bool DisallowLateJoin => true;
private static string TraitorID = "SuspicionTraitor";
@@ -42,6 +50,7 @@ namespace Content.Server.GameTicking.GamePresets
cfg.RegisterCVar("game.suspicion_min_players", 5);
cfg.RegisterCVar("game.suspicion_min_traitors", 2);
cfg.RegisterCVar("game.suspicion_players_per_traitor", 5);
cfg.RegisterCVar("game.suspicion_starting_balance", 20);
}
public override bool Start(IReadOnlyList<IPlayerSession> readyPlayers, bool force = false)
@@ -49,6 +58,7 @@ namespace Content.Server.GameTicking.GamePresets
MinPlayers = _cfg.GetCVar<int>("game.suspicion_min_players");
MinTraitors = _cfg.GetCVar<int>("game.suspicion_min_traitors");
PlayersPerTraitor = _cfg.GetCVar<int>("game.suspicion_players_per_traitor");
TraitorStartingBalance = _cfg.GetCVar<int>("game.suspicion_starting_balance");
if (!force && readyPlayers.Count < MinPlayers)
{
@@ -109,6 +119,28 @@ namespace Content.Server.GameTicking.GamePresets
var traitorRole = new SuspicionTraitorRole(mind, antagPrototype);
mind.AddRole(traitorRole);
traitors.Add(traitorRole);
// creadth: we need to create uplink for the antag.
// PDA should be in place already, so we just need to
// initiate uplink account.
var uplinkAccount =
new UplinkAccount(mind.OwnedEntity.Uid,
TraitorStartingBalance);
var inventory = mind.OwnedEntity.GetComponent<InventoryComponent>();
if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent pdaItem))
{
continue;
}
var pda = pdaItem.Owner;
var pdaComponent = pda.GetComponent<PDAComponent>();
if (pdaComponent.IdSlotEmpty)
{
continue;
}
pdaComponent.InitUplinkAccount(uplinkAccount);
}
foreach (var player in list)
@@ -127,6 +159,7 @@ namespace Content.Server.GameTicking.GamePresets
return true;
}
public override string ModeTitle => "Suspicion";
public override string Description => "Suspicion on the Space Station. There are traitors on board... Can you kill them before they kill you?";
}

View File

@@ -861,17 +861,6 @@ namespace Content.Server.GameTicking
var accessTags = access.Tags;
accessTags.UnionWith(jobPrototype.Access);
pdaComponent.SetPDAOwner(characterName);
var mindComponent = mob.GetComponent<MindComponent>();
if (mindComponent.HasMind) //Redundancy checks.
{
if (mindComponent.Mind.AllRoles.Any(role => role.Antagonist)) //Give antags a new uplinkaccount.
{
var uplinkAccount =
new UplinkAccount(mob.Uid,
20); //TODO: make me into a variable based on server pop or something.
pdaComponent.InitUplinkAccount(uplinkAccount);
}
}
}
private void AddManifestEntry(string characterName, string jobId)

View File

@@ -14,12 +14,15 @@ namespace Content.Server.Interfaces.GameObjects
//Damage type suicides
Blunt,
Slash,
Piercing,
Heat,
Disintegration,
Cellular,
DNA,
Asphyxiation
Shock,
Cold,
Poison,
Radiation,
Asphyxiation,
Bloodloss
}
}

View File

@@ -12,7 +12,8 @@ namespace Content.Shared.Damage
Brute,
Burn,
Toxin,
Airloss
Airloss,
Genetic
}
public static class DamageClassExtensions
@@ -20,10 +21,11 @@ namespace Content.Shared.Damage
private static readonly ImmutableDictionary<DamageClass, List<DamageType>> ClassToType =
new Dictionary<DamageClass, List<DamageType>>
{
{DamageClass.Brute, new List<DamageType> {DamageType.Blunt, DamageType.Piercing}},
{DamageClass.Burn, new List<DamageType> {DamageType.Heat, DamageType.Disintegration}},
{DamageClass.Toxin, new List<DamageType> {DamageType.Cellular, DamageType.DNA}},
{DamageClass.Airloss, new List<DamageType> {DamageType.Asphyxiation}}
{DamageClass.Brute, new List<DamageType> {DamageType.Blunt, DamageType.Slash, DamageType.Piercing}},
{DamageClass.Burn, new List<DamageType> {DamageType.Heat, DamageType.Shock, DamageType.Cold}},
{DamageClass.Toxin, new List<DamageType> {DamageType.Poison, DamageType.Radiation}},
{DamageClass.Airloss, new List<DamageType> {DamageType.Asphyxiation, DamageType.Bloodloss}},
{DamageClass.Genetic, new List<DamageType> {DamageType.Cellular}}
}.ToImmutableDictionary();
public static List<DamageType> ToTypes(this DamageClass @class)

View File

@@ -10,12 +10,16 @@ namespace Content.Shared.Damage
public enum DamageType
{
Blunt,
Slash,
Piercing,
Heat,
Disintegration,
Cellular,
DNA,
Asphyxiation
Shock,
Cold,
Poison,
Radiation,
Asphyxiation,
Bloodloss,
Cellular
}
public static class DamageTypeExtensions
@@ -25,12 +29,17 @@ namespace Content.Shared.Damage
new Dictionary<DamageType, DamageClass>
{
{DamageType.Blunt, DamageClass.Brute},
{DamageType.Slash, DamageClass.Brute},
{DamageType.Piercing, DamageClass.Brute},
{DamageType.Heat, DamageClass.Burn},
{DamageType.Disintegration, DamageClass.Burn},
{DamageType.Cellular, DamageClass.Toxin},
{DamageType.DNA, DamageClass.Toxin},
{DamageType.Asphyxiation, DamageClass.Airloss}
{DamageType.Shock, DamageClass.Burn},
{DamageType.Cold, DamageClass.Burn},
{DamageType.Poison, DamageClass.Toxin},
{DamageType.Radiation, DamageClass.Toxin},
{DamageType.Asphyxiation, DamageClass.Airloss},
{DamageType.Bloodloss, DamageClass.Airloss},
{DamageType.Cellular, DamageClass.Genetic }
}.ToImmutableDictionary();
public static DamageClass ToClass(this DamageType type)

View File

@@ -0,0 +1,31 @@
using Content.Shared.GameObjects.Components.Atmos;
using Robust.Shared.Serialization;
using System;
namespace Content.Shared.GameObjects.Atmos
{
[Serializable, NetSerializable]
public enum PumpVisuals
{
VisualState
}
[Serializable, NetSerializable]
public class PumpVisualState
{
public readonly PipeDirection InletDirection;
public readonly PipeDirection OutletDirection;
public readonly ConduitLayer InletConduitLayer;
public readonly ConduitLayer OutletConduitLayer;
public readonly bool PumpEnabled;
public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer, bool pumpEnabled)
{
InletDirection = inletDirection;
OutletDirection = outletDirection;
InletConduitLayer = inletConduitLayer;
OutletConduitLayer = outletConduitLayer;
PumpEnabled = pumpEnabled;
}
}
}

View File

@@ -5,6 +5,7 @@
- Burn
- Toxin
- Airloss
- Genetic
- type: damageContainer
id: metallicDamageContainer

View File

@@ -2,55 +2,79 @@
id: defaultResistances
coefficients:
Blunt: 1.0
Slash: 1.0
Piercing: 1.0
Heat: 1.0
Disintegration: 1.0
Cellular: 1.0
DNA: 1.0
Shock: 1.0
Cold: 1.0
Poison: 1.0
Radiation: 1.0
Asphyxiation: 1.0
Bloodloss: 1.0
Cellular: 1.0
flatReductions:
Blunt: 0
Slash: 0
Piercing: 0
Heat: 0
Disintegration: 0
Shock: 0
Cold: 0
Poison: 0
Radiation: 0
Asphyxiation: 0
Bloodloss: 0
Cellular: 0
DNA: 0
Asphyxiation: 0
- type: resistanceSet
id: dionaResistances
coefficients:
Blunt: 0.5
Slash: 1.2
Piercing: 0.7
Heat: 1.8
Disintegration: 1.8
Cellular: 1.0
DNA: 1.0
Shock: 0.5
Cold: 1.5
Poison: 0.8
Radiation: 0
Asphyxiation: 1.0
Bloodloss: 1.0
Cellular: 1.0
flatReductions:
Blunt: 0
Slash: 0
Piercing: 0
Heat: 0
Disintegration: 0
Cellular: 0
DNA: 0
Shock: 0
Cold: 0
Poison: 0
Radiation: 0
Asphyxiation: 0
Bloodloss: 0
Cellular: 0
- type: resistanceSet
id: metallicResistances
coefficients:
Blunt: 0.7
Slash: 0.5
Piercing: 0.7
Heat: 1.0
Disintegration: 1.0
Cellular: 0.0
DNA: 0.0
Asphyxiation: 0.0
Shock: 1.2
Cold: 0
Poison: 0
Radiation: 0
Asphyxiation: 0
Bloodloss: 0
Cellular: 0
flatReductions:
Blunt: 0
Slash: 0
Piercing: 0
Heat: 0
Disintegration: 0
Cellular: 0
DNA: 0
Asphyxiation: 0
Shock: 0
Cold: 0
Poison: 0
Radiation: 0
Asphyxiation: 0
Bloodloss: 0
Cellular: 0

View File

@@ -12,7 +12,12 @@
- type: Icon
texture: Constructible/Power/eightdirwire.png
- type: Sprite
sprite: Constructible/Power/mv_cable.rsi
- type: Appearance
visuals:
- type: PipeVisualizer
pipeRSI: Constructible/Atmos/pipe.rsi
- type: PumpVisualizer
pumpRSI: Constructible/Atmos/pressurepump.rsi
- type: Destructible
thresholdvalue: 100
@@ -21,8 +26,6 @@
parent: PumpBase
id: NorthwardLongitudinalPump
components:
- type: Sprite
state: mvcable_3
- type: NodeContainer
nodes:
- !type:PipeNode

View File

@@ -0,0 +1,51 @@
{
"version":1,
"size":{
"x":32,
"y":32
},
"license":"CC-BY-SA-3.0",
"copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
"states":[
{
"name":"pumpEast2West2",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"pumpNorth2South2",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"pumpSouth2North2",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"pumpWest2East2",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"pumpEnabledEast2West2",
"directions":1,
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
},
{
"name":"pumpEnabledNorth2South2",
"directions":1,
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
},
{
"name":"pumpEnabledSouth2North2",
"directions":1,
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
},
{
"name":"pumpEnabledWest2East2",
"directions":1,
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B