-
Notifications
You must be signed in to change notification settings - Fork 61
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
18 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
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
8 changes: 8 additions & 0 deletions
8
Content.Server/Funkystation/Components/RandomPersistentTargetComponent.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,8 @@ | ||
using Content.Server.Objectives.Components; | ||
|
||
namespace Content.Server.Funkystation.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class RandomPersistentTargetComponent : Component | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
Content.Server/Funkystation/Objectives/Components/ObsessedPersistentTarget.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,9 @@ | ||
using Content.Server.Objectives.Systems; | ||
|
||
namespace Content.Server.Funkystation.Objectives.Components; | ||
|
||
[RegisterComponent, Access(typeof(KeepAliveConditionSystem))] | ||
public sealed partial class ObsessedPersistentTargetComponent : Component | ||
{ | ||
public EntityUid EntityUid = EntityUid.Invalid; | ||
} |
96 changes: 96 additions & 0 deletions
96
Content.Server/Funkystation/Obsessed/GameTicking/ObsessedRuleSystem.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,96 @@ | ||
using Content.Server.Antag; | ||
using Content.Server.GameTicking.Rules.Components; | ||
using Content.Server.Mind; | ||
using Content.Server.Objectives; | ||
using Content.Server.Roles; | ||
using Content.Shared.Changeling; | ||
using Content.Shared.NPC.Prototypes; | ||
using Content.Shared.NPC.Systems; | ||
using Content.Shared.Roles; | ||
using Content.Shared.Store; | ||
using Content.Shared.Store.Components; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Prototypes; | ||
using System.Text; | ||
using Content.Shared.Obsessed; | ||
|
||
namespace Content.Server.GameTicking.Rules; | ||
|
||
public sealed partial class ObsessedRuleSystem : GameRuleSystem<ObsessedRuleComponent> | ||
{ | ||
[Dependency] private readonly MindSystem _mind = default!; | ||
[Dependency] private readonly AntagSelectionSystem _antag = default!; | ||
[Dependency] private readonly SharedRoleSystem _role = default!; | ||
[Dependency] private readonly ObjectivesSystem _objective = default!; | ||
|
||
public readonly ProtoId<AntagPrototype> ObsessedPrototypeId = "Obsessed"; | ||
|
||
public readonly SoundSpecifier BriefingSound = new SoundPathSpecifier("/Audio/Funkystation/Ambience/angels_harp_sound.ogg"); | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ObsessedRuleComponent, AfterAntagEntitySelectedEvent>(OnSelectAntag); | ||
SubscribeLocalEvent<ObsessedRuleComponent, ObjectivesTextPrependEvent>(OnTextPrepend); | ||
} | ||
|
||
private void OnSelectAntag(EntityUid uid, ObsessedRuleComponent comp, ref AfterAntagEntitySelectedEvent args) | ||
{ | ||
MakeObsessed(args.EntityUid, comp); | ||
} | ||
public bool MakeObsessed(EntityUid target, ObsessedRuleComponent rule) | ||
{ | ||
if (!_mind.TryGetMind(target, out var mindId, out var mind)) | ||
return false; | ||
|
||
var briefing = Loc.GetString("obsessed-role-greeting"); | ||
var briefingShort = Loc.GetString("obsessed-role-greeting-short"); | ||
|
||
EnsureComp<ObsessedComponent>(target); | ||
|
||
_antag.SendBriefing(target, briefing, Color.Pink, BriefingSound); | ||
_role.MindAddRole(mindId, new RoleBriefingComponent { Briefing = briefingShort }, mind, true); | ||
|
||
foreach (var objective in rule.Objectives) | ||
{ | ||
_mind.TryAddObjective(mindId, mind, objective); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private void OnTextPrepend(EntityUid uid, ObsessedRuleComponent comp, ref ObjectivesTextPrependEvent args) | ||
{ | ||
var mostAbsorbedName = string.Empty; | ||
var mostStolenName = string.Empty; | ||
var mostAbsorbed = 0f; | ||
var mostStolen = 0f; | ||
|
||
foreach (var ling in EntityQuery<ChangelingComponent>()) | ||
{ | ||
if (!_mind.TryGetMind(ling.Owner, out var mindId, out var mind)) | ||
continue; | ||
|
||
if (!TryComp<MetaDataComponent>(ling.Owner, out var metaData)) | ||
continue; | ||
|
||
if (ling.TotalAbsorbedEntities > mostAbsorbed) | ||
{ | ||
mostAbsorbed = ling.TotalAbsorbedEntities; | ||
mostAbsorbedName = _objective.GetTitle((mindId, mind), metaData.EntityName); | ||
} | ||
if (ling.TotalStolenDNA > mostStolen) | ||
{ | ||
mostStolen = ling.TotalStolenDNA; | ||
mostStolenName = _objective.GetTitle((mindId, mind), metaData.EntityName); | ||
} | ||
} | ||
|
||
var sb = new StringBuilder(); | ||
sb.AppendLine(Loc.GetString($"roundend-prepend-changeling-absorbed{(!string.IsNullOrWhiteSpace(mostAbsorbedName) ? "-named" : "")}", ("name", mostAbsorbedName), ("number", mostAbsorbed))); | ||
sb.AppendLine(Loc.GetString($"roundend-prepend-changeling-stolen{(!string.IsNullOrWhiteSpace(mostStolenName) ? "-named" : "")}", ("name", mostStolenName), ("number", mostStolen))); | ||
|
||
args.Text = sb.ToString(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Server/Funkystation/Obsessed/GameTicking/Rules/ObsessedRulesComponent.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,13 @@ | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.GameTicking.Rules.Components; | ||
|
||
[RegisterComponent, Access(typeof(ObsessedRuleSystem))] | ||
public sealed partial class ObsessedRuleComponent : Component | ||
{ | ||
public readonly List<ProtoId<EntityPrototype>> Objectives = | ||
[ | ||
"ObsessedKeepAliveObjective", | ||
"ObsessedHugObjective", | ||
]; | ||
} |
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,8 @@ | ||
using Content.Shared.Roles; | ||
|
||
namespace Content.Server.Roles; | ||
|
||
[RegisterComponent, ExclusiveAntagonist] | ||
public sealed partial class ObsessedRoleComponent : AntagonistRoleComponent | ||
{ | ||
} |
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,8 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Obsessed; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class ObsessedComponent : Component | ||
{ | ||
} |
Binary file not shown.
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,4 @@ | ||
- files: ["angels_harp_sound.wav"] | ||
license: "CC-BY-3.0" | ||
copyright: "Created by Brand Name Audio" | ||
source: "https://www.youtube.com/watch?v=eTebYPZ1yMI" |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/Funkystation/Obsessed/administration/antag.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,2 @@ | ||
admin-verb-make-obsessed = Make the target into an obsessed. | ||
admin-verb-text-make-obsessed = Make Obsessed |
12 changes: 12 additions & 0 deletions
12
Resources/Locale/en-US/Funkystation/Obsessed/game-presets/obsessed.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 @@ | ||
obsessed-roundend-name = obsessed | ||
objective-issuer-obsessed = [color=pink]Obsessed[/color] | ||
obsessed-gamemode-title = Obsessed | ||
obsessed-gamemode-description = | ||
There's love (lead) in the air! Figure out who's obsessed over who before it turns into a bloody Valentine's. | ||
obsessed-role-greeting = | ||
You suddenly come down with a severe case of heartache. | ||
Your objectives are listed in the character menu. | ||
Note, you ARE NOT a traditional antagonist! | ||
obsessed-role-greeting-short = | ||
You're infatuated with a crew member on the station. |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/Funkystation/Obsessed/objectives/obsessed.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,2 @@ | ||
objective-condition-obsessed-keep-safe-title = Keep {$targetName}, {CAPITALIZE($job)} safe. | ||
objective-condition-obsessed-keep-safe = I can't let anyone hurt them! |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/Funkystation/Obsessed/prototypes/roles/antag.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,2 @@ | ||
roles-antag-obsessed-name = Obsessed | ||
roles-antag-obsessed-description = Use whatever means are available to you to protect your obsession. |
20 changes: 20 additions & 0 deletions
20
Resources/Prototypes/Funkystation/Obsessed/GameRules/obsessed.yml
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,20 @@ | ||
- type: entity | ||
parent: BaseGameRule | ||
id: Obsessed | ||
components: | ||
- type: ObsessedRule | ||
- type: GameRule | ||
minPlayers: 10 | ||
delay: | ||
min: 10 | ||
max: 20 | ||
- type: AntagSelection | ||
agentName: obsessed | ||
definitions: | ||
- prefRoles: [ Obsessed ] | ||
max: 8 | ||
playerRatio: 10 | ||
lateJoinAdditional: true | ||
mindComponents: | ||
- type: ObsessedRole | ||
prototype: Obsessed |
25 changes: 25 additions & 0 deletions
25
Resources/Prototypes/Funkystation/Obsessed/Objectives/obsessed.yml
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,25 @@ | ||
- type: entity | ||
abstract: true | ||
parent: BaseObjective | ||
id: BaseObsessedObjective | ||
components: | ||
- type: Objective | ||
difficulty: 1.5 # unused but necessary I guess | ||
issuer: objective-issuer-obsessed | ||
- type: RoleRequirement | ||
roles: | ||
components: | ||
- ObsessedRole | ||
|
||
- type: entity | ||
parent: [BaseObsessedObjective, BaseKeepAliveObjective] | ||
id: ObsessedKeepAliveObjective | ||
description: No matter what, I can't let anyone hurt them! | ||
components: | ||
- type: Objective | ||
icon: | ||
sprite: Mobs/Demons/abomination.rsi | ||
state: dead | ||
- type: TargetObjective | ||
title: objective-condition-obsessed-keep-safe-title | ||
- type: RandomPersistentTarget |
7 changes: 7 additions & 0 deletions
7
Resources/Prototypes/Funkystation/Obsessed/Roles/Antags/obsessed.yml
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 @@ | ||
- type: antag | ||
id: Obsessed | ||
name: Obsessed | ||
antagonist: true | ||
setPreference: true | ||
objective: Do anything in your power to protect your obsession. | ||
guides: [ Changelings ] |