-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
- Loading branch information
There are no files selected for viewing
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; | ||
} |
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; | ||
} |
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 | ||
{ | ||
} |
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; | ||
} |
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 | ||
{ | ||
} |
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 | ||
{ | ||
} |
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"; | ||
} |
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; | ||
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / Test Packaging
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / Test Packaging
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / YAML Linter
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / YAML Linter
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 6 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
|
||
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!; | ||
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / Test Packaging
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / Test Packaging
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / YAML Linter
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / YAML Linter
Check failure on line 17 in Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs GitHub Actions / build (ubuntu-latest)
|
||
|
||
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); | ||
} | ||
} | ||
} |
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); | ||
} | ||
} | ||
} |
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> | ||
{ | ||
} |
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); | ||
} | ||
} | ||
} |
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; | ||
} | ||
} | ||
|
||
} |