* 3 space indent at start of line jumpscare * _leftShuttles -> ShuttlesLeft * stuff * RequireDead override for the future * fix 50% logic * rouge * pod 1984 * technically more "difficult" --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
using Content.Server.Mind;
|
|
using Content.Server.Objectives.Interfaces;
|
|
using Content.Server.Shuttles.Systems;
|
|
using Content.Shared.Cuffs.Components;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Objectives.Conditions
|
|
{
|
|
[UsedImplicitly]
|
|
[DataDefinition]
|
|
public sealed class EscapeShuttleCondition : IObjectiveCondition
|
|
{
|
|
private Mind.Mind? _mind;
|
|
|
|
public IObjectiveCondition GetAssigned(Mind.Mind mind)
|
|
{
|
|
return new EscapeShuttleCondition {
|
|
_mind = mind,
|
|
};
|
|
}
|
|
|
|
public string Title => Loc.GetString("objective-condition-escape-shuttle-title");
|
|
|
|
public string Description => Loc.GetString("objective-condition-escape-shuttle-description");
|
|
|
|
public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ("Structures/Furniture/chairs.rsi"), "shuttle");
|
|
|
|
public float Progress
|
|
{
|
|
get {
|
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
var mindSystem = entMan.System<MindSystem>();
|
|
|
|
if (_mind?.OwnedEntity == null
|
|
|| !entMan.TryGetComponent<TransformComponent>(_mind.OwnedEntity, out var xform))
|
|
return 0f;
|
|
|
|
if (mindSystem.IsCharacterDeadIc(_mind))
|
|
return 0f;
|
|
|
|
if (entMan.TryGetComponent<CuffableComponent>(_mind.OwnedEntity, out var cuffed)
|
|
&& cuffed.CuffedHandCount > 0)
|
|
{
|
|
// You're not escaping if you're restrained!
|
|
return 0f;
|
|
}
|
|
|
|
// Any emergency shuttle counts for this objective, but not pods.
|
|
var emergencyShuttle = entMan.System<EmergencyShuttleSystem>();
|
|
if (!emergencyShuttle.IsTargetEscaping(_mind.OwnedEntity.Value))
|
|
return 0f;
|
|
|
|
return 1f;
|
|
}
|
|
}
|
|
|
|
public float Difficulty => 1.3f;
|
|
|
|
public bool Equals(IObjectiveCondition? other)
|
|
{
|
|
return other is EscapeShuttleCondition esc && Equals(_mind, esc._mind);
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (ReferenceEquals(null, obj)) return false;
|
|
if (ReferenceEquals(this, obj)) return true;
|
|
if (obj.GetType() != GetType()) return false;
|
|
return Equals((EscapeShuttleCondition) obj);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return _mind != null ? _mind.GetHashCode() : 0;
|
|
}
|
|
}
|
|
}
|