mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
Remove Teach a Lesson (#2365)
https://github.com/Simple-Station/Einstein-Engines/pull/2362 Co-authored-by: Your Name <EctoplasmIsGood@users.noreply.github.com> (cherry picked from commit ed67011a8c86a510a7823f8c679d2ccd5f1e0c43)
This commit is contained in:
committed by
Spatison
parent
7005f46e4a
commit
b6b9b6dfc3
@@ -1,20 +0,0 @@
|
||||
using Content.Server.DeltaV.Objectives.Systems;
|
||||
using Content.Server.Objectives.Components;
|
||||
|
||||
namespace Content.Server.DeltaV.Objectives.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Requires that a target dies once and only once.
|
||||
/// Depends on <see cref="TargetObjectiveComponent"/> to function.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(TeachLessonConditionSystem))]
|
||||
public sealed partial class TeachLessonConditionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How close the assassin must be to the person "Being given a lesson", to ensure that the kill is reasonably
|
||||
/// something that could be the assassin's doing. This way the objective isn't resolved by the target getting killed
|
||||
/// by a space tick while on expedition.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float MaxDistance = 30f;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using Content.Server.DeltaV.Objectives.Components;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Objectives.Systems;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
|
||||
namespace Content.Server.DeltaV.Objectives.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// Handles teach a lesson condition logic, does not assign target.
|
||||
/// </summary>
|
||||
public sealed class TeachLessonConditionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly CodeConditionSystem _codeCondition = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MobStateChangedEvent>(OnMobStateChanged);
|
||||
}
|
||||
|
||||
private void OnMobStateChanged(MobStateChangedEvent args)
|
||||
{
|
||||
if (args.NewMobState != MobState.Critical || args.OldMobState >= args.NewMobState
|
||||
|| !TryComp<MindContainerComponent>(args.Target, out var mc) || mc.OriginalMind is not { } mindId)
|
||||
return;
|
||||
|
||||
// If the attacker actually has the objective, we can just skip any enumeration outright.
|
||||
if (args.Origin is not null
|
||||
&& HasComp<TeachLessonConditionComponent>(args.Origin)
|
||||
&& TryComp<TargetObjectiveComponent>(args.Origin, out var targetComp)
|
||||
&& targetComp.Target == mindId)
|
||||
{
|
||||
_codeCondition.SetCompleted(args.Origin!.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all TeachLessonConditionComponent entities
|
||||
var query = EntityQueryEnumerator<TeachLessonConditionComponent, TargetObjectiveComponent>();
|
||||
|
||||
while (query.MoveNext(out var ent, out var conditionComp, out var targetObjective))
|
||||
{
|
||||
// Check if this objective's target matches the entity that died
|
||||
if (targetObjective.Target != mindId)
|
||||
continue;
|
||||
|
||||
var userWorldPos = _transform.GetWorldPosition(ent);
|
||||
var targetWorldPos = _transform.GetWorldPosition(args.Target);
|
||||
|
||||
var distance = (userWorldPos - targetWorldPos).Length();
|
||||
if (distance > conditionComp.MaxDistance
|
||||
|| Transform(ent).MapID != Transform(args.Target).MapID)
|
||||
continue;
|
||||
|
||||
_codeCondition.SetCompleted(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,36 +33,3 @@
|
||||
stealGroup: RubberStampNotary
|
||||
verifyMapExistence: true
|
||||
owner: job-name-clerk
|
||||
|
||||
# teach lesson
|
||||
- type: entity
|
||||
abstract: true
|
||||
parent: BaseTargetObjective
|
||||
id: BaseTeachLessonObjective
|
||||
components:
|
||||
- type: Objective
|
||||
unique: false
|
||||
icon:
|
||||
sprite: Objects/Weapons/Melee/baseball_bat.rsi # WWDP
|
||||
state: icon
|
||||
- type: TeachLessonCondition
|
||||
- type: CodeCondition
|
||||
- type: ObjectiveBlacklistRequirement
|
||||
blacklist:
|
||||
components:
|
||||
- KillPersonCondition # WWDP no Teach & Kill the same person
|
||||
- SocialObjective
|
||||
|
||||
- type: entity
|
||||
parent: [BaseTraitorObjective, BaseTeachLessonObjective]
|
||||
id: TeachLessonRandomPersonObjective
|
||||
description: Kill them, and show everyone we mean business. They only need to die once.
|
||||
components:
|
||||
- type: Objective
|
||||
description: objective-condition-teach-person-description # WWDP Localization, title is done in TargetObjective
|
||||
difficulty: 1.75
|
||||
unique: false
|
||||
- type: TargetObjective
|
||||
title: objective-condition-teach-person-title
|
||||
- type: PickRandomPerson
|
||||
- type: TeachLessonCondition
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
id: TraitorObjectiveGroupKill
|
||||
weights:
|
||||
KillRandomPersonObjective: 1
|
||||
TeachLessonRandomPersonObjective: 0.25
|
||||
KillRandomHeadObjective: 0.25
|
||||
|
||||
- type: weightedRandom
|
||||
|
||||
Reference in New Issue
Block a user