Skip to content

Commit

Permalink
Add survive objective and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 committed Sep 14, 2024
1 parent 81af714 commit 67697fd
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed partial class SpiderQueenComponent : Component
/// How much mana will be generated in a second
/// </summary>
[DataField]
public FixedPoint2 PassiveGeneration = 0.5f;
public FixedPoint2 PassiveGeneration = FixedPoint2.New(0.5);

[ViewVariables]
public TimeSpan NextSecond = TimeSpan.Zero;
Expand All @@ -51,5 +51,11 @@ public sealed partial class SpiderQueenComponent : Component
/// Coefficient that indicating how much the bonus from each subsequent cocoon will decrease
/// </summary>
[DataField]
public FixedPoint2 CocoonsBonusCoefficient = 1f;
public FixedPoint2 CocoonsBonusCoefficient = FixedPoint2.New(1);

/// <summary>
/// The minimum distance between cocoons for their spawn
/// </summary>
[DataField]
public float CocoonsMinDistance = 0.5f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public abstract class SharedSpiderQueenSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -65,6 +66,15 @@ private void OnCocooningAction(Entity<SpiderQueenComponent> entity, ref SpiderCo
var performer = args.Performer;
var target = args.Target;

foreach (var entityInRange in _entityLookup.GetEntitiesInRange(target, entity.Comp.CocoonsMinDistance))
{
if (!HasComp<SpiderCocoonComponent>(entityInRange))
continue;

_popup.PopupEntity(Loc.GetString("cocooning-too-close"), performer, performer);
return;
}

if (!_mobState.IsDead(target))
{
_popup.PopupEntity(Loc.GetString("cocooning-target-not-dead"), performer, performer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
ent-BaseSpiderQueenObjective = { ent-BaseObjective }
.desc = { ent-BaseObjective.desc }
ent-CreateCocoonsObjective= { ent-BaseSpiderQueenObjective }
.desc = { ent-BaseSpiderQueenObjective.desc }
ent-SpiderQueenSurviveObjective = Выжить
.desc = Вы должны оставаться в живых, чтобы сохранять контроль.
objective-create-cocoons-title =
Создать { $count } { $count ->
[one] кокон
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/ss220/spider-queen/spider-queen.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
spider-queen-mana-amount = У вас [color=yellow]{ $current } маны[/color]. Ваш максимум — [color=yellow]{ $max } маны[/color].
spider-queen-not-enough-mana = Недостаточно маны
cocooning-too-close = Слишком близко к другому кокону
cocooning-target-not-dead = Цель должна быть мертва
cocooning-target-not-humanoid = Цель должна быть гуманоидом
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/SS220/GameRules/midround_antags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- type: AntagObjectives
objectives:
- CreateCocoonsObjective
- SpiderQueenSurviveObjective
- type: AntagSelection
definitions:
- prefRoles: [ SpiderQueen ]
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/SS220/Objectives/spider_queen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@
title: objective-create-cocoons-title
description: objective-create-cocoons-description
- type: CreateCocoonsCondition

- type: entity
parent: [BaseSpiderQueenObjective, BaseSurviveObjective]
id: SpiderQueenSurviveObjective
name: Survive
description: You have to stay alive to maintain control.
components:
- type: Objective
icon:
sprite: Mobs/Animals/spider.rsi
state: midwife

0 comments on commit 67697fd

Please sign in to comment.