Ideas

JustDadThings's avatar
JustDadThings
New Spectator
5 months ago

Portal: Consecutive mod function calls override previous calls

Describe the Issue Clearly

Certain actions require delays between calls.

For example, only the final call to `mod.EnableInputRestriction(player, mod.RestrictedInputs, true);` succeeds when called one after another (see repro). Adding `mod.Wait()` with a wait time of >=0.5s avoids the issue. When enabling/disabling several inputs, this can add up to a significant amount of time and therefore be useless e.g. player may shoot before this input is disabled.

If I am trying to disable movement (both axes), firing, jumping, crouching, reloading, switching to other weapons, and prone on player deployment, the last of these restrictions will not apply for 5+ seconds, at which point the player may have left the starting area.

Steps to Reproduce

Apply many input restrictions on player deployment. Note that, without the `mod.Wait()` calls, only the final input restriction is applied. With the `mod.Wait()` calls, it takes a long time for all restrictions to apply.

export async function OnPlayerDeployed(eventPlayer: mod.Player) {
  //await mod.Wait(0.5);
  mod.EnableInputRestriction(eventPlayer, mod.RestrictedInputs.FireWeapon, true);
  //await mod.Wait(0.5);
  mod.EnableInputRestriction(eventPlayer, mod.RestrictedInputs.Crouch, true);
  //await mod.Wait(0.5);
  mod.EnableInputRestriction(eventPlayer, mod.RestrictedInputs.MoveForwardBack, true);
  //await mod.Wait(0.5);
  mod.EnableInputRestriction(eventPlayer, mod.RestrictedInputs.MoveLeftRight, true);
}

Screenshots/Videos (if possible)

N/A

Information

Version 1.0.1.0 of the SDK.

1 Comment

  • Even a method overload that accepts multiple restrictions would suffice.

    export function EnableInputRestriction(player: Player, inputRestriction: Array, restrictInput: boolean): void;

     

Featured Places

Node avatar for Battlefield 6 Bug Reports

Battlefield 6 Bug Reports

Report bugs and see what the Battlefield 6 community is saying on this forum.Latest Activity: 13 days ago
9,541 Posts