Skip to content

NetworkWeapon.fire() is not within Inputs. #253

@TheYellowArchitect

Description

@TheYellowArchitect
#The below function is located Inside brawler scene, on the Weapon node
func _tick(_delta: float, _t: int):
	if input.is_firing:
		fire()

The function fire() directly changes state as it spawns a bomb projectile with velocity etc, yet the above function is exclusively a local input - it isn't shared to other players via RPCs, nor is it rollbacked.
This is a design flaw.

Especially noticeable if a replay manager is to be implemented, because this forces to capture all states, instead of all inputs and the very first state.

There are 2 ways to solve this problem:

  1. fire() changes the state (same as current implementation), but also becomes a dictionary key to _inputs
    I would suggest this key becoming button_pressed and its value to be an integer, so there can be mapped any amount of input buttons, for the same dictionary key. E.g. if there are 2 weapons to use, or more, this handles them all finely, with the condition that only 1 button can be pressed each tick (so you cannot fire both weapons at the same tick, the next weapon fire is queued for the next tick)

  2. fire() changes the input directly, and the input itself is checked to spawn the bomb projectile. No idea if this will create bugs on existing code (by having the projectile spawn by state AND input, idk if there are proper checks already)
    ^This is already half-implemented, as the input is changed, it just isn't passed into _inputs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions