Skip to content

Commit

Permalink
Shadowlings (#32)
Browse files Browse the repository at this point in the history
* skills

* init

* more jobs & prison station rename

* prisoner ID card & access fix & new switches and windoors

* make prison eng and med dangerous

* prison officers 5 -> 8

* prison access to admin

* auto prison shuttle & round end prison win type

* prison map 1.3

* reduce prisoners amount

* round end text fix

* prison map 1.4

* prison map 1.5

* pacified prisoners & round end text fix & escaped prisoners names at round end text

* conversion duration & conversion status icon & less shitcode

* init

* new end round song

* ascendance fix hands

* shadowling fix interactions

* roundstart shadowling channel to antag select

* fix ascendance not requires 15 thralls

* thermal vision & more damage to burn shadowling & shadowling ghost now can't see ghosts

* just end round without shuttle

* veil action now turn off handheld lights

* add ascendance ghost

* loc fix & shadowling damage modifier set

* mob states check support

* raise RevertedEvent before remove components & some changes to API

* mob states check support

* raise RevertedEvent before remove components & some changes to API

* raise attempt events

* revert thralls when shadowling die

* sponsor antag select fix

* update shadowling game preset description

* add shadowlings to secret

* update shadowling game preset for sponsor antags

* skill prototype & more skills & more receives, requires, affects

* new skills support & changes to requires in prototypes

* bartender's specials fix

* add skills to jobs

* salvage specialist add more skills

* zombie immune & more damage to burn shadowling

* thermal vision buff

* unshaded thrall's eyes & change thrall owner when real died

* Revert "Merge branch 'skills' into shadowlings"

This reverts commit fcb4be5, reversing
changes made to ba3ad05.

* Revert "Merge branch 'skills' into shadowlings"

This reverts commit ba3ad05, reversing
changes made to 61262cf.

* round end text fix & remove unused code

* fix shadowlings convert zombies

* changes to ice oil

---------

Co-authored-by: Doublechest <[email protected]>
  • Loading branch information
doublechest0 and Doublechest authored Aug 3, 2024
1 parent fb0f9ca commit d09e416
Show file tree
Hide file tree
Showing 163 changed files with 40,625 additions and 28,759 deletions.
34 changes: 0 additions & 34 deletions Content.Client/Stories/Lib/InvisibilitySystem.cs

This file was deleted.

9 changes: 0 additions & 9 deletions Content.Client/Stories/Shadowling/ShadowlingComponent.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Content.Client/Stories/Shadowling/ShadowlingHatchSystem.cs

This file was deleted.

42 changes: 0 additions & 42 deletions Content.Client/Stories/Shadowling/ShadowlingIconSystem.cs

This file was deleted.

75 changes: 22 additions & 53 deletions Content.Client/Stories/Shadowling/ShadowlingSystem.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,45 @@
using Content.Shared.Humanoid;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Stories.Conversion;
using Content.Shared.Stories.Shadowling;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Stories.Shadowling;

public sealed class ShadowlingSystem : SharedShadowlingSystem<ShadowlingThrallComponent, ShadowlingComponent>
public sealed partial class ShadowlingSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly ILightManager _light = default!;

[Dependency] private readonly IPrototypeManager _prototype = default!;
private readonly ProtoId<ShaderPrototype> _unshadedShaderProtoId = "unshaded";
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ShadowlingComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ShadowlingComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ShadowlingComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<ShadowlingComponent, ComponentShutdown>(OnShutdown);
}
SubscribeLocalEvent<ShadowlingComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);

private void OnStartup(EntityUid uid, ShadowlingComponent component, ref ComponentStartup ev)
{
if (_player.LocalSession == null)
return;
if (_player.LocalSession.AttachedEntity != uid)
return;

ToggleDarkVision(component, true);
// TODO: Использовать события ConvertedEvent, RevertedEvent. Сейчас они только на сервере.
SubscribeLocalEvent<ShadowlingThrallComponent, ComponentInit>(OnConverted);
SubscribeLocalEvent<ShadowlingThrallComponent, ComponentShutdown>(OnReverted);
}

private void OnPlayerAttached(EntityUid uid, ShadowlingComponent component, ref PlayerAttachedEvent ev)
private void OnGetStatusIconsEvent(EntityUid uid, ShadowlingComponent component, ref GetStatusIconsEvent args)
{
if (_player.LocalSession == null)
return;
if (_player.LocalSession.AttachedEntity != uid)
return;
if (ev.Entity != uid)
return;

ToggleDarkVision(component, true);
args.StatusIcons.Add(_prototype.Index(component.StatusIcon));
}

private void OnPlayerDetached(EntityUid uid, ShadowlingComponent component, ref PlayerDetachedEvent ev)
private void OnConverted(EntityUid uid, ShadowlingThrallComponent component, ComponentInit args)
{
if (_player.LocalSession?.AttachedEntity != null)
return;
if (ev.Entity != uid)
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;

ToggleDarkVision(component, false);
var sprite = Comp<SpriteComponent>(uid);
sprite.LayerSetShader(sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes), _prototype.Index(_unshadedShaderProtoId).Instance());
}

private void OnShutdown(EntityUid uid, ShadowlingComponent component, ref ComponentShutdown ev)
private void OnReverted(EntityUid uid, ShadowlingThrallComponent component, ComponentShutdown args)
{
if (_player.LocalSession == null)
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
if (_player.LocalSession.AttachedEntity != uid)
return;

ToggleDarkVision(component, false);
}

private void ToggleDarkVision(ShadowlingComponent component, bool newState)
{
if (newState)
{
_light.DrawShadows = false;
}
else
{
_light.DrawShadows = true;
}
var sprite = Comp<SpriteComponent>(uid);
sprite.LayerSetShader(sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes), (ShaderInstance?) null);
}
}

This file was deleted.

51 changes: 51 additions & 0 deletions Content.Client/Stories/ThermalVision/ThermalVisionOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Numerics;
using Content.Shared.Stories.ThermalVision;
using Content.Shared.Mobs.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

namespace Content.Client.Stories.ThermalVision;

public sealed class ThermalVisionOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entity = default!;
[Dependency] private readonly IEyeManager _eye = default!;
[Dependency] private readonly IPlayerManager _players = default!;

private readonly TransformSystem _transform;

public override OverlaySpace Space => OverlaySpace.ScreenSpace;

public ThermalVisionOverlay()
{
IoCManager.InjectDependencies(this);

_transform = _entity.System<TransformSystem>();
}

protected override void Draw(in OverlayDrawArgs args)
{
if (!_entity.TryGetComponent(_players.LocalEntity, out ThermalVisionComponent? nightVision) || !nightVision.Enabled)
return;

var eye = args.Viewport.Eye;
var eyeRot = eye?.Rotation ?? default;
var zoom = Vector2.One / (args.Viewport.Eye?.Zoom ?? Vector2.One);

var entities = _entity.EntityQueryEnumerator<MobStateComponent, SpriteComponent, TransformComponent>();
while (entities.MoveNext(out var uid, out _, out var sprite, out var xform))
{
if (xform.MapID != eye?.Position.MapId)
continue;

var position = _eye.CoordinatesToScreen(xform.Coordinates).Position;
if (!args.ViewportBounds.Contains((int) position.X, (int) position.Y))
continue;

var rotation = _transform.GetWorldRotation(xform);
args.ScreenHandle.DrawEntity(uid, position, Vector2.One * 2 * zoom, rotation + eyeRot, Angle.Zero, null, sprite, xform, _transform);
}
}
}
63 changes: 63 additions & 0 deletions Content.Client/Stories/ThermalVision/ThermalVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Content.Shared.Stories.ThermalVision;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Stories.ThermalVision;

public sealed class ThermalVisionSystem : SharedThermalVisionSystem
{
[Dependency] private readonly ILightManager _light = default!;
[Dependency] private readonly IOverlayManager _overlay = default!;
[Dependency] private readonly IPlayerManager _player = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ThermalVisionComponent, LocalPlayerAttachedEvent>(OnThermalVisionAttached);
SubscribeLocalEvent<ThermalVisionComponent, LocalPlayerDetachedEvent>(OnThermalVisionDetached);
}

private void OnThermalVisionAttached(Entity<ThermalVisionComponent> ent, ref LocalPlayerAttachedEvent args)
{
ThermalVisionChanged(ent);
}

private void OnThermalVisionDetached(Entity<ThermalVisionComponent> ent, ref LocalPlayerDetachedEvent args)
{
Off();
}

protected override void ThermalVisionChanged(Entity<ThermalVisionComponent> ent)
{
if (ent != _player.LocalEntity)
return;

if (ent.Comp.Enabled)
On();
else Off();
}

protected override void ThermalVisionRemoved(Entity<ThermalVisionComponent> ent)
{
if (ent != _player.LocalEntity)
return;

Off();
}

private void Off()
{
_overlay.RemoveOverlay(new ThermalVisionOverlay());
_light.DrawShadows = true;
_light.DrawLighting = true;
}

private void On()
{
_overlay.AddOverlay(new ThermalVisionOverlay());
_light.DrawShadows = false;
_light.DrawLighting = false;
}
}
15 changes: 15 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Content.Server.Stories.GameTicking.Rules.Components;

namespace Content.Server.Administration.Systems;

Expand Down Expand Up @@ -151,5 +152,19 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-verb-make-thief"),
};
args.Verbs.Add(thief);

Verb shadowling = new()
{
Text = Loc.GetString("admin-verb-text-make-shadowling"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("Stories/Mobs/Demons/shadowling.rsi"), "shadowling"),
Act = () =>
{
_antag.ForceMakeAntag<ShadowlingRuleComponent>(targetPlayer, "Shadowling");
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-shadowling"),
};
args.Verbs.Add(shadowling);
}
}
3 changes: 3 additions & 0 deletions Content.Server/Roles/RoleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server.Stories.Shadowling;
using Content.Shared.Roles;

namespace Content.Server.Roles;
Expand All @@ -18,6 +19,8 @@ public override void Initialize()
SubscribeAntagEvents<TraitorRoleComponent>();
SubscribeAntagEvents<ZombieRoleComponent>();
SubscribeAntagEvents<ThiefRoleComponent>();
SubscribeAntagEvents<ShadowlingRoleComponent>(); // Stories | Оффы просто гении. Роль антага делается прототипом, но
SubscribeAntagEvents<ShadowlingThrallRoleComponent>(); // Stories | , чтобы игра считала её антагом, нужно писать сюда код.
}

public string? MindGetBriefing(EntityUid? mindId)
Expand Down
Loading

0 comments on commit d09e416

Please sign in to comment.