2022-09-29 15:51:59 +10:00
using System.Linq ;
2023-07-08 14:08:32 +10:00
using System.Numerics ;
2022-09-29 15:51:59 +10:00
using Content.Server.Body.Components ;
using Content.Server.Body.Systems ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
using Content.Server.Chat.Systems ;
2022-09-29 15:51:59 +10:00
using Content.Server.Chemistry.Components ;
using Content.Server.Chemistry.EntitySystems ;
using Content.Server.CombatMode.Disarm ;
using Content.Server.Contests ;
2022-10-17 15:54:31 +11:00
using Content.Server.Movement.Systems ;
2023-03-13 19:34:26 -04:00
using Content.Shared.Administration.Components ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
using Content.Shared.Actions.Events ;
2022-09-29 15:51:59 +10:00
using Content.Shared.CombatMode ;
2023-08-07 12:09:35 +03:00
using Content.Shared.Damage.Events ;
2022-09-29 15:51:59 +10:00
using Content.Shared.Database ;
using Content.Shared.FixedPoint ;
2023-04-07 11:21:12 -07:00
using Content.Shared.Hands.Components ;
2022-09-29 15:51:59 +10:00
using Content.Shared.IdentityManagement ;
2023-04-11 02:19:43 +00:00
using Content.Shared.Inventory ;
using Content.Shared.Popups ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
using Content.Shared.Speech.Components ;
2023-04-07 11:21:12 -07:00
using Content.Shared.StatusEffect ;
2023-04-11 02:19:43 +00:00
using Content.Shared.Tag ;
2022-09-29 15:51:59 +10:00
using Content.Shared.Weapons.Melee ;
using Content.Shared.Weapons.Melee.Events ;
2022-10-17 15:54:31 +11:00
using Robust.Server.Player ;
2022-09-29 15:51:59 +10:00
using Robust.Shared.Audio ;
using Robust.Shared.Map ;
using Robust.Shared.Player ;
2022-10-17 15:54:31 +11:00
using Robust.Shared.Players ;
2022-09-29 15:51:59 +10:00
using Robust.Shared.Random ;
2023-08-01 19:02:54 +03:00
using Content.Shared.Effects ;
2023-08-07 12:09:35 +03:00
using Content.Shared.Damage.Systems ;
2022-09-29 15:51:59 +10:00
namespace Content.Server.Weapons.Melee ;
public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
{
[Dependency] private readonly IRobustRandom _random = default ! ;
[Dependency] private readonly BloodstreamSystem _bloodstream = default ! ;
2023-08-11 03:44:52 +10:00
[Dependency] private readonly ChatSystem _chat = default ! ;
2022-09-29 15:51:59 +10:00
[Dependency] private readonly ContestsSystem _contests = default ! ;
2023-08-11 03:44:52 +10:00
[Dependency] private readonly DamageExamineSystem _damageExamine = default ! ;
2023-04-11 02:19:43 +00:00
[Dependency] private readonly InventorySystem _inventory = default ! ;
2022-10-17 15:54:31 +11:00
[Dependency] private readonly LagCompensationSystem _lag = default ! ;
2023-08-11 03:44:52 +10:00
[Dependency] private readonly SharedColorFlashEffectSystem _color = default ! ;
2022-09-29 15:51:59 +10:00
[Dependency] private readonly SolutionContainerSystem _solutions = default ! ;
2023-04-11 02:19:43 +00:00
[Dependency] private readonly TagSystem _tag = default ! ;
2022-09-29 15:51:59 +10:00
public override void Initialize ( )
{
base . Initialize ( ) ;
SubscribeLocalEvent < MeleeChemicalInjectorComponent , MeleeHitEvent > ( OnChemicalInjectorHit ) ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
SubscribeLocalEvent < MeleeSpeechComponent , MeleeHitEvent > ( OnSpeechHit ) ;
2023-08-07 12:09:35 +03:00
SubscribeLocalEvent < MeleeWeaponComponent , DamageExamineEvent > ( OnMeleeExamineDamage ) ;
2022-09-29 15:51:59 +10:00
}
2023-08-07 12:09:35 +03:00
private void OnMeleeExamineDamage ( EntityUid uid , MeleeWeaponComponent component , ref DamageExamineEvent args )
2022-09-29 15:51:59 +10:00
{
2023-08-07 12:09:35 +03:00
if ( component . HideFromExamine )
2022-09-29 15:51:59 +10:00
return ;
2023-06-07 16:26:45 -04:00
var damageSpec = GetDamage ( uid , args . User , component ) ;
2022-09-29 15:51:59 +10:00
if ( damageSpec . Total = = FixedPoint2 . Zero )
return ;
2023-08-07 12:09:35 +03:00
_damageExamine . AddDamageExamine ( args . Message , damageSpec , Loc . GetString ( "damage-melee" ) ) ;
2022-09-29 15:51:59 +10:00
}
2023-05-02 05:07:17 +10:00
protected override bool ArcRaySuccessful ( EntityUid targetUid , Vector2 position , Angle angle , Angle arcWidth , float range , MapId mapId ,
EntityUid ignore , ICommonSession ? session )
{
// Originally the client didn't predict damage effects so you'd intuit some level of how far
// in the future you'd need to predict, but then there was a lot of complaining like "why would you add artifical delay" as if ping is a choice.
// Now damage effects are predicted but for wide attacks it differs significantly from client and server so your game could be lying to you on hits.
// This isn't fair in the slightest because it makes ping a huge advantage and this would be a hidden system.
// Now the client tells us what they hit and we validate if it's plausible.
// Even if the client is sending entities they shouldn't be able to hit:
// A) Wide-damage is split anyway
// B) We run the same validation we do for click attacks.
// Could also check the arc though future effort + if they're aimbotting it's not really going to make a difference.
// (This runs lagcomp internally and is what clickattacks use)
if ( ! Interaction . InRangeUnobstructed ( ignore , targetUid , range + 0.1f ) )
return false ;
// TODO: Check arc though due to the aforementioned aimbot + damage split comments it's less important.
return true ;
}
2023-02-13 07:55:39 -05:00
protected override bool DoDisarm ( EntityUid user , DisarmAttackEvent ev , EntityUid meleeUid , MeleeWeaponComponent component , ICommonSession ? session )
2022-09-29 15:51:59 +10:00
{
2023-02-13 07:55:39 -05:00
if ( ! base . DoDisarm ( user , ev , meleeUid , component , session ) )
2022-09-29 15:51:59 +10:00
return false ;
2022-10-15 15:14:07 +11:00
if ( ! TryComp < CombatModeComponent > ( user , out var combatMode ) | |
combatMode . CanDisarm ! = true )
{
2022-09-29 15:51:59 +10:00
return false ;
2022-10-15 15:14:07 +11:00
}
2022-09-29 15:51:59 +10:00
var target = ev . Target ! . Value ;
if ( ! TryComp < HandsComponent > ( ev . Target . Value , out var targetHandsComponent ) )
{
2022-11-08 16:10:59 -05:00
if ( ! TryComp < StatusEffectsComponent > ( ev . Target ! . Value , out var status ) | | ! status . AllowedEffects . Contains ( "KnockedDown" ) )
return false ;
2022-09-29 15:51:59 +10:00
}
2022-10-17 15:54:31 +11:00
if ( ! InRange ( user , ev . Target . Value , component . Range , session ) )
2022-09-29 15:51:59 +10:00
{
return false ;
}
EntityUid ? inTargetHand = null ;
2022-11-08 16:10:59 -05:00
if ( targetHandsComponent ? . ActiveHand is { IsEmpty : false } )
2022-09-29 15:51:59 +10:00
{
inTargetHand = targetHandsComponent . ActiveHand . HeldEntity ! . Value ;
}
2022-11-14 08:33:54 +11:00
Interaction . DoContactInteraction ( user , ev . Target ) ;
2022-10-26 14:15:48 +13:00
2022-09-29 15:51:59 +10:00
var attemptEvent = new DisarmAttemptEvent ( target , user , inTargetHand ) ;
if ( inTargetHand ! = null )
{
RaiseLocalEvent ( inTargetHand . Value , attemptEvent ) ;
}
RaiseLocalEvent ( target , attemptEvent ) ;
if ( attemptEvent . Cancelled )
return false ;
var chance = CalculateDisarmChance ( user , target , inTargetHand , combatMode ) ;
if ( _random . Prob ( chance ) )
{
// Don't play a sound as the swing is already predicted.
// Also don't play popups because most disarms will miss.
return false ;
}
2022-12-19 10:41:47 +13:00
var filterOther = Filter . PvsExcept ( user , entityManager : EntityManager ) ;
2022-11-08 16:10:59 -05:00
var msgPrefix = "disarm-action-" ;
if ( inTargetHand = = null )
msgPrefix = "disarm-action-shove-" ;
2022-09-29 15:51:59 +10:00
var msgOther = Loc . GetString (
2022-11-08 16:10:59 -05:00
msgPrefix + "popup-message-other-clients" ,
2022-09-29 15:51:59 +10:00
( "performerName" , Identity . Entity ( user , EntityManager ) ) ,
( "targetName" , Identity . Entity ( target , EntityManager ) ) ) ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
var msgUser = Loc . GetString ( msgPrefix + "popup-message-cursor" , ( "targetName" , Identity . Entity ( target , EntityManager ) ) ) ;
2022-09-29 15:51:59 +10:00
2022-12-19 10:41:47 +13:00
PopupSystem . PopupEntity ( msgOther , user , filterOther , true ) ;
PopupSystem . PopupEntity ( msgUser , target , user ) ;
2022-09-29 15:51:59 +10:00
Audio . PlayPvs ( combatMode . DisarmSuccessSound , user , AudioParams . Default . WithVariation ( 0.025f ) . WithVolume ( 5f ) ) ;
2022-11-14 08:33:54 +11:00
AdminLogger . Add ( LogType . DisarmedAction , $"{ToPrettyString(user):user} used disarm on {ToPrettyString(target):target}" ) ;
2022-09-29 15:51:59 +10:00
var eventArgs = new DisarmedEvent { Target = target , Source = user , PushProbability = 1 - chance } ;
RaiseLocalEvent ( target , eventArgs ) ;
return true ;
}
2022-11-14 08:33:54 +11:00
protected override bool InRange ( EntityUid user , EntityUid target , float range , ICommonSession ? session )
2022-10-17 15:54:31 +11:00
{
EntityCoordinates targetCoordinates ;
Angle targetLocalAngle ;
if ( session is IPlayerSession pSession )
{
( targetCoordinates , targetLocalAngle ) = _lag . GetCoordinatesAngle ( target , pSession ) ;
}
else
{
var xform = Transform ( target ) ;
targetCoordinates = xform . Coordinates ;
targetLocalAngle = xform . LocalRotation ;
}
2022-11-14 08:33:54 +11:00
return Interaction . InRangeUnobstructed ( user , target , targetCoordinates , targetLocalAngle , range ) ;
}
protected override void DoDamageEffect ( List < EntityUid > targets , EntityUid ? user , TransformComponent targetXform )
{
var filter = Filter . Pvs ( targetXform . Coordinates , entityMan : EntityManager ) . RemoveWhereAttachedEntity ( o = > o = = user ) ;
2023-08-11 03:44:52 +10:00
_color . RaiseEffect ( Color . Red , targets , filter ) ;
2022-10-17 15:54:31 +11:00
}
2023-04-08 13:16:48 -07:00
private float CalculateDisarmChance ( EntityUid disarmer , EntityUid disarmed , EntityUid ? inTargetHand , CombatModeComponent disarmerComp )
2022-09-29 15:51:59 +10:00
{
if ( HasComp < DisarmProneComponent > ( disarmer ) )
return 1.0f ;
if ( HasComp < DisarmProneComponent > ( disarmed ) )
return 0.0f ;
var contestResults = 1 - _contests . OverallStrengthContest ( disarmer , disarmed ) ;
float chance = ( disarmerComp . BaseDisarmFailChance + contestResults ) ;
if ( inTargetHand ! = null & & TryComp < DisarmMalusComponent > ( inTargetHand , out var malus ) )
{
chance + = malus . Malus ;
}
return Math . Clamp ( chance , 0f , 1f ) ;
}
2023-04-10 15:37:03 +10:00
public override void DoLunge ( EntityUid user , Angle angle , Vector2 localPos , string? animation , bool predicted = true )
2022-09-29 15:51:59 +10:00
{
2023-04-10 15:37:03 +10:00
Filter filter ;
if ( predicted )
{
filter = Filter . PvsExcept ( user , entityManager : EntityManager ) ;
}
else
{
filter = Filter . Pvs ( user , entityManager : EntityManager ) ;
}
RaiseNetworkEvent ( new MeleeLungeEvent ( user , angle , localPos , animation ) , filter ) ;
2022-09-29 15:51:59 +10:00
}
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
private void OnSpeechHit ( EntityUid owner , MeleeSpeechComponent comp , MeleeHitEvent args )
{
if ( ! args . IsHit | |
! args . HitEntities . Any ( ) )
{
return ;
}
if ( comp . Battlecry ! = null ) //If the battlecry is set to empty, doesn't speak
{
2023-05-30 18:11:35 -07:00
_chat . TrySendInGameICMessage ( args . User , comp . Battlecry , InGameICChatType . Speak , true , true , checkRadioPrefix : false ) ; //Speech that isn't sent to chat or adminlogs
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
}
}
2022-09-29 15:51:59 +10:00
private void OnChemicalInjectorHit ( EntityUid owner , MeleeChemicalInjectorComponent comp , MeleeHitEvent args )
{
2023-02-13 07:55:39 -05:00
if ( ! args . IsHit | |
! args . HitEntities . Any ( ) | |
! _solutions . TryGetSolution ( owner , comp . Solution , out var solutionContainer ) )
{
2022-09-29 15:51:59 +10:00
return ;
2023-02-13 07:55:39 -05:00
}
2022-09-29 15:51:59 +10:00
2023-03-12 15:56:05 +11:00
var hitBloodstreams = new List < ( EntityUid Entity , BloodstreamComponent Component ) > ( ) ;
2022-09-29 15:51:59 +10:00
var bloodQuery = GetEntityQuery < BloodstreamComponent > ( ) ;
foreach ( var entity in args . HitEntities )
{
if ( Deleted ( entity ) )
continue ;
2023-04-11 02:19:43 +00:00
// prevent deathnettles injecting through hardsuits
if ( ! comp . PierceArmor & & _inventory . TryGetSlotEntity ( entity , "outerClothing" , out var suit ) & & _tag . HasTag ( suit . Value , "Hardsuit" ) )
{
PopupSystem . PopupEntity ( Loc . GetString ( "melee-inject-failed-hardsuit" , ( "weapon" , owner ) ) , args . User , args . User , PopupType . SmallCaution ) ;
continue ;
}
2022-09-29 15:51:59 +10:00
if ( bloodQuery . TryGetComponent ( entity , out var bloodstream ) )
2023-03-12 15:56:05 +11:00
hitBloodstreams . Add ( ( entity , bloodstream ) ) ;
2022-09-29 15:51:59 +10:00
}
if ( ! hitBloodstreams . Any ( ) )
return ;
var removedSolution = solutionContainer . SplitSolution ( comp . TransferAmount * hitBloodstreams . Count ) ;
2023-01-12 16:41:40 +13:00
var removedVol = removedSolution . Volume ;
2022-09-29 15:51:59 +10:00
var solutionToInject = removedSolution . SplitSolution ( removedVol * comp . TransferEfficiency ) ;
2023-01-12 16:41:40 +13:00
var volPerBloodstream = solutionToInject . Volume * ( 1 / hitBloodstreams . Count ) ;
2022-09-29 15:51:59 +10:00
2023-03-12 15:56:05 +11:00
foreach ( var ( ent , bloodstream ) in hitBloodstreams )
2022-09-29 15:51:59 +10:00
{
var individualInjection = solutionToInject . SplitSolution ( volPerBloodstream ) ;
2023-03-12 15:56:05 +11:00
_bloodstream . TryAddToChemicals ( ent , individualInjection , bloodstream ) ;
2022-09-29 15:51:59 +10:00
}
}
}