2020-12-01 17:05:19 +01:00
|
|
|
using Content.Server.Objectives.Interfaces;
|
2022-02-06 21:25:04 -05:00
|
|
|
using Content.Server.Roles;
|
2021-12-03 15:25:51 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
2020-12-01 17:05:19 +01:00
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Objectives.Conditions
|
|
|
|
|
{
|
|
|
|
|
public abstract class KillPersonCondition : IObjectiveCondition
|
|
|
|
|
{
|
2021-06-09 22:19:39 +02:00
|
|
|
protected Mind.Mind? Target;
|
|
|
|
|
public abstract IObjectiveCondition GetAssigned(Mind.Mind mind);
|
2020-12-01 17:05:19 +01:00
|
|
|
|
2021-12-03 15:25:51 +01:00
|
|
|
public string Title
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var targetName = string.Empty;
|
2022-02-06 21:25:04 -05:00
|
|
|
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
|
2021-12-03 15:25:51 +01:00
|
|
|
|
|
|
|
|
if (Target == null)
|
2022-02-06 21:25:04 -05:00
|
|
|
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
2021-12-03 15:25:51 +01:00
|
|
|
|
2021-12-05 21:02:04 +01:00
|
|
|
if (Target.CharacterName != null)
|
2021-12-03 15:25:51 +01:00
|
|
|
targetName = Target.CharacterName;
|
2021-12-05 21:02:04 +01:00
|
|
|
else if (Target.OwnedEntity is {Valid: true} owned)
|
|
|
|
|
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
|
2021-12-03 15:25:51 +01:00
|
|
|
|
2022-02-06 21:25:04 -05:00
|
|
|
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
2021-12-03 15:25:51 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-12-01 17:05:19 +01:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
public string Description => Loc.GetString("objective-condition-kill-person-description");
|
2020-12-01 17:05:19 +01:00
|
|
|
|
|
|
|
|
public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ResourcePath("Objects/Weapons/Guns/Pistols/mk58_wood.rsi"), "icon");
|
|
|
|
|
|
2021-05-15 16:46:55 +01:00
|
|
|
public float Progress => (Target?.CharacterDeadIC ?? true) ? 1f : 0f;
|
2020-12-01 17:05:19 +01:00
|
|
|
|
2022-01-15 00:02:16 -05:00
|
|
|
public float Difficulty => 2f;
|
2020-12-01 17:05:19 +01:00
|
|
|
|
|
|
|
|
public bool Equals(IObjectiveCondition? other)
|
|
|
|
|
{
|
|
|
|
|
return other is KillPersonCondition kpc && Equals(Target, kpc.Target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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((KillPersonCondition) obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return Target?.GetHashCode() ?? 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|