add kill head objective (#17891)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.Objectives.Interfaces;
|
||||||
|
using Content.Server.Roles;
|
||||||
|
using Content.Shared.Mobs.Components;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Content.Server.Objectives.Conditions;
|
||||||
|
|
||||||
|
[DataDefinition]
|
||||||
|
public sealed class KillRandomHeadCondition : KillPersonCondition
|
||||||
|
{
|
||||||
|
public override IObjectiveCondition GetAssigned(Mind.Mind mind)
|
||||||
|
{
|
||||||
|
RequireDead = true;
|
||||||
|
|
||||||
|
var allHumans = EntityManager.EntityQuery<MindContainerComponent>(true).Where(mc =>
|
||||||
|
{
|
||||||
|
var entity = mc.Mind?.OwnedEntity;
|
||||||
|
|
||||||
|
if (entity == default)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return EntityManager.TryGetComponent(entity, out MobStateComponent? mobState) &&
|
||||||
|
MobStateSystem.IsAlive(entity.Value, mobState) &&
|
||||||
|
mc.Mind != mind;
|
||||||
|
}).Select(mc => mc.Mind).ToList();
|
||||||
|
|
||||||
|
if (allHumans.Count == 0)
|
||||||
|
return new DieCondition(); // I guess I'll die
|
||||||
|
|
||||||
|
var allHeads = allHumans.Where(mind => mind?.AllRoles.Any(role => {
|
||||||
|
if (role is not Job job)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// basically a command department check, pretty sussy but whatever
|
||||||
|
return job.Prototype.RequireAdminNotify;
|
||||||
|
}) ?? false).ToList();
|
||||||
|
|
||||||
|
if (allHeads.Count == 0)
|
||||||
|
allHeads = allHumans; // fallback to non-head target
|
||||||
|
|
||||||
|
return new KillRandomHeadCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(allHeads)};
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description => Loc.GetString("objective-condition-kill-head-description");
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
objective-condition-kill-head-description = We need this head gone and you probably know why. Good luck, agent.
|
||||||
@@ -25,6 +25,22 @@
|
|||||||
- !type:KillRandomPersonCondition {}
|
- !type:KillRandomPersonCondition {}
|
||||||
canBeDuplicate: true
|
canBeDuplicate: true
|
||||||
|
|
||||||
|
# technically its still possible for KillRandomObjective to roll a head but this is guaranteed, so higher difficulty
|
||||||
|
# this also will not count missing evac as killing as heads are higher profile, so you really need to do the dirty work
|
||||||
|
- type: objective
|
||||||
|
id: KillRandomHeadObjective
|
||||||
|
issuer: syndicate
|
||||||
|
difficultyOverride: 3.0
|
||||||
|
requirements:
|
||||||
|
- !type:TraitorRequirement {}
|
||||||
|
- !type:IncompatibleConditionsRequirement
|
||||||
|
conditions:
|
||||||
|
- RandomTraitorAliveCondition
|
||||||
|
conditions:
|
||||||
|
- !type:KillRandomHeadCondition {}
|
||||||
|
# killing 1 head is enough
|
||||||
|
canBeDuplicate: false
|
||||||
|
|
||||||
- type: objective
|
- type: objective
|
||||||
id: RandomTraitorAliveObjective
|
id: RandomTraitorAliveObjective
|
||||||
issuer: syndicate
|
issuer: syndicate
|
||||||
|
|||||||
Reference in New Issue
Block a user