Merge branch 'master' into 2021-12-03-remove-IEntity-komm-süsser-todd
# Conflicts: # Content.Client/Crayon/CrayonDecalVisualizer.cs # Content.Client/Tabletop/TabletopSystem.cs # Content.IntegrationTests/Tests/InventoryHelpersTest.cs # Content.Server/AI/EntitySystems/AiSystem.cs # Content.Server/AI/Utility/AiLogic/UtilityAI.cs # Content.Server/AME/AMENodeGroup.cs # Content.Server/Administration/AdminVerbSystem.cs # Content.Server/Body/Systems/RespiratorSystem.cs # Content.Server/Chemistry/Components/InjectorComponent.cs # Content.Server/Chemistry/TileReactions/CleanTileReaction.cs # Content.Server/Chemistry/TileReactions/SpillTileReaction.cs # Content.Server/Crayon/CrayonComponent.cs # Content.Server/Doors/Components/ServerDoorComponent.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Fluids/Components/MopComponent.cs # Content.Server/Fluids/Components/SpillExtensions.cs # Content.Server/Fluids/EntitySystems/PuddleSystem.cs # Content.Server/Instruments/InstrumentSystem.cs # Content.Server/Nutrition/EntitySystems/DrinkSystem.cs # Content.Server/Nutrition/EntitySystems/FoodSystem.cs # Content.Server/PneumaticCannon/PneumaticCannonSystem.cs # Content.Server/Storage/Components/EntityStorageComponent.cs # Content.Server/Storage/Components/StorageFillComponent.cs # Content.Server/Stunnable/StunbatonSystem.cs # Content.Server/Throwing/ThrowHelper.cs # Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs # Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs # Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs # Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs # Content.Shared/Damage/Components/DamageableComponent.cs # Content.Shared/Damage/Systems/DamageableSystem.cs # Content.Shared/MobState/Components/MobStateComponent.cs # Content.Shared/Slippery/SharedSlipperySystem.cs
This commit is contained in:
@@ -32,41 +32,40 @@ namespace Content.Server.Body.Systems
|
||||
foreach (var (respirator, blood, body) in
|
||||
EntityManager.EntityQuery<RespiratorComponent, BloodstreamComponent, SharedBodyComponent>())
|
||||
{
|
||||
var uid = (respirator).Owner;
|
||||
var uid = respirator.Owner;
|
||||
if (!EntityManager.TryGetComponent<MobStateComponent>(uid, out var state) ||
|
||||
state.IsDead())
|
||||
{
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
respirator.AccumulatedFrametime += frameTime;
|
||||
|
||||
if (respirator.AccumulatedFrametime < 1)
|
||||
{
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
ProcessGases(uid, respirator, frameTime, blood, body);
|
||||
ProcessGases(uid, respirator, blood, body);
|
||||
|
||||
respirator.AccumulatedFrametime -= 1;
|
||||
|
||||
if (SuffocatingPercentage(respirator) > 0)
|
||||
{
|
||||
TakeSuffocationDamage(uid, respirator);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
StopSuffocation(uid, respirator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Dictionary<Gas, float> NeedsAndDeficit(RespiratorComponent respirator, float frameTime)
|
||||
private Dictionary<Gas, float> NeedsAndDeficit(RespiratorComponent respirator)
|
||||
{
|
||||
var needs = new Dictionary<Gas, float>(respirator.NeedsGases);
|
||||
foreach (var (gas, amount) in respirator.DeficitGases)
|
||||
{
|
||||
var newAmount = (needs.GetValueOrDefault(gas) + amount) * frameTime;
|
||||
var newAmount = (needs.GetValueOrDefault(gas) + amount);
|
||||
needs[gas] = newAmount;
|
||||
}
|
||||
|
||||
@@ -130,7 +129,7 @@ namespace Content.Server.Body.Systems
|
||||
return respirator.ProducesGases.ToDictionary(pair => pair.Key, pair => GasProducedMultiplier(respirator, pair.Key, usedAverage));
|
||||
}
|
||||
|
||||
private void ProcessGases(EntityUid uid, RespiratorComponent respirator, float frameTime,
|
||||
private void ProcessGases(EntityUid uid, RespiratorComponent respirator,
|
||||
BloodstreamComponent? bloodstream,
|
||||
SharedBodyComponent? body)
|
||||
{
|
||||
@@ -139,12 +138,12 @@ namespace Content.Server.Body.Systems
|
||||
|
||||
var lungs = _bodySystem.GetComponentsOnMechanisms<LungComponent>(uid, body).ToArray();
|
||||
|
||||
var needs = NeedsAndDeficit(respirator, frameTime);
|
||||
var needs = NeedsAndDeficit(respirator);
|
||||
var used = 0f;
|
||||
|
||||
foreach (var (lung, mech) in lungs)
|
||||
{
|
||||
_lungSystem.UpdateLung((lung).Owner, frameTime, lung, mech);
|
||||
_lungSystem.UpdateLung(lung.Owner, lung, mech);
|
||||
}
|
||||
|
||||
foreach (var (gas, amountNeeded) in needs)
|
||||
|
||||
Reference in New Issue
Block a user