Skip to content

Commit

Permalink
Merge branch 'xtray85:master' into tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkiich authored Mar 17, 2024
2 parents f7ffda4 + cf0dc06 commit 41f406d
Show file tree
Hide file tree
Showing 407 changed files with 20,038 additions and 804 deletions.
49 changes: 49 additions & 0 deletions Content.Client/ADT/ApathySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Drugs;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Content.Shared.Alert;
using Content.Client.UserInterface.Systems.DamageOverlays;
using Content.Shared.ADT;

namespace Content.Client.ADT;

public sealed class ApathySystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
public static string ApathyKey = "Apathy";

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

SubscribeLocalEvent<ApathyComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<ApathyComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ApathyComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ApathyComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

}

private void OnInit(EntityUid uid, ApathyComponent component, ComponentInit args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ShowAlert(uid, AlertType.ADTAlertApathy);
}

private void OnShutdown(EntityUid uid, ApathyComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ClearAlert(uid, AlertType.ADTAlertApathy);
}

private void OnPlayerAttached(EntityUid uid, ApathyComponent component, LocalPlayerAttachedEvent args)
{
_alertsSystem.ShowAlert(uid, AlertType.ADTAlertApathy);
}

private void OnPlayerDetached(EntityUid uid, ApathyComponent component, LocalPlayerDetachedEvent args)
{
_alertsSystem.ClearAlert(uid, AlertType.ADTAlertApathy);
}
}
81 changes: 81 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Content.Shared.Humanoid.Markings;
using Content.Shared.SlimeHair;
using Robust.Client.GameObjects;

namespace Content.Client.ADT.SlimeHair;

public sealed class SlimeHairBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private SlimeHairWindow? _window;

public SlimeHairBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_window = new();

_window.OnHairSelected += tuple => SelectHair(SlimeHairCategory.Hair, tuple.id, tuple.slot);
_window.OnHairColorChanged += args => ChangeColor(SlimeHairCategory.Hair, args.marking, args.slot);
_window.OnHairSlotAdded += delegate () { AddSlot(SlimeHairCategory.Hair); };
_window.OnHairSlotRemoved += args => RemoveSlot(SlimeHairCategory.Hair, args);

_window.OnFacialHairSelected += tuple => SelectHair(SlimeHairCategory.FacialHair, tuple.id, tuple.slot);
_window.OnFacialHairColorChanged +=
args => ChangeColor(SlimeHairCategory.FacialHair, args.marking, args.slot);
_window.OnFacialHairSlotAdded += delegate () { AddSlot(SlimeHairCategory.FacialHair); };
_window.OnFacialHairSlotRemoved += args => RemoveSlot(SlimeHairCategory.FacialHair, args);

_window.OnClose += Close;
_window.OpenCentered();
}

private void SelectHair(SlimeHairCategory category, string marking, int slot)
{
SendMessage(new SlimeHairSelectMessage(category, marking, slot));
}

private void ChangeColor(SlimeHairCategory category, Marking marking, int slot)
{
SendMessage(new SlimeHairChangeColorMessage(category, new(marking.MarkingColors), slot));
}

private void RemoveSlot(SlimeHairCategory category, int slot)
{
SendMessage(new SlimeHairRemoveSlotMessage(category, slot));
}

private void AddSlot(SlimeHairCategory category)
{
SendMessage(new SlimeHairAddSlotMessage(category));
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (state is not SlimeHairUiState data || _window == null)
{
return;
}

_window.UpdateState(data);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

if (_window != null)
_window.OnClose -= Close;

_window?.Dispose();
}
}

9 changes: 9 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:humanoid="clr-namespace:Content.Client.Humanoid"
Title="{Loc 'slime-hair-window-title'}"
MinSize="600 400">
<BoxContainer>
<humanoid:SingleMarkingPicker Name="HairPicker" Category="Hair" />
<humanoid:SingleMarkingPicker Name="FacialHairPicker" Category="FacialHair" />
</BoxContainer>
</DefaultWindow>
49 changes: 49 additions & 0 deletions Content.Client/ADT/SlimeHair/SlimeHairWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Humanoid.Markings;
using Content.Shared.SlimeHair;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.ADT.SlimeHair;

[GenerateTypedNameReferences]
public sealed partial class SlimeHairWindow : DefaultWindow
{
// MMMMMMM
public Action<(int slot, string id)>? OnHairSelected;
public Action<(int slot, Marking marking)>? OnHairColorChanged;
public Action<int>? OnHairSlotRemoved;
public Action? OnHairSlotAdded;

public Action<(int slot, string id)>? OnFacialHairSelected;
public Action<(int slot, Marking marking)>? OnFacialHairColorChanged;
public Action<int>? OnFacialHairSlotRemoved;
public Action? OnFacialHairSlotAdded;

public SlimeHairWindow()
{
RobustXamlLoader.Load(this);

HairPicker.OnMarkingSelect += args => OnHairSelected!(args);
HairPicker.OnColorChanged += args => OnHairColorChanged!(args);
HairPicker.OnSlotRemove += args => OnHairSlotRemoved!(args);
HairPicker.OnSlotAdd += delegate { OnHairSlotAdded!(); };

FacialHairPicker.OnMarkingSelect += args => OnFacialHairSelected!(args);
FacialHairPicker.OnColorChanged += args => OnFacialHairColorChanged!(args);
FacialHairPicker.OnSlotRemove += args => OnFacialHairSlotRemoved!(args);
FacialHairPicker.OnSlotAdd += delegate { OnFacialHairSlotAdded!(); };
}

public void UpdateState(SlimeHairUiState state)
{
HairPicker.UpdateData(state.Hair, state.Species, state.HairSlotTotal);
FacialHairPicker.UpdateData(state.FacialHair, state.Species, state.FacialHairSlotTotal);

if (!HairPicker.Visible && !FacialHairPicker.Visible)
{
AddChild(new Label { Text = Loc.GetString("magic-mirror-component-activate-user-has-no-hair") });
}
}
}
43 changes: 43 additions & 0 deletions Content.Server/ADT/Changeling/EntitySystems/ChangelingEggSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Content.Shared.Changeling.Components;
using Content.Server.Actions;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;

namespace Content.Server.Changeling.EntitySystems;

public sealed partial class ChangelingEggSystem : EntitySystem
{
[Dependency] private readonly ActionsSystem _action = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly EntityManager _entityManager = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;

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

SubscribeLocalEvent<LingEggsHolderComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<LingEggsHolderComponent, ComponentShutdown>(OnShutdown);

}
public ProtoId<DamageGroupPrototype> BruteDamageGroup = "Brute";
private void OnInit(EntityUid uid, LingEggsHolderComponent component, MapInitEvent args)
{
var damage_burn = new DamageSpecifier(_proto.Index(BruteDamageGroup), component.DamageAmount);
_damageableSystem.TryChangeDamage(uid, damage_burn); /// To be sure that target is dead
var newLing = EnsureComp<ChangelingComponent>(uid);
newLing.EggedBody = true; /// To make egged person into a ling
var selfMessage = Loc.GetString("changeling-eggs-inform");
_popup.PopupEntity(selfMessage, uid, uid, PopupType.LargeCaution); /// Popup
_action.AddAction(uid, ref component.ChangelingHatchActionEntity, component.ChangelingHatchAction);
}
private void OnShutdown(EntityUid uid, LingEggsHolderComponent component, ComponentShutdown args)
{
RemComp<ChangelingComponent>(uid);
_action.RemoveAction(uid, component.ChangelingHatchActionEntity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Content.Shared.Changeling.Components;
using Content.Shared.Changeling;
using Content.Shared.Inventory;
using Content.Server.Hands.Systems;
using Robust.Shared.Prototypes;
using Content.Server.Body.Systems;
using Content.Shared.Popups;
using Content.Shared.IdentityManagement;
using Robust.Shared.Audio.Systems;
using Content.Server.Emp;
using Content.Shared.DoAfter;
using Content.Shared.Humanoid;
using Content.Server.Fluids.EntitySystems;

namespace Content.Server.Changeling.EntitySystems;

public sealed partial class LingSlugSystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly EntityManager _entityManager = default!;

private void InitializeLingAbilities()
{
SubscribeLocalEvent<LingSlugComponent, LingEggActionEvent>(OnLayEggs);
SubscribeLocalEvent<LingSlugComponent, LingEggDoAfterEvent>(OnLayEggsDoAfter);
}

private void OnLayEggs(EntityUid uid, LingSlugComponent component, LingEggActionEvent args) /// TODO: Заменить на кладку яиц при ударе.
{
if (args.Handled)
return;

var target = args.Target;

if (!HasComp<HumanoidAppearanceComponent>(target))
{
var selfMessage = Loc.GetString("changeling-dna-fail-nohuman", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

if (!_mobState.IsIncapacitated(target)) // if target isn't crit or dead dont let absorb
{
var selfMessage = Loc.GetString("changeling-dna-fail-notdead", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

if (HasComp<AbsorbedComponent>(target))
{
var selfMessage = Loc.GetString("changeling-dna-alreadyabsorbed", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

if (_tagSystem.HasTag(target, "ChangelingBlacklist"))
{
var selfMessage = Loc.GetString("changeling-dna-sting-fail-nodna", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

if (LayEggs(uid, target, component))
{
args.Handled = true;

var selfMessage = Loc.GetString("changeling-eggs-self-start", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution);
}

}

private void OnLayEggsDoAfter(EntityUid uid, LingSlugComponent component, LingEggDoAfterEvent args)
{
if (args.Handled || args.Args.Target == null)
return;

args.Handled = true;
var target = args.Args.Target.Value;

if (args.Cancelled || !_mobState.IsIncapacitated(target) || HasComp<AbsorbedComponent>(target))
{
var selfMessage = Loc.GetString("changeling-eggs-interrupted");
_popup.PopupEntity(selfMessage, uid, uid);
return;
}

else
{
var holderComp = EnsureComp<LingEggsHolderComponent>(target);

var selfMessage = Loc.GetString("changeling-eggs-self-success", ("target", Identity.Entity(target, EntityManager)));
_popup.PopupEntity(selfMessage, uid, uid, PopupType.MediumCaution);

component.EggsLaid = true;
component.EggLing = target;

holderComp.ChangelingHatchAction = component.HatchAction;

_action.RemoveAction(uid, component.LayEggsActionEntity); /// Яйца откладываются только один раз

return;
}
}
}
Loading

0 comments on commit 41f406d

Please sign in to comment.