-
Notifications
You must be signed in to change notification settings - Fork 54
новая целька #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benjii158
wants to merge
2
commits into
corvax-team:master
Choose a base branch
from
benjii158:teach-obj
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
новая целька #631
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
Content.Server/_CorvaxGoob/OfferItem/Objectives/TeachALessonConditionComponent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| namespace Content.Server._Starlight.Objectives; | ||
|
|
||
| /// <summary> | ||
| /// Requires that a target at least dies once. | ||
| /// Depends on <see cref="TargetObjectiveComponent"/> to function. | ||
| /// </summary> | ||
|
|
||
| [RegisterComponent] | ||
| public sealed partial class TeachALessonConditionComponent : Component | ||
| { | ||
| /// <summary> | ||
| /// Checks to see if the target has died | ||
| /// </summary> | ||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public bool HasDied = false; | ||
|
|
||
| } |
104 changes: 104 additions & 0 deletions
104
Content.Server/_CorvaxGoob/OfferItem/Objectives/TeachALessonConditionSystem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| using Content.Server.Ghost; | ||
| using Content.Server.Objectives.Components; | ||
| using Content.Shared.Bed.Cryostorage; | ||
| using Content.Shared.Mind; | ||
| using Content.Shared.Mind.Components; // goob - fix teach a lesson | ||
| using Content.Shared.Mobs; | ||
| using Content.Shared.Objectives.Components; | ||
|
|
||
| namespace Content.Server._Starlight.Objectives; | ||
|
|
||
| /// <summary> | ||
| /// Handles Teach a Lesson logic on if a specific entity has died at least once during the round | ||
| /// </summary> | ||
| public sealed class TeachALessonConditionSystem : EntitySystem | ||
| { | ||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
|
|
||
| SubscribeLocalEvent<TeachALessonTargetComponent, MobStateChangedEvent>(OnMobStateChanged); | ||
| SubscribeLocalEvent<TeachALessonTargetComponent, MindAddedMessage>(OnMindAdded); | ||
| SubscribeLocalEvent<TeachALessonTargetComponent, MindRemovedMessage>(OnMindRemoved); // goob - fix teach a lesson | ||
| SubscribeLocalEvent<GhostAttemptHandleEvent>(OnGhostAttempt); // goob - fix teach a lesson | ||
| SubscribeLocalEvent<TeachALessonConditionComponent, ObjectiveAfterAssignEvent>(OnAfterAssign); | ||
| SubscribeLocalEvent<TeachALessonConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress); | ||
| } | ||
|
|
||
| private void OnGetProgress(Entity<TeachALessonConditionComponent> ent, ref ObjectiveGetProgressEvent args) | ||
| { | ||
| args.Progress = ent.Comp.HasDied ? 1.0f : 0.0f; | ||
| } | ||
|
|
||
| private void OnAfterAssign(Entity<TeachALessonConditionComponent> ent, ref ObjectiveAfterAssignEvent args) | ||
| { | ||
| if (!TryComp(ent.Owner, out TargetObjectiveComponent? targetObjective)) | ||
| return; | ||
| var targetMindUid = targetObjective.Target; | ||
| if (targetMindUid is null) | ||
| return; | ||
| if (!TryComp(targetMindUid, out MindComponent? targetMind)) | ||
| return; | ||
| var targetMobUid = targetMind.CurrentEntity; | ||
| if (targetMobUid is null) | ||
| return; | ||
| var targetComponent = EnsureComp<TeachALessonTargetComponent>(targetMobUid.Value); | ||
| targetComponent.Teachers.Add(ent.Owner); | ||
| } | ||
|
|
||
| private void OnMindAdded(EntityUid uid, TeachALessonTargetComponent component, MindAddedMessage args) // goob - fix teach a lesson | ||
| { | ||
| var targetComponent = EnsureComp<TeachALessonTargetComponent>(args.Container.Owner); | ||
| foreach (var teacher in component.Teachers) | ||
| { | ||
| targetComponent.Teachers.Add(teacher); | ||
| } | ||
| } | ||
|
|
||
| private void OnMindRemoved(EntityUid uid, TeachALessonTargetComponent component, MindRemovedMessage args) // goob - fix teach a lesson | ||
| { | ||
| // cryo storage fix godo | ||
| if (TryComp<CryostorageContainedComponent>(uid, out var contained) && contained.GracePeriodEndTime == null) | ||
| { | ||
| TriggerObjective(component); | ||
| } | ||
|
|
||
| RemCompDeferred<TeachALessonTargetComponent>(uid); | ||
| } | ||
|
|
||
| private void OnGhostAttempt(GhostAttemptHandleEvent args) // goob - fix teach a lesson | ||
| { | ||
| if (args.Mind.OwnedEntity is not { } owned || !TryComp<TeachALessonTargetComponent>(owned, out var target)) | ||
| return; | ||
|
|
||
| if (args.CanReturnGlobal && args.Mind.VisitingEntity == null) | ||
| { | ||
| TriggerObjective(target); | ||
| return; | ||
| } | ||
|
|
||
| if (args.CanReturnGlobal) | ||
| return; | ||
|
|
||
| TriggerObjective(target); | ||
| } | ||
|
|
||
| private void OnMobStateChanged(Entity<TeachALessonTargetComponent> ent, ref MobStateChangedEvent args) | ||
| { | ||
| if (args.NewMobState != MobState.Dead) | ||
| return; | ||
|
|
||
| TriggerObjective(ent.Comp); | ||
| } | ||
|
|
||
| private void TriggerObjective(TeachALessonTargetComponent component) // goob - fix teach a lesson | ||
| { | ||
| foreach (var teacher in component.Teachers) | ||
| { | ||
| if (!TryComp(teacher, out TeachALessonConditionComponent? condition)) | ||
| continue; | ||
|
|
||
| condition.HasDied = true; | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
Content.Server/_CorvaxGoob/OfferItem/Objectives/TeachALessonTargetComponent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| namespace Content.Server._Starlight.Objectives; | ||
|
|
||
| /// <summary> | ||
| /// Marker component for the target of Teach a lesson Objective | ||
| /// Holds HashSet of entities with this objective | ||
| /// </summary> | ||
|
|
||
| [RegisterComponent ] | ||
| public sealed partial class TeachALessonTargetComponent : Component | ||
| { | ||
| [DataField] | ||
| public HashSet<EntityUid> Teachers = new HashSet<EntityUid>(); | ||
| } |
1 change: 1 addition & 0 deletions
1
Resources/Locale/ru-RU/_CorvaxGoob/Objective/teach-a-lesson.ftl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| objective-condition-teach-lesson-title = Проучите { $targetName }, { CAPITALIZE($job) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ent-BaseTeachALessonObjective = { ent-BaseTargetObjective } | ||
| .desc = { ent-BaseTargetObjective.desc } | ||
| ent-TeachRandomPersonObjective = { ent-BaseTraitorObjective } | ||
| .desc = Убедитесь, что этот человек умрёт хотя бы раз за смену. Он знает что натворил. | ||
| ent-TeachRandomHeadObjective = { ent-BaseTraitorObjective } | ||
| .desc = Убедитесь, что этот руководитель умрёт хотя бы раз за смену. Он знает, что натворил. | ||
8 changes: 8 additions & 0 deletions
8
Resources/Prototypes/_CorvaxGoob/Objectives/ObjectiveGroups.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| - type: weightedRandom | ||
| id: TraitorObjectiveGroupTeach | ||
| weights: | ||
| TeachRandomPersonObjective: 1 #Goobstation Teach them a lesson | ||
| TeachRandomHeadObjective: 0.25 #Goobstation Teach them a lesson | ||
| KillRandomPersonObjective: 1 | ||
| KillStationAiObjective: 0.25 | ||
| KillRandomHeadObjective: 0.25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # requires that the player kill someone only once | ||
| # disables social objectives and is disabled by social objectives | ||
|
|
||
| - type: entity | ||
| abstract: true | ||
| parent: BaseTargetObjective | ||
| id: BaseTeachALessonObjective | ||
| components: | ||
| - type: Objective | ||
| unique: false | ||
| icon: | ||
| sprite: Objects/Weapons/Melee/baseball_bat.rsi | ||
| state: icon | ||
| - type: ObjectiveBlacklistRequirement | ||
| blacklist: | ||
| components: | ||
| - SocialObjective | ||
| - type: TeachALessonCondition | ||
|
|
||
| #Teach a Lesson | ||
| - type: entity | ||
| parent: [BaseTraitorObjective, BaseTeachALessonObjective] | ||
| id: TeachRandomPersonObjective | ||
| description: Ensure they die at least once this shift. They know what they did. | ||
| components: | ||
| - type: Objective | ||
| difficulty: 0.5 #slightly under 1/3rd the diffculty of RR | ||
| unique: false | ||
| - type: TargetObjective | ||
| title: objective-condition-teach-lesson-title | ||
| - type: PickRandomPerson | ||
|
|
||
|
|
||
| - type: entity | ||
| parent: [BaseTraitorObjective, BaseTeachALessonObjective] | ||
| id: TeachRandomHeadObjective | ||
| description: Ensure this head dies at least once this shift. They know what they did. | ||
| components: | ||
| - type: Objective | ||
| # technically it's still possible for TeachRandomPersonObjective to roll a head but this is guaranteed, so higher difficulty | ||
| difficulty: 1 | ||
| # killing 1 head is enough | ||
| unique: true | ||
| - type: TargetObjective | ||
| title: objective-condition-teach-lesson-title | ||
| - type: PickRandomPerson | ||
| filters: | ||
| - !type:BodyMindFilter | ||
| whitelist: | ||
| components: | ||
| - CommandStaff |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comma in player-facing description.
Inconsistent with line 6 — "что" should be preceded by a comma.
✏️ Proposed fix
🤖 Prompt for AI Agents