Skip to content

Commit

Permalink
changes to partners items & changes to lightsabers & rename namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Doublechest committed Aug 5, 2024
1 parent e20a8d0 commit d7ceb5e
Show file tree
Hide file tree
Showing 64 changed files with 349 additions and 245 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Stories/Empire/EmpireSystem.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Content.Shared.StatusIcon.Components;
using Content.Shared.StatusIcon;
using Robust.Shared.Prototypes;
using Content.Shared.SpaceStories.Empire.Components;
using Content.Shared.Stories.Empire.Components;

namespace Content.Client.SpaceStories.Empire;
namespace Content.Client.Stories.Empire;
public sealed class EmpireSystem : SharedStatusIconSystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Stories/Nightvision/NightvisionOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Content.Shared.SpaceStories.Nightvision;
using Content.Shared.Stories.Nightvision;

namespace Content.Client.SpaceStories.Nightvision;
namespace Content.Client.Stories.Nightvision;
public sealed class NightvisionOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Stories/Nightvision/NightvisionSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Content.Shared.SpaceStories.Nightvision;
using Content.Shared.Stories.Nightvision;
using Content.Shared.GameTicking;
using Robust.Shared.Player;

namespace Content.Client.SpaceStories.Nightvision;
namespace Content.Client.Stories.Nightvision;

public sealed class NightvisionSystem : EntitySystem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.SpaceStories.BlockMeleeAttack;
namespace Content.Server.Stories.BlockMeleeAttack;

/// <summary>
/// This component goes on an item that you want to use to block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Robust.Shared.Timing;
using Content.Shared.Item.ItemToggle.Components;

namespace Content.Server.SpaceStories.BlockMeleeAttack;
namespace Content.Server.Stories.BlockMeleeAttack;

public sealed partial class BlockMeleeAttackSystem : EntitySystem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Robust.Shared.Physics;

namespace Content.Server.SpaceStories.BlockMeleeAttack;
namespace Content.Server.Stories.BlockMeleeAttack;

[RegisterComponent]
public sealed partial class BlockMeleeAttackUserComponent : Component
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Stories/Empire/EmpireSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.SpaceStories.Empire.Components;
using Content.Shared.Stories.Empire.Components;
using Content.Shared.Stunnable;
using Content.Shared.Chat;
using Content.Shared.Mind;
Expand All @@ -12,7 +12,7 @@
using Robust.Shared.Audio;
using Content.Shared.Stories.Mindshield;

namespace Content.Server.SpaceStories.Empire;
namespace Content.Server.Stories.Empire;

public sealed class EmpireSystem : EntitySystem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Content.Server.SpaceStories.ForceUser.Components;
namespace Content.Server.Stories.ForceUser.Components;

[RegisterComponent]
public sealed partial class FrozeBulletsComponent : Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Content.Server.SpaceStories.ForceUser.Components;
namespace Content.Server.Stories.ForceUser.Components;

[RegisterComponent]
public sealed partial class PassiveGhostBooComponent : Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Robust.Shared.Prototypes;

namespace Content.Server.SpaceStories.ForceUser.Components;
namespace Content.Server.Stories.ForceUser.Components;

[RegisterComponent]
public sealed partial class SithGhostComponent : Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Content.Server.Objectives.Components;
using Content.Server.Roles;
using Content.Shared.Objectives.Components;
using Content.Shared.SpaceStories.Empire.Components;
using Content.Shared.Stories.Empire.Components;

namespace Content.Server.Objectives.Systems;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Robust.Shared.Map;
using System.Numerics;
using Content.Shared.DoAfter;
Expand All @@ -10,7 +10,7 @@
using Content.Shared.Damage;
using Robust.Shared.Random;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeSteal()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Robust.Shared.Map;
using System.Numerics;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeLightning()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Shared.Chemistry.Components;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Maps;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializePolymorph()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Shared.Chemistry.Components;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Maps;
using Content.Server.SpaceStories.ForceUser.ProtectiveBubble.Components;
using Content.Server.Stories.ForceUser.ProtectiveBubble.Components;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeProtectiveBubble()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Actions;
using Content.Shared.Popups;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Timing;
using Robust.Shared.Timing;
using Content.Shared.Throwing;
using Content.Shared.Weapons.Misc;
using Content.Server.SpaceStories.TetherGun;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.SpaceStories.PullTo;
using Content.Shared.SpaceStories.Force.LightSaber;
using Content.Server.Stories.TetherGun;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Shared.Stories.PullTo;
using Content.Shared.Stories.Force.Lightsaber;
using Content.Shared.Inventory.Events;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeRecallEquipment()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Actions;
using Content.Shared.Popups;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Timing;
using Robust.Shared.Timing;
using Content.Shared.Throwing;
using Content.Shared.Weapons.Misc;
using Content.Server.SpaceStories.TetherGun;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.SpaceStories.PullTo;
using Content.Shared.SpaceStories.Force.LightSaber;
using Content.Server.Stories.TetherGun;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Shared.Stories.PullTo;
using Content.Shared.Stories.Force.Lightsaber;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeRecall()
{
SubscribeLocalEvent<ForceUserComponent, RecallLightSaberEvent>(OnRecall);
SubscribeLocalEvent<LightSaberComponent, PulledToTimeOutEvent>(OnTimeOut);
SubscribeLocalEvent<ForceUserComponent, RecallLightsaberEvent>(OnRecall);
SubscribeLocalEvent<LightsaberComponent, PulledToTimeOutEvent>(OnTimeOut);
}
private void OnTimeOut(EntityUid uid, LightSaberComponent comp, PulledToTimeOutEvent args)
private void OnTimeOut(EntityUid uid, LightsaberComponent comp, PulledToTimeOutEvent args)
{
if (args.Handled || comp.LightSaberOwner != args.Component.PulledTo || args.Component.PulledTo == null)
if (args.Handled || comp.LightsaberOwner != args.Component.PulledTo || args.Component.PulledTo == null)
return;

_popup.PopupEntity(Loc.GetString(_hands.TryPickupAnyHand(args.Component.PulledTo.Value, uid) ? "Ваш световой меч телепортируется вам в руку!" : "ninja-hands-full"), args.Component.PulledTo.Value, args.Component.PulledTo.Value);
}
private void OnRecall(EntityUid uid, ForceUserComponent comp, RecallLightSaberEvent args)
private void OnRecall(EntityUid uid, ForceUserComponent comp, RecallLightsaberEvent args)
{
if (args.Handled || comp.LightSaber == null)
if (args.Handled || comp.Lightsaber == null)
return;

if (_container.IsEntityInContainer(comp.LightSaber.Value) && !_container.TryRemoveFromContainer(comp.LightSaber.Value))
if (_container.IsEntityInContainer(comp.Lightsaber.Value) && !_container.TryRemoveFromContainer(comp.Lightsaber.Value))
return;

if (TryComp<TetheredComponent>(comp.LightSaber.Value, out var tetheredComponent))
if (TryComp<TetheredComponent>(comp.Lightsaber.Value, out var tetheredComponent))
_tetherGunSystem.StopTether(tetheredComponent.Tetherer, EnsureComp<TetherGunComponent>(tetheredComponent.Tetherer));

_pullTo.TryPullTo(comp.LightSaber.Value, uid, PulledToOnEnter.PickUp, duration: 10f);
_pullTo.TryPullTo(comp.Lightsaber.Value, uid, PulledToOnEnter.PickUp, duration: 10f);

args.Handled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using Content.Shared.Standing;
using Content.Shared.Gravity;
using Content.Shared.Speech.Muting;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Shared.Movement.Components;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public const float DamageLimit = 100f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Weapons.Misc;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser.Actions.Events;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public const string HandTetherGunProto = "HandTetherGun";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Content.Shared.Cuffs.Components;
using Content.Shared.Mindshield.Components;
using Content.Shared.SpaceStories.ForceUser.Actions.Events;
using Content.Shared.Stories.ForceUser.Actions.Events;
using Content.Server.Store.Components;
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.Stories.ForceUser;
using Robust.Shared.Physics.Components;
using Content.Shared.Physics;
using Content.Shared.Mobs;
using Content.Shared.SpaceStories.Empire.Components;
using Content.Server.SpaceStories.ForceUser.ProtectiveBubble.Components;
using Content.Shared.Stories.Empire.Components;
using Content.Server.Stories.ForceUser.ProtectiveBubble.Components;
using Content.Shared.Store.Components;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeSimpleActions()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Content.Shared.Inventory.Events;
using Content.Shared.SpaceStories.ForceUser;
using Content.Shared.Stories.ForceUser;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;
using Content.Shared.Item;
using Content.Shared.Weapons.Misc;
using Content.Shared.SpaceStories.Force.LightSaber;
using Content.Shared.Stories.Force.Lightsaber;
using Content.Server.Weapons.Melee.EnergySword;
using Content.Server.SpaceStories.TetherGun;
using Content.Server.Stories.TetherGun;
using Content.Shared.Damage;
using Robust.Shared.Random;
using Content.Shared.Throwing;
Expand All @@ -15,38 +15,27 @@
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Physics;
using Content.Shared.Interaction;
using Content.Server.SpaceStories.ForceUser;
using Content.Server.Stories.ForceUser;
using Content.Shared.Verbs;
using Content.Shared.Stories.ForceUser.Actions.Events;

namespace Content.Server.SpaceStories.ForceUser;
namespace Content.Server.Stories.ForceUser;
public sealed partial class ForceUserSystem
{
public void InitializeLightSaber()
public void InitializeLightsaber()
{
SubscribeLocalEvent<LightSaberComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<LightSaberComponent, ItemToggleActivateAttemptEvent>(OnActivateAttempt);
SubscribeLocalEvent<LightSaberComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<LightSaberComponent, GettingPickedUpAttemptEvent>(OnTryPickUp);
SubscribeLocalEvent<LightsaberComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<LightsaberComponent, ItemToggleActivateAttemptEvent>(OnActivateAttempt);
SubscribeLocalEvent<LightsaberComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<LightsaberComponent, GettingPickedUpAttemptEvent>(OnTryPickUp);
}
private void OnEquipped(EntityUid uid, LightSaberComponent comp, GotEquippedEvent args)
private void OnEquipped(EntityUid uid, LightsaberComponent comp, GotEquippedEvent args)
{
if (!TryComp<ForceUserComponent>(args.Equipee, out var force) || force.LightSaber != null)
if (!TryComp<ForceUserComponent>(args.Equipee, out var force) || force.Lightsaber != null)
return;
BindLightSaber(args.Equipee, uid, force);
BindLightsaber(args.Equipee, uid, force);
}
public void UpdateLightSaber(float frameTime)
{
var query = EntityQueryEnumerator<LightSaberComponent>();
while (query.MoveNext(out var uid, out var comp))
{
//FIXME: Это дерьмо реально вызывает лаги.
if (comp.LightSaberOwner != null && !_interaction.InRangeUnobstructed(comp.LightSaberOwner.Value, _xform.GetMapCoordinates(uid), range: 10f))
{
_tetherGunSystem.StopTether(uid);
return;
}
}
}
private void OnDamage(EntityUid uid, LightSaberComponent component, DamageChangedEvent args)
private void OnDamage(EntityUid uid, LightsaberComponent component, DamageChangedEvent args)
{
if (!HasComp<TetheredComponent>(uid) || args.DamageDelta == null) return;
if (args.DamageDelta.GetTotal() <= 0) return;
Expand All @@ -64,17 +53,17 @@ private void OnDamage(EntityUid uid, LightSaberComponent component, DamageChange
if (args.Origin != uid && args.Origin != null)
_throwing.TryThrow(uid, _xform.GetWorldPosition(uid, GetEntityQuery<TransformComponent>()) - _xform.GetWorldPosition(Transform(args.Origin.Value), GetEntityQuery<TransformComponent>()), 10, uid, 0);
}
private void OnTryPickUp(EntityUid uid, LightSaberComponent component, GettingPickedUpAttemptEvent args)
private void OnTryPickUp(EntityUid uid, LightsaberComponent component, GettingPickedUpAttemptEvent args)
{
if (component.LightSaberOwner != null && args.User != component.LightSaberOwner && HasComp<TetheredComponent>(uid))
if (component.LightsaberOwner != null && args.User != component.LightsaberOwner && HasComp<TetheredComponent>(uid))
args.Cancel();

if (component.LightSaberOwner != args.User && _toggleSystem.IsActivated(uid))
if (component.LightsaberOwner != args.User && _toggleSystem.IsActivated(uid))
_toggleSystem.TryDeactivate(uid);
}
private void OnActivateAttempt(EntityUid uid, LightSaberComponent comp, ref ItemToggleActivateAttemptEvent args)
private void OnActivateAttempt(EntityUid uid, LightsaberComponent comp, ref ItemToggleActivateAttemptEvent args)
{
if (comp.LightSaberOwner != args.User) // TODO: Черт, как его включить, если меня клонировали?
if (comp.LightsaberOwner != args.User) // TODO: Черт, как его включить, если меня клонировали?
args.Cancelled = true;
}
}
Loading

0 comments on commit d7ceb5e

Please sign in to comment.