Skip to content

Commit

Permalink
Changelings playtest (Simple-Station#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
Verbalase authored and VMSolidus committed Aug 16, 2024
1 parent 08822e3 commit bea3366
Show file tree
Hide file tree
Showing 143 changed files with 3,635 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
<ItemGroup>
<EmbeddedResource Remove="goobstation\changeling\ui\TransformMenu.xaml" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Update="Goobstation\Changeling\UI\TransformMenu.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions Content.Client/Goobstation/Changeling/ChangelingSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Content.Client.Alerts;
using Content.Client.UserInterface.Systems.Alerts.Controls;
using Content.Shared.Changeling;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;

namespace Content.Client.Changeling;

public sealed partial class ChangelingSystem : EntitySystem
{

[Dependency] private readonly IPrototypeManager _prototype = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ChangelingComponent, UpdateAlertSpriteEvent>(OnUpdateAlert);
SubscribeLocalEvent<ChangelingComponent, GetStatusIconsEvent>(GetChanglingIcon);
}

private void OnUpdateAlert(EntityUid uid, ChangelingComponent comp, ref UpdateAlertSpriteEvent args)
{
if (args.Alert.AlertKey.AlertType != "Chemicals")
return;

var chemicalsNormalised = (int) (comp.Chemicals / comp.MaxChemicals * 16); // hardcoded because uhh umm
var sprite = args.SpriteViewEnt.Comp;
sprite.LayerSetState(AlertVisualLayers.Base, $"{chemicalsNormalised}");
}

private void GetChanglingIcon(Entity<ChangelingComponent> ent, ref GetStatusIconsEvent args)
{
if (HasComp<HivemindComponent>(ent) && _prototype.TryIndex(ent.Comp.StatusIcon, out var iconPrototype))
args.StatusIcons.Add(iconPrototype);
}
}
11 changes: 11 additions & 0 deletions Content.Client/Goobstation/Changeling/UI/TransformMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<ui:RadialMenu xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
BackButtonStyleClass="RadialMenuBackButton"
CloseButtonStyleClass="RadialMenuCloseButton"
VerticalExpand="True"
HorizontalExpand="True"
MinSize="450 450">

<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64"/>

</ui:RadialMenu>
26 changes: 26 additions & 0 deletions Content.Client/Goobstation/Changeling/UI/TransformMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Changeling.UI;

[GenerateTypedNameReferences]
public sealed partial class TransformMenu : RadialMenu
{
[Dependency] private readonly EntityManager _entity = default!;

private readonly SpriteSystem _sprite = default!;

public TransformMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

_sprite = _entity.System<SpriteSystem>();

var main = FindControl<RadialContainer>("Main");

// TODO: transform radial menu
}
}
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 @@ -132,5 +132,20 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-verb-make-thief"),
};
args.Verbs.Add(thief);

// Goobstation - changelings
Verb ling = new()
{
Text = Loc.GetString("admin-verb-text-make-changeling"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Goobstation/Changeling/changeling_abilities.rsi"), "transform"),
Act = () =>
{
_antag.ForceMakeAntag<ChangelingRuleComponent>(targetPlayer, "Changeling");
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-changeling"),
};
args.Verbs.Add(ling);
}
}
Loading

0 comments on commit bea3366

Please sign in to comment.