# Conflicts: # Content.Client/Construction/UI/ConstructionMenu.xaml # Content.Client/Construction/UI/ConstructionMenu.xaml.cs # Content.Client/Construction/UI/ConstructionMenuPresenter.cs # Content.Server/Warps/WarpPointSystem.cs # Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs # Content.Server/Weapons/Ranged/Systems/GunSystem.cs # Content.Shared/Construction/Steps/ArbitraryInsertConstructionGraphStep.cs # Content.Shared/Construction/Steps/MaterialConstructionGraphStep.cs # Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs # Content.Shared/Inventory/InventorySystem.Relay.cs # Content.Shared/Weapons/Reflect/ReflectSystem.cs # Resources/Locale/en-US/_strings/plants/mutations.ftl # Resources/Locale/en-US/_strings/stack/stacks.ftl # Resources/Locale/en-US/_strings/teleportation/teleportation-menu-gui.ftl # Resources/Prototypes/Catalog/Fills/Backpacks/duffelbag.yml # Resources/Prototypes/Catalog/Fills/Lockers/heads.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/winterdrobe.yml # Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml # Resources/Prototypes/Entities/Objects/Power/powercells.yml # Resources/Prototypes/Entities/Objects/Specific/Cargo/cargo_pallet.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml # Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml # Resources/Prototypes/Entities/Stations/base.yml # Resources/Prototypes/Entities/Structures/Machines/nuke.yml # Resources/Prototypes/Reagents/toxins.yml # Resources/Prototypes/Recipes/Construction/Graphs/clothing/clown_banana.yml # Resources/Prototypes/Recipes/Construction/Graphs/machines/computer.yml # Resources/Prototypes/Recipes/Construction/Graphs/mechs/hamtr_construction.yml # Resources/Prototypes/Recipes/Construction/Graphs/mechs/honker_construction.yml # Resources/Prototypes/Recipes/Construction/Graphs/mechs/ripley_construction.yml # Resources/Prototypes/Recipes/Construction/Graphs/mechs/vim_construction.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock_clockwork.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/blast_door.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/conveyor.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/firelock.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/glassbox.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/secretdoor.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/shutter.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/shuttle.yml # Resources/Prototypes/Recipes/Construction/Graphs/structures/windoor.yml # Resources/Prototypes/Recipes/Construction/Graphs/tools/logic_gate.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/APC.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/air_alarms.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_machines.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/intercom.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/lighting.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/solarpanel.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/station_maps.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_generator.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/wallmount_substation.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/bladed_hats.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/bola.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/improvised_arrow.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/modular_grenade.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/modular_mine.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/shiv.yml # Resources/Prototypes/Recipes/Construction/Graphs/weapons/spear.yml # Resources/Prototypes/Recipes/Construction/structures.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/cleanbot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/firebot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/honkbot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/medibot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/mimebot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/bots/supplybot.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/firebomb.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/improvised_shotgun.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/improvised_shotgun_shell.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/makeshiftstunprod.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/pipebomb.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/pneumatic_cannon.yml # Resources/Prototypes/Recipes/Crafting/Graphs/improvised/potato.yml # Resources/Prototypes/Recipes/Crafting/Graphs/storage/cratefreezer.yml # Resources/Prototypes/Recipes/Crafting/Graphs/storage/tallbox.yml # Resources/Prototypes/Recipes/Crafting/Graphs/strawhat.yml # Resources/Prototypes/Recipes/Crafting/Graphs/toys.yml # Resources/Prototypes/Recipes/Crafting/improvised.yml # Resources/Prototypes/Recipes/Reactions/medicine.yml # Resources/Prototypes/Roles/Jobs/CentComm/official.yml # Resources/Textures/Clothing/Neck/mantles/cemantle.rsi/equipped-NECK.png # Resources/Textures/Clothing/Neck/mantles/cemantle.rsi/icon.png # Resources/Textures/Clothing/Neck/mantles/cemantle.rsi/meta.json # Resources/Textures/Clothing/Uniforms/Jumpskirt/mime.rsi/equipped-INNERCLOTHING.png # Resources/Textures/Clothing/Uniforms/Jumpskirt/mime.rsi/icon.png # Resources/Textures/Clothing/Uniforms/Jumpskirt/mime.rsi/inhand-left.png # Resources/Textures/Clothing/Uniforms/Jumpskirt/mime.rsi/inhand-right.png # Resources/Textures/Clothing/Uniforms/Jumpskirt/mime.rsi/meta.json # Resources/Textures/Clothing/Uniforms/Jumpsuit/mime.rsi/equipped-INNERCLOTHING.png # Resources/Textures/Clothing/Uniforms/Jumpsuit/mime.rsi/icon.png # Resources/Textures/Clothing/Uniforms/Jumpsuit/mime.rsi/inhand-left.png # Resources/Textures/Clothing/Uniforms/Jumpsuit/mime.rsi/inhand-right.png # Resources/Textures/Clothing/Uniforms/Jumpsuit/mime.rsi/meta.json
63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using Content.Shared.Hands;
|
|
using Content.Shared.Interaction.Components;
|
|
using Content.Shared.Interaction.Events;
|
|
using Content.Shared.Item;
|
|
using Content.Shared.Movement.Components;
|
|
using Content.Shared.Movement.Events;
|
|
|
|
namespace Content.Shared.Interaction;
|
|
|
|
// TODO deduplicate with AdminFrozenComponent
|
|
/// <summary>
|
|
/// Handles <see cref="BlockMovementComponent"/>, which prevents various
|
|
/// kinds of movement and interactions when attached to an entity.
|
|
/// </summary>
|
|
public partial class SharedInteractionSystem
|
|
{
|
|
private void InitializeBlocking()
|
|
{
|
|
SubscribeLocalEvent<BlockMovementComponent, UpdateCanMoveEvent>(OnMoveAttempt);
|
|
SubscribeLocalEvent<BlockMovementComponent, UseAttemptEvent>(CancelEvent);
|
|
SubscribeLocalEvent<BlockMovementComponent, InteractionAttemptEvent>(CancelInteractEvent);
|
|
SubscribeLocalEvent<BlockMovementComponent, DropAttemptEvent>(CancelEvent);
|
|
SubscribeLocalEvent<BlockMovementComponent, PickupAttemptEvent>(CancelEvent);
|
|
SubscribeLocalEvent<BlockMovementComponent, ChangeDirectionAttemptEvent>(CancelEvent);
|
|
|
|
SubscribeLocalEvent<BlockMovementComponent, ComponentStartup>(OnBlockingStartup);
|
|
SubscribeLocalEvent<BlockMovementComponent, ComponentShutdown>(OnBlockingShutdown);
|
|
}
|
|
|
|
private void CancelInteractEvent(Entity<BlockMovementComponent> ent, ref InteractionAttemptEvent args)
|
|
{
|
|
if (ent.Comp.BlockInteraction)
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
private void OnMoveAttempt(EntityUid uid, BlockMovementComponent component, UpdateCanMoveEvent args)
|
|
{
|
|
// If we're relaying then don't cancel.
|
|
if (HasComp<RelayInputMoverComponent>(uid))
|
|
return;
|
|
|
|
args.Cancel(); // no more scurrying around
|
|
}
|
|
|
|
private void CancelEvent(EntityUid uid, BlockMovementComponent component, CancellableEntityEventArgs args)
|
|
{
|
|
// Sunrise-Start
|
|
if (component.BlockInteraction)
|
|
args.Cancel();
|
|
// Sunrise-End
|
|
}
|
|
|
|
private void OnBlockingStartup(EntityUid uid, BlockMovementComponent component, ComponentStartup args)
|
|
{
|
|
_actionBlockerSystem.UpdateCanMove(uid);
|
|
}
|
|
|
|
private void OnBlockingShutdown(EntityUid uid, BlockMovementComponent component, ComponentShutdown args)
|
|
{
|
|
_actionBlockerSystem.UpdateCanMove(uid);
|
|
}
|
|
}
|
|
|