Skip to content

Commit

Permalink
Merge branch 'bug-fixing' of https://github.com/sleepyyapril/Einstein…
Browse files Browse the repository at this point in the history
…-Engines into bug-fixing
  • Loading branch information
sleepyyapril authored and sleepyyapril committed Nov 20, 2024
2 parents 94571ae + eb9c19b commit 8cfb2b2
Show file tree
Hide file tree
Showing 73 changed files with 327 additions and 168 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Guidebook/GuidebookSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControl

public void FakeClientActivateInWorld(EntityUid activated)
{
var activateMsg = new ActivateInWorldEvent(GetGuidebookUser(), activated);
var activateMsg = new ActivateInWorldEvent(GetGuidebookUser(), activated, true);
RaiseLocalEvent(activated, activateMsg);
}

Expand Down
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public sealed partial class BuckleTest
components:
- type: Buckle
- type: Hands
- type: ComplexInteraction
- type: InputMover
- type: Body
prototype: Human
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed class HandCuffTest
components:
- type: Cuffable
- type: Hands
- type: ComplexInteraction
- type: Body
prototype: Human
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components;
using Content.Shared.Item;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
Expand Down Expand Up @@ -60,6 +61,7 @@ await server.WaitAssertion(() =>
{
user = sEntities.SpawnEntity(null, coords);
sEntities.EnsureComponent<HandsComponent>(user);
sEntities.EnsureComponent<ComplexInteractionComponent>(user);
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, coords);
item = sEntities.SpawnEntity(null, coords);
Expand Down Expand Up @@ -193,6 +195,7 @@ await server.WaitAssertion(() =>
{
user = sEntities.SpawnEntity(null, coords);
sEntities.EnsureComponent<HandsComponent>(user);
sEntities.EnsureComponent<ComplexInteractionComponent>(user);
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange - 0.1f, 0), mapId));
item = sEntities.SpawnEntity(null, coords);
Expand Down Expand Up @@ -327,6 +330,7 @@ await server.WaitAssertion(() =>
{
user = sEntities.SpawnEntity(null, coords);
sEntities.EnsureComponent<HandsComponent>(user);
sEntities.EnsureComponent<ComplexInteractionComponent>(user);
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, coords);
item = sEntities.SpawnEntity(null, coords);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public abstract partial class InteractionTest
prototype: Aghost
- type: DoAfter
- type: Hands
- type: ComplexInteraction
- type: MindContainer
- type: Stripping
- type: Puller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public sealed class VendingMachineRestockTest : EntitySystem
id: HumanVendingDummy
components:
- type: Hands
- type: ComplexInteraction
- type: Body
prototype: Human
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Actions/ActionOnInteractSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void OnMapInit(EntityUid uid, ActionOnInteractComponent component, MapIn

private void OnActivate(EntityUid uid, ActionOnInteractComponent component, ActivateInWorldEvent args)
{
if (args.Handled)
if (args.Handled || !args.Complex)
return;

if (component.ActionEntities is not {} actionEnts)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void OnInteractUsing(EntityUid uid, FlammableComponent flammable, Intera

private void OnExtinguishActivateInWorld(EntityUid uid, ExtinguishOnInteractComponent component, ActivateInWorldEvent args)
{
if (args.Handled)
if (args.Handled || !args.Complex)
return;

if (!TryComp(uid, out FlammableComponent? flammable))
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ private void OnShutdown(EntityUid uid, AirAlarmComponent component, ComponentShu

private void OnActivate(EntityUid uid, AirAlarmComponent component, ActivateInWorldEvent args)
{
if (!args.Complex)
return;

if (TryComp<WiresPanelComponent>(uid, out var panel) && panel.Open)
{
args.Handled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump,

private void OnPumpActivate(EntityUid uid, GasPressurePumpComponent pump, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ private void OnStartup(EntityUid uid, GasValveComponent component, ComponentStar

private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

Toggle(uid, component);
_audio.PlayPvs(component.ValveSound, uid, AudioParams.Default.WithVariation(0.25f));
args.Handled = true;
}

public void Set(EntityUid uid, GasValveComponent component, bool value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ private void OnVolumePumpLeaveAtmosphere(EntityUid uid, GasVolumePumpComponent p

private void OnPumpActivate(EntityUid uid, GasVolumePumpComponent pump, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ private void OnFilterLeaveAtmosphere(EntityUid uid, GasFilterComponent filter, r

private void OnFilterActivate(EntityUid uid, GasFilterComponent filter, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ private void OnMixerLeaveAtmosphere(EntityUid uid, GasMixerComponent mixer, ref

private void OnMixerActivate(EntityUid uid, GasMixerComponent mixer, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ private void OnCanisterUpdated(EntityUid uid, GasCanisterComponent canister, ref

private void OnCanisterActivate(EntityUid uid, GasCanisterComponent component, ActivateInWorldEvent args)
{
if (!args.Complex)
return;

if (!TryComp<ActorComponent>(args.User, out var actor))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ private void OnMapInit(EntityUid uid, GasOutletInjectorComponent component, MapI

private void OnActivate(EntityUid uid, GasOutletInjectorComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

component.Enabled = !component.Enabled;
UpdateAppearance(uid, component);
args.Handled = true;
}

public void UpdateAppearance(EntityUid uid, GasOutletInjectorComponent component, AppearanceComponent? appearance = null)
Expand Down
19 changes: 9 additions & 10 deletions Content.Server/CardboardBox/CardboardBoxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public override void Initialize()
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed);
SubscribeLocalEvent<CardboardBoxComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
SubscribeLocalEvent<CardboardBoxComponent, ActivateInWorldEvent>(OnInteracted);
SubscribeLocalEvent<CardboardBoxComponent, InteractedNoHandEvent>(OnNoHandInteracted);
SubscribeLocalEvent<CardboardBoxComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
SubscribeLocalEvent<CardboardBoxComponent, EntRemovedFromContainerMessage>(OnEntRemoved);

Expand All @@ -45,9 +44,18 @@ public override void Initialize()

private void OnInteracted(EntityUid uid, CardboardBoxComponent component, ActivateInWorldEvent args)
{
if (args.Handled)
return;

if (!TryComp<EntityStorageComponent>(uid, out var box))
return;

if (!args.Complex)
{
if (box.Open || !box.Contents.Contains(args.User))
return;
}

args.Handled = true;
_storage.ToggleOpen(args.User, uid, box);

Expand All @@ -58,15 +66,6 @@ private void OnInteracted(EntityUid uid, CardboardBoxComponent component, Activa
}
}

private void OnNoHandInteracted(EntityUid uid, CardboardBoxComponent component, InteractedNoHandEvent args)
{
//Free the mice please
if (!TryComp<EntityStorageComponent>(uid, out var box) || box.Open || !box.Contents.Contains(args.User))
return;

_storage.OpenStorage(uid);
}

private void OnGetAdditionalAccess(EntityUid uid, CardboardBoxComponent component, ref GetAdditionalAccessEvent args)
{
if (component.Mover == null)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void OnInit(EntityUid uid, SignalSwitchComponent comp, ComponentInit arg

private void OnActivated(EntityUid uid, SignalSwitchComponent comp, ActivateInWorldEvent args)
{
if (args.Handled)
if (args.Handled || !args.Complex)
return;

comp.State = !comp.State;
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Disposal/Mailing/MailingUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ private void OnConfigurationUpdated(EntityUid uid, MailingUnitComponent componen

private void HandleActivate(EntityUid uid, MailingUnitComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public void ToggleEngage(EntityUid uid, SharedDisposalUnitComponent component)

private void OnActivate(EntityUid uid, SharedDisposalUnitComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (!TryComp(args.User, out ActorComponent? actor))
{
return;
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Doors/Systems/AirlockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ private void OnPowerChanged(EntityUid uid, AirlockComponent component, ref Power

private void OnActivate(EntityUid uid, AirlockComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

if (TryComp<WiresPanelComponent>(uid, out var panel) &&
panel.Open &&
TryComp<ActorComponent>(args.User, out var actor))
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ private void OnSpawnTriggered(EntityUid uid, TriggerOnSpawnComponent component,

private void OnActivate(EntityUid uid, TriggerOnActivateComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

Trigger(uid, args.User);
args.Handled = true;
}
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void Initialize()
base.Initialize();
SubscribeLocalEvent<AbsorbentComponent, ComponentInit>(OnAbsorbentInit);
SubscribeLocalEvent<AbsorbentComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<AbsorbentComponent, InteractNoHandEvent>(OnInteractNoHand);
SubscribeLocalEvent<AbsorbentComponent, UserActivateInWorldEvent>(OnActivateInWorld);
SubscribeLocalEvent<AbsorbentComponent, SolutionContainerChangedEvent>(OnAbsorbentSolutionChange);
}

Expand Down Expand Up @@ -85,12 +85,12 @@ private void UpdateAbsorbent(EntityUid uid, AbsorbentComponent component)
Dirty(uid, component);
}

private void OnInteractNoHand(EntityUid uid, AbsorbentComponent component, InteractNoHandEvent args)
private void OnActivateInWorld(EntityUid uid, AbsorbentComponent component, UserActivateInWorldEvent args)
{
if (args.Handled || args.Target == null)
if (args.Handled)
return;

Mop(uid, args.Target.Value, uid, component);
Mop(uid, args.Target, uid, component);
args.Handled = true;
}

Expand Down
8 changes: 6 additions & 2 deletions Content.Server/Gatherable/GatherableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ private void OnAttacked(EntityUid uid, GatherableComponent component, AttackedEv

private void OnActivate(EntityUid uid, GatherableComponent component, ActivateInWorldEvent args)
{
if (component.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
if (args.Handled || !args.Complex)
return;

Gather(uid, args.User, component);
if (gatherable.Comp.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
return;

Gather(gatherable, args.User);
args.Handled = true;
}

public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null)
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Interaction/InteractionPopupSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public override void Initialize()

private void OnActivateInWorld(EntityUid uid, InteractionPopupComponent component, ActivateInWorldEvent args)
{
if (!args.Complex)
return;

if (!component.OnActivate)
return;

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Light/EntitySystems/HandheldLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void OnRemove(Entity<HandheldLightComponent> ent, ref ComponentRemove ar

private void OnActivate(Entity<HandheldLightComponent> ent, ref ActivateInWorldEvent args)
{
if (args.Handled || !ent.Comp.ToggleOnInteract)
if (args.Handled || !args.Complex || !ent.Comp.ToggleOnInteract)
return;

if (ToggleStatus(args.User, ent))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override void Initialize()
SubscribeLocalEvent<MechGrabberComponent, MechEquipmentRemovedEvent>(OnEquipmentRemoved);
SubscribeLocalEvent<MechGrabberComponent, AttemptRemoveMechEquipmentEvent>(OnAttemptRemove);

SubscribeLocalEvent<MechGrabberComponent, InteractNoHandEvent>(OnInteract);
SubscribeLocalEvent<MechGrabberComponent, UserActivateInWorldEvent>(OnInteract);
SubscribeLocalEvent<MechGrabberComponent, GrabberDoAfterEvent>(OnMechGrab);
}

Expand Down Expand Up @@ -124,10 +124,11 @@ private void OnUiStateReady(EntityUid uid, MechGrabberComponent component, MechE
args.States.Add(GetNetEntity(uid), state);
}

private void OnInteract(EntityUid uid, MechGrabberComponent component, InteractNoHandEvent args)
private void OnInteract(EntityUid uid, MechGrabberComponent component, UserActivateInWorldEvent args)
{
if (args.Handled || args.Target is not {} target)
if (args.Handled)
return;
var target = args.Target;

if (args.Target == args.User || component.DoAfter != null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private void InitializeCigars()

private void OnCigarActivatedEvent(Entity<CigarComponent> entity, ref ActivateInWorldEvent args)
{
if (args.Handled)
if (args.Handled || !args.Complex)
return;

if (!EntityManager.TryGetComponent(entity, out SmokableComponent? smokable))
Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Pinpointer/PinpointerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ private void UpdateAppearance(EntityUid uid, PinpointerComponent pinpointer, App

private void OnActivate(EntityUid uid, PinpointerComponent component, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

TogglePinpointer(uid, component);

if (!component.CanRetarget)
LocateTarget(uid, component);

args.Handled = true;
}

private void OnLocateTarget(ref FTLCompletedEvent ev)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Radiation/Systems/GeigerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void Initialize()

private void OnActivate(Entity<GeigerComponent> geiger, ref ActivateInWorldEvent args)
{
if (args.Handled || geiger.Comp.AttachedToSuit)
if (args.Handled || !args.Complex || geiger.Comp.AttachedToSuit)
return;
args.Handled = true;

Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Radio/EntitySystems/JammerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public override void Update(float frameTime)

private void OnActivate(EntityUid uid, RadioJammerComponent comp, ActivateInWorldEvent args)
{
if (args.Handled || !args.Complex)
return;

var activated = !HasComp<ActiveRadioJammerComponent>(uid) &&
_powerCell.TryGetBatteryFromSlot(uid, out var battery) &&
battery.CurrentCharge > GetCurrentWattage(comp);
Expand Down
Loading

0 comments on commit 8cfb2b2

Please sign in to comment.