forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
Content.Server/SS220/Objectives/Components/CreateCocoonsConditionComponent.cs
This file contains 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,7 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
namespace Content.Server.SS220.Objectives.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class CreateCocoonsConditionComponent : Component | ||
{ | ||
} |
49 changes: 49 additions & 0 deletions
49
Content.Server/SS220/Objectives/Systems/CreateCocoonsConditionSystem.cs
This file contains 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,49 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
using Content.Server.Objectives.Systems; | ||
using Content.Server.SS220.Objectives.Components; | ||
using Content.Shared.Mind; | ||
using Content.Shared.Objectives.Components; | ||
using Content.Shared.SS220.SpiderQueen.Components; | ||
|
||
namespace Content.Server.SS220.Objectives.Systems; | ||
|
||
public sealed partial class CreateCocoonsConditionSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly NumberObjectiveSystem _number = default!; | ||
|
||
private Dictionary<MindComponent, bool> IsCompletedOnce = new(); | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<CreateCocoonsConditionComponent, ObjectiveGetProgressEvent>(OnGetProgress); | ||
} | ||
|
||
private void OnGetProgress(Entity<CreateCocoonsConditionComponent> ent, ref ObjectiveGetProgressEvent args) | ||
{ | ||
args.Progress = GetProgress(args.Mind, _number.GetTarget(ent.Owner)); | ||
} | ||
|
||
private float GetProgress(MindComponent mind, int target) | ||
{ | ||
if (IsCompletedOnce.TryGetValue(mind, out var comleted) && | ||
comleted) | ||
return 1f; | ||
|
||
var mobUid = mind.CurrentEntity; | ||
if (mobUid is null || | ||
!TryComp<SpiderQueenComponent>(mobUid, out var spiderQueen)) | ||
return 0f; | ||
|
||
if (spiderQueen.CocoonsList.Count >= target) | ||
{ | ||
IsCompletedOnce.Add(mind, true); | ||
return 1f; | ||
} | ||
else | ||
{ | ||
return 0f; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Resources/Locale/ru-RU/ss220/objectives/conditions/create-cocoons.ftl
This file contains 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,12 @@ | ||
objective-create-cocoons-title = | ||
Создать { $count } { $count -> | ||
[one] кокон | ||
[few] кокона | ||
*[other] коконов | ||
}. | ||
objective-create-cocoons-description = | ||
Используйте действие «Окукливание» чтобы создать { $count } { $count -> | ||
[one] кокон | ||
[few] кокона | ||
*[other] коконов | ||
}. |
This file contains 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
This file contains 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
This file contains 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,28 @@ | ||
- type: entity | ||
abstract: true | ||
parent: BaseObjective | ||
id: BaseSpiderQueenObjective | ||
components: | ||
- type: Objective | ||
difficulty: 1.5 | ||
issuer: objective-issuer-spider-queen | ||
- type: RoleRequirement | ||
roles: | ||
components: | ||
- SpiderQueenRole | ||
|
||
- type: entity | ||
parent: BaseSpiderQueenObjective | ||
id: CreateCocoonsObjective | ||
components: | ||
- type: Objective | ||
icon: | ||
sprite: SS220/Structures/Specific/cocoon.rsi | ||
state: cocoon2 | ||
- type: NumberObjective | ||
# dragon can only spawn 3 rifts so keep objective the same | ||
min: 2 | ||
max: 2 | ||
title: objective-create-cocoons-title | ||
description: objective-create-cocoons-description | ||
- type: CreateCocoonsCondition |