EntityEffectConditions changed to be inclusive of min/max (#36289)
* soo hungry going back for more lipolicide * too much lipolicide..... * fixes * it moved * typo --------- Co-authored-by: iaada <iaada@users.noreply.github.com>
This commit is contained in:
@@ -133,7 +133,7 @@ public sealed class EntityEffectSystem : EntitySystem
|
|||||||
args.Result = false;
|
args.Result = false;
|
||||||
if (TryComp(args.Args.TargetEntity, out TemperatureComponent? temp))
|
if (TryComp(args.Args.TargetEntity, out TemperatureComponent? temp))
|
||||||
{
|
{
|
||||||
if (temp.CurrentTemperature > args.Condition.Min && temp.CurrentTemperature < args.Condition.Max)
|
if (temp.CurrentTemperature >= args.Condition.Min && temp.CurrentTemperature <= args.Condition.Max)
|
||||||
args.Result = true;
|
args.Result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,14 @@ public sealed partial class SolutionTemperature : EntityEffectCondition
|
|||||||
|
|
||||||
[DataField]
|
[DataField]
|
||||||
public float Max = float.PositiveInfinity;
|
public float Max = float.PositiveInfinity;
|
||||||
|
|
||||||
public override bool Condition(EntityEffectBaseArgs args)
|
public override bool Condition(EntityEffectBaseArgs args)
|
||||||
{
|
{
|
||||||
if (args is EntityEffectReagentArgs reagentArgs)
|
if (args is EntityEffectReagentArgs reagentArgs)
|
||||||
{
|
{
|
||||||
if (reagentArgs.Source == null)
|
return reagentArgs?.Source != null &&
|
||||||
return false;
|
reagentArgs.Source.Temperature >= Min &&
|
||||||
if (reagentArgs.Source.Temperature < Min)
|
reagentArgs.Source.Temperature <= Max;
|
||||||
return false;
|
|
||||||
if (reagentArgs.Source.Temperature > Max)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Someone needs to figure out how to do this for non-reagent effects.
|
// TODO: Someone needs to figure out how to do this for non-reagent effects.
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ public sealed partial class TotalDamage : EntityEffectCondition
|
|||||||
if (args.EntityManager.TryGetComponent(args.TargetEntity, out DamageableComponent? damage))
|
if (args.EntityManager.TryGetComponent(args.TargetEntity, out DamageableComponent? damage))
|
||||||
{
|
{
|
||||||
var total = damage.TotalDamage;
|
var total = damage.TotalDamage;
|
||||||
if (total > Min && total < Max)
|
return total >= Min && total <= Max;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ public sealed partial class Hunger : EntityEffectCondition
|
|||||||
if (args.EntityManager.TryGetComponent(args.TargetEntity, out HungerComponent? hunger))
|
if (args.EntityManager.TryGetComponent(args.TargetEntity, out HungerComponent? hunger))
|
||||||
{
|
{
|
||||||
var total = args.EntityManager.System<HungerSystem>().GetHunger(hunger);
|
var total = args.EntityManager.System<HungerSystem>().GetHunger(hunger);
|
||||||
if (total > Min && total < Max)
|
return total >= Min && total <= Max;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user