Unitystation: There's no position validation when drag-and-dropping players into disposals

Created on 20 Jul 2020  路  2Comments  路  Source: unitystation/unitystation

Description

According to oksts2904#4959 on Discord, you can drag-and-drop anyone into disposals regardless of their position.
The only limitation is that the other player should stand still during the drag operation.
gif

Both current player and dragged player positions should be validated to be adjacent to the disposals bin before starting progress action.

Steps to Reproduce

Please enter the steps to reproduce the bug or behaviour:

  1. Join server with your friend or foe
  2. Click and drag his character and release when hovering nearest disposals bin
  3. Make sure they don't move until progress completes
High Bug Security

Most helpful comment

Hello I'd like to take on this task.

All 2 comments

Hello I'd like to take on this task.

pretty sure the fix is this:

                // Drag something and drop on disposal bin
        public bool WillInteract(MouseDrop interaction, NetworkSide side)
        {
            if (!DefaultWillInteract.Default(interaction, side)) return false;
            if(!Validations.IsInReach(interaction.Performer.RegisterTile(), interaction.UsedObject.RegisterTile(), false)) return false;

            return true;
        }

        // Drag something and drop on disposal bin
        public void ServerPerformInteraction(MouseDrop interaction)
        {
            if (interaction.UsedObject == null) return;
            if(!Validations.IsInReach(interaction.Performer.RegisterTile(), interaction.UsedObject.RegisterTile(), true)) return;
            if (!interaction.UsedObject.TryGetComponent<PlayerScript>(out var script)) return; // Test to see if player

            //Dont store player unless secured so they dont get stuck.
            if (!MachineSecured) return;
            StartStoringPlayer(interaction);
        }

The two validations for reach need to be added to the disposal bin script line 186, needs testing though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nuke-makes-games picture nuke-makes-games  路  6Comments

Ornias1993 picture Ornias1993  路  7Comments

Destrolaric picture Destrolaric  路  5Comments

Dropgunner picture Dropgunner  路  3Comments

DooblyNoobly picture DooblyNoobly  路  7Comments