-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: Aspects
- Loading branch information
Showing
39 changed files
with
1,387 additions
and
4 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
14 changes: 14 additions & 0 deletions
14
Content.Server/_White/AspectsSystem/Aspects/Components/ImmersiveAspectComponent.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,14 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class ImmersiveAspectComponent : Component | ||
{ | ||
[DataField] | ||
public float EyeModifier = 0.6f; | ||
|
||
[DataField] | ||
public float TelescopeDivisor = 0.15f; | ||
|
||
[DataField] | ||
public float TelescopeLerpAmount = 0.07f; | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Server/_White/AspectsSystem/Aspects/Components/LandmineAspectComponent.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,11 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class LandmineAspectComponent : Component | ||
{ | ||
[DataField] | ||
public int Min = 40; | ||
|
||
[DataField] | ||
public int Max = 60; | ||
} |
6 changes: 6 additions & 0 deletions
6
Content.Server/_White/AspectsSystem/Aspects/Components/NothingAspectComponent.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,6 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class NothingAspectComponent : Component | ||
{ | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Server/_White/AspectsSystem/Aspects/Components/PresentAspectComponent.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,11 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class PresentAspectComponent : Component | ||
{ | ||
[DataField] | ||
public int Min = 150; | ||
|
||
[DataField] | ||
public int Max = 200; | ||
} |
6 changes: 6 additions & 0 deletions
6
Content.Server/_White/AspectsSystem/Aspects/Components/ReflectAspectComponent.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,6 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class ReflectAspectComponent : Component | ||
{ | ||
} |
6 changes: 6 additions & 0 deletions
6
Content.Server/_White/AspectsSystem/Aspects/Components/TraitorRichAspectComponent.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,6 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class TraitorRichAspectComponent : Component | ||
{ | ||
} |
17 changes: 17 additions & 0 deletions
17
Content.Server/_White/AspectsSystem/Aspects/Components/TraitoredAspectComponent.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,17 @@ | ||
namespace Content.Server._White.AspectsSystem.Aspects.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class TraitoredAspectComponent : Component | ||
{ | ||
[DataField] | ||
public int TimeElapsedForTraitors = 60; | ||
|
||
[DataField] | ||
public int TimeElapsedForAllMin = 300; | ||
|
||
[DataField] | ||
public int TimeElapsedForAllMax = 360; | ||
|
||
[DataField] | ||
public string AnnouncementForTraitorSound = "/Audio/_White/Aspects/palevo.ogg"; | ||
} |
97 changes: 97 additions & 0 deletions
97
Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.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,97 @@ | ||
using System.Numerics; | ||
using Content.Server._White.AspectsSystem.Aspects.Components; | ||
using Content.Server._White.AspectsSystem.Base; | ||
using Content.Server.GameTicking; | ||
using Content.Server.GameTicking.Components; | ||
using Content.Shared._White.Telescope; | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.Movement.Components; | ||
using Content.Shared.Movement.Systems; | ||
|
||
namespace Content.Server._White.AspectsSystem.Aspects; | ||
|
||
public sealed class ImmersiveAspect : AspectSystem<ImmersiveAspectComponent> | ||
{ | ||
|
||
[Dependency] private readonly SharedContentEyeSystem _eye = default!; | ||
[Dependency] private readonly SharedTelescopeSystem _telescope = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawn); | ||
} | ||
|
||
protected override void Started(EntityUid uid, ImmersiveAspectComponent component, GameRuleComponent gameRule, | ||
GameRuleStartedEvent args) | ||
{ | ||
base.Started(uid, component, gameRule, args); | ||
|
||
OnStarted(component); | ||
} | ||
|
||
private void OnStarted(ImmersiveAspectComponent component) | ||
{ | ||
var humans = EntityQuery<HumanoidAppearanceComponent>(); | ||
|
||
foreach (var human in humans) | ||
{ | ||
var entity = human.Owner; | ||
|
||
if (!HasComp<ContentEyeComponent>(entity)) | ||
continue; | ||
|
||
SetEyeZoom(entity, component.EyeModifier); | ||
AddTelescope(entity, component.TelescopeDivisor, component.TelescopeLerpAmount); | ||
} | ||
} | ||
|
||
private void SetEyeZoom(EntityUid human, float modifier) | ||
{ | ||
_eye.SetMaxZoom(human, new Vector2(modifier)); | ||
_eye.SetZoom(human, new Vector2(modifier)); | ||
} | ||
|
||
private void AddTelescope(EntityUid human, float divisor, float lerpAmount) | ||
{ | ||
var telescope = EnsureComp<TelescopeComponent>(human); | ||
|
||
_telescope.SetParameters((human, telescope), divisor, lerpAmount); | ||
} | ||
|
||
private void OnPlayerSpawn(PlayerSpawnCompleteEvent ev) | ||
{ | ||
if (!HasComp<ContentEyeComponent>(ev.Mob)) | ||
return; | ||
|
||
var query = EntityQueryEnumerator<ImmersiveAspectComponent, GameRuleComponent>(); | ||
while (query.MoveNext(out var ruleEntity, out var immersiveAspect, out var gameRule)) | ||
{ | ||
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) | ||
continue; | ||
|
||
SetEyeZoom(ev.Mob, immersiveAspect.EyeModifier); | ||
AddTelescope(ev.Mob, immersiveAspect.TelescopeDivisor, immersiveAspect.TelescopeLerpAmount); | ||
} | ||
} | ||
|
||
|
||
protected override void Ended(EntityUid uid, ImmersiveAspectComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args) | ||
{ | ||
base.Ended(uid, component, gameRule, args); | ||
|
||
var humans = EntityQuery<HumanoidAppearanceComponent>(); | ||
|
||
foreach (var human in humans) | ||
{ | ||
var entity = human.Owner; | ||
|
||
if (!HasComp<ContentEyeComponent>(entity)) | ||
continue; | ||
|
||
SetEyeZoom(entity, 1f); | ||
|
||
RemComp<TelescopeComponent>(entity); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Content.Server/_White/AspectsSystem/Aspects/LandmineAspect.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,32 @@ | ||
using Content.Server.GameTicking.Rules.Components; | ||
using Content.Server._White.AspectsSystem.Aspects.Components; | ||
using Content.Server._White.AspectsSystem.Base; | ||
using Content.Server.GameTicking.Components; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server._White.AspectsSystem.Aspects; | ||
|
||
public sealed class LandmineAspect : AspectSystem<LandmineAspectComponent> | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
|
||
protected override void Added(EntityUid uid, LandmineAspectComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) | ||
{ | ||
base.Added(uid, component, gameRule, args); | ||
|
||
SpawnMines(component); | ||
} | ||
|
||
private void SpawnMines(LandmineAspectComponent component) | ||
{ | ||
var minMines = _random.Next(component.Min, component.Max); | ||
|
||
for (var i = 0; i < minMines; i++) | ||
{ | ||
if (!TryFindRandomTile(out _, out _, out _, out var targetCoords)) | ||
break; | ||
|
||
EntityManager.SpawnEntity("LandMineAspectExplosive", targetCoords); | ||
} | ||
} | ||
} |
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._White.AspectsSystem.Aspects.Components; | ||
using Content.Server._White.AspectsSystem.Base; | ||
|
||
namespace Content.Server._White.AspectsSystem.Aspects; | ||
|
||
public sealed class NothingAspect : AspectSystem<NothingAspectComponent> | ||
{ | ||
} |
32 changes: 32 additions & 0 deletions
32
Content.Server/_White/AspectsSystem/Aspects/PresentAspect.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,32 @@ | ||
using Content.Server.GameTicking.Rules.Components; | ||
using Content.Server._White.AspectsSystem.Aspects.Components; | ||
using Content.Server._White.AspectsSystem.Base; | ||
using Content.Server.GameTicking.Components; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server._White.AspectsSystem.Aspects; | ||
|
||
public sealed class PresentAspect : AspectSystem<PresentAspectComponent> | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
|
||
protected override void Added(EntityUid uid, PresentAspectComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) | ||
{ | ||
base.Added(uid, component, gameRule, args); | ||
|
||
SpawnPresents(component); | ||
} | ||
|
||
private void SpawnPresents(PresentAspectComponent component) | ||
{ | ||
var minPresents = _random.Next(component.Min, component.Max); | ||
|
||
for (var i = 0; i < minPresents; i++) | ||
{ | ||
if (!TryFindRandomTile(out _, out _, out _, out var targetCoords)) | ||
break; | ||
|
||
EntityManager.SpawnEntity("PresentRandomUnsafe", targetCoords); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Content.Server/_White/AspectsSystem/Aspects/ReflectAspect.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,25 @@ | ||
using Content.Server.GameTicking.Rules.Components; | ||
using Content.Server._White.AspectsSystem.Aspects.Components; | ||
using Content.Server._White.AspectsSystem.Base; | ||
using Content.Server._White.Other; | ||
using Content.Server.GameTicking.Components; | ||
using Content.Shared.Weapons.Reflect; | ||
|
||
namespace Content.Server._White.AspectsSystem.Aspects; | ||
|
||
public sealed class ReflectAspect : AspectSystem<ReflectAspectComponent> | ||
{ | ||
protected override void Started(EntityUid uid, ReflectAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) | ||
{ | ||
base.Started(uid, component, gameRule, args); | ||
|
||
var query = EntityQueryEnumerator<ReflectAspectMarkComponent>(); | ||
while (query.MoveNext(out var ent, out _)) | ||
{ | ||
var reflect = EnsureComp<ReflectComponent>(ent); | ||
reflect.ReflectProb = 1; | ||
reflect.Reflects = ReflectType.Energy | ReflectType.NonEnergy; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.