Added decelerator percentage drain (#35643)
* Added variable PercentageDrain to SinguloFoodComponent * Set percentageDrain to 0.03 (3%) for anti particles * Added percentageDrain logic in public OnConsumed * Simplify SinguloFoodComponent and set percentageDrain to negative * EnergyFactor now applies to positive values too * Better commenting on EnergyFactor * Update Content.Server/Singularity/Components/SinguloFoodComponent.cs * Documentation of EnergyFactor * Fixing spelling mistake --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -256,7 +256,12 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
public void OnConsumed(EntityUid uid, SinguloFoodComponent comp, ref EventHorizonConsumedEntityEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<SingularityComponent>(args.EventHorizonUid, out var singulo))
|
||||
AdjustEnergy(args.EventHorizonUid, comp.Energy, singularity: singulo);
|
||||
{
|
||||
// Calculate the percentage change (positive or negative)
|
||||
var percentageChange = singulo.Energy * (comp.EnergyFactor - 1f);
|
||||
// Apply both the flat and percentage changes
|
||||
AdjustEnergy(args.EventHorizonUid, comp.Energy + percentageChange, singularity: singulo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user