Revert "Refactor Damage to use Protoypes (#4262)"

This reverts commit 20bf5739a9.
This commit is contained in:
Silver
2021-08-24 00:50:39 -06:00
committed by Silver
parent 20bf5739a9
commit e708091518
121 changed files with 711 additions and 10237 deletions

View File

@@ -1,17 +1,15 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Content.Server.Stack;
using Content.Shared.ActionBlocker;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Stacks;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
namespace Content.Server.Medical.Components
{
@@ -20,27 +18,7 @@ namespace Content.Server.Medical.Components
{
public override string Name => "Healing";
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master
[DataField("heal")] public Dictionary<DamageType, int> Heal { get; private set; } = new();
=======
[DataField("heal", required: true )]
public Dictionary<string, int> Heal { get; private set; } = new();
>>>>>>> update damagecomponent across shared and server
=======
=======
>>>>>>> refactor-damageablecomponent
// TODO PROTOTYPE Replace this datafield variable with prototype references, once they are supported.
// This also requires changing the dictionary type, and removing a _prototypeManager.Index() call.
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[DataField("heal", required: true )]
[ViewVariables(VVAccess.ReadWrite)]
public Dictionary<string, int> Heal = new();
<<<<<<< HEAD
>>>>>>> Refactor damageablecomponent update (#4406)
=======
>>>>>>> refactor-damageablecomponent
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
@@ -70,9 +48,9 @@ namespace Content.Server.Medical.Components
return true;
}
foreach (var (damageTypeID, amount) in Heal)
foreach (var (type, amount) in Heal)
{
damageable.TryChangeDamage(_prototypeManager.Index<DamageTypePrototype>(damageTypeID), -amount, true);
damageable.ChangeDamage(type, -amount, true);
}
return true;

View File

@@ -99,18 +99,8 @@ namespace Content.Server.Medical.Components
private static readonly MedicalScannerBoundUserInterfaceState EmptyUIState =
new(
null,
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
new Dictionary<DamageClass, int>(),
new Dictionary<DamageType, int>(),
=======
new Dictionary<string, int>(),
new Dictionary<string, int>(),
>>>>>>> Refactor damageablecomponent update (#4406)
=======
new Dictionary<string, int>(),
new Dictionary<string, int>(),
>>>>>>> refactor-damageablecomponent
false);
private MedicalScannerBoundUserInterfaceState GetUserInterfaceState()
@@ -131,24 +121,12 @@ namespace Content.Server.Medical.Components
return EmptyUIState;
}
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
var classes = new Dictionary<DamageClass, int>(damageable.DamageClasses);
var types = new Dictionary<DamageType, int>(damageable.DamageTypes);
=======
// Get dictionaries of damage, by fully supported damage groups and types
var groups = new Dictionary<string, int>(damageable.GetDamagePerFullySupportedGroupIDs);
var types = new Dictionary<string, int>(damageable.GetDamagePerTypeIDs);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
// Get dictionaries of damage, by fully supported damage groups and types
var groups = new Dictionary<string, int>(damageable.GetDamagePerFullySupportedGroupIDs);
var types = new Dictionary<string, int>(damageable.GetDamagePerTypeIDs);
>>>>>>> refactor-damageablecomponent
if (_bodyContainer.ContainedEntity?.Uid == null)
{
return new MedicalScannerBoundUserInterfaceState(body.Uid, groups, types, true);
return new MedicalScannerBoundUserInterfaceState(body.Uid, classes, types, true);
}
var cloningSystem = EntitySystem.Get<CloningSystem>();
@@ -156,7 +134,7 @@ namespace Content.Server.Medical.Components
mindComponent.Mind != null &&
cloningSystem.HasDnaScan(mindComponent.Mind);
return new MedicalScannerBoundUserInterfaceState(body.Uid, groups, types, scanned);
return new MedicalScannerBoundUserInterfaceState(body.Uid, classes, types, scanned);
}
private void UpdateUserInterface()