(965c31410a) Unstable v0.10.4.0
This commit is contained in:
@@ -38,7 +38,8 @@ namespace Barotrauma
|
||||
LessThan,
|
||||
LessThanEquals,
|
||||
GreaterThan,
|
||||
GreaterThanEquals
|
||||
GreaterThanEquals,
|
||||
None
|
||||
}
|
||||
|
||||
public readonly ConditionType Type;
|
||||
@@ -90,48 +91,19 @@ namespace Barotrauma
|
||||
valueString = splitString[i] + (i > 1 && i < splitString.Length ? " " : "");
|
||||
}
|
||||
}
|
||||
//thanks xml for not letting me use < or > in attributes :(
|
||||
string op = splitString[0];
|
||||
switch (op)
|
||||
OperatorType operatorType = GetOperatorType(op);
|
||||
|
||||
if (operatorType != OperatorType.None)
|
||||
{
|
||||
case "e":
|
||||
case "eq":
|
||||
case "equals":
|
||||
Operator = OperatorType.Equals;
|
||||
break;
|
||||
case "ne":
|
||||
case "neq":
|
||||
case "notequals":
|
||||
case "!":
|
||||
case "!e":
|
||||
case "!eq":
|
||||
case "!equals":
|
||||
Operator = OperatorType.NotEquals;
|
||||
break;
|
||||
case "gt":
|
||||
case "greaterthan":
|
||||
Operator = OperatorType.GreaterThan;
|
||||
break;
|
||||
case "lt":
|
||||
case "lessthan":
|
||||
Operator = OperatorType.LessThan;
|
||||
break;
|
||||
case "gte":
|
||||
case "gteq":
|
||||
case "greaterthanequals":
|
||||
Operator = OperatorType.GreaterThanEquals;
|
||||
break;
|
||||
case "lte":
|
||||
case "lteq":
|
||||
case "lessthanequals":
|
||||
Operator = OperatorType.LessThanEquals;
|
||||
break;
|
||||
default:
|
||||
if (op != "==" && op != "!=" && op != ">" && op != "<" && op != ">=" && op != "<=") //Didn't use escape strings or anything
|
||||
{
|
||||
valueString = attributeValueString; //We probably don't even have an operator
|
||||
}
|
||||
break;
|
||||
Operator = operatorType;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (op != "==" && op != "!=" && op != ">" && op != "<" && op != ">=" && op != "<=") //Didn't use escape strings or anything
|
||||
{
|
||||
valueString = attributeValueString; //We probably don't even have an operator
|
||||
}
|
||||
}
|
||||
|
||||
TargetItemComponentName = attribute.Parent.GetAttributeString("targetitemcomponent", "");
|
||||
@@ -171,6 +143,42 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static OperatorType GetOperatorType(string op)
|
||||
{
|
||||
//thanks xml for not letting me use < or > in attributes :(
|
||||
switch (op)
|
||||
{
|
||||
case "e":
|
||||
case "eq":
|
||||
case "equals":
|
||||
return OperatorType.Equals;
|
||||
case "ne":
|
||||
case "neq":
|
||||
case "notequals":
|
||||
case "!":
|
||||
case "!e":
|
||||
case "!eq":
|
||||
case "!equals":
|
||||
return OperatorType.NotEquals;
|
||||
case "gt":
|
||||
case "greaterthan":
|
||||
return OperatorType.GreaterThan;
|
||||
case "lt":
|
||||
case "lessthan":
|
||||
return OperatorType.LessThan;
|
||||
case "gte":
|
||||
case "gteq":
|
||||
case "greaterthanequals":
|
||||
return OperatorType.GreaterThanEquals;
|
||||
case "lte":
|
||||
case "lteq":
|
||||
case "lessthanequals":
|
||||
return OperatorType.LessThanEquals;
|
||||
default:
|
||||
return OperatorType.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Matches(ISerializableEntity target)
|
||||
{
|
||||
string valStr = AttributeValue.ToString();
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace Barotrauma
|
||||
|
||||
private readonly PropertyConditional.Comparison conditionalComparison = PropertyConditional.Comparison.Or;
|
||||
private readonly List<PropertyConditional> propertyConditionals;
|
||||
public bool HasConditions => propertyConditionals != null && propertyConditionals.Any();
|
||||
|
||||
private readonly bool setValue;
|
||||
|
||||
@@ -458,6 +459,19 @@ namespace Barotrauma
|
||||
return (targetTypes & targetType) != 0;
|
||||
}
|
||||
|
||||
public bool ReducesItemCondition()
|
||||
{
|
||||
for (int i = 0; i < propertyNames.Length; i++)
|
||||
{
|
||||
if (propertyNames[i] != "condition") { continue; }
|
||||
if (propertyEffects[i].GetType() == typeof(float))
|
||||
{
|
||||
return (float)propertyEffects[i] < 0.0f || (setValue && (float)propertyEffects[i] <= 0.0f);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool HasRequiredItems(Entity entity)
|
||||
{
|
||||
if (requiredItems == null) return true;
|
||||
@@ -794,7 +808,7 @@ namespace Barotrauma
|
||||
if (limb.IsSevered) { continue; }
|
||||
if (targetLimbs != null && !targetLimbs.Contains(limb.type)) { continue; }
|
||||
AttackResult result = limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, result.Damage);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, disableDeltaTime ? result.Damage : result.Damage / deltaTime, allowBeheading: true);
|
||||
//only apply non-limb-specific afflictions to the first limb
|
||||
if (!affliction.Prefab.LimbSpecific) { break; }
|
||||
}
|
||||
@@ -804,7 +818,7 @@ namespace Barotrauma
|
||||
if (limb.IsSevered) { continue; }
|
||||
if (limb.character.Removed || limb.Removed) { continue; }
|
||||
AttackResult result = limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, result.Damage);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, disableDeltaTime ? result.Damage : result.Damage / deltaTime, allowBeheading: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user