CommandQueue method annotations
This commit is contained in:
parent
76a057943b
commit
708f11c0f4
2 changed files with 4 additions and 4 deletions
|
@ -33,7 +33,7 @@ func _init() -> void:
|
||||||
command_queue[side] = arr
|
command_queue[side] = arr
|
||||||
|
|
||||||
## Add command to queue and signal about it
|
## Add command to queue and signal about it
|
||||||
func push(commands: Array[CommandQueue.Command], sides: Array[CommandQueue.Side]):
|
func push(commands: Array[CommandQueue.Command], sides: Array[CommandQueue.Side]) -> void:
|
||||||
assert(sides.size() == Side.size())
|
assert(sides.size() == Side.size())
|
||||||
|
|
||||||
for i in range(commands.size()):
|
for i in range(commands.size()):
|
||||||
|
@ -41,7 +41,7 @@ func push(commands: Array[CommandQueue.Command], sides: Array[CommandQueue.Side]
|
||||||
command_pushed.emit(sides, commands)
|
command_pushed.emit(sides, commands)
|
||||||
|
|
||||||
## Remove first command from queue and signal about it
|
## Remove first command from queue and signal about it
|
||||||
func pop():
|
func pop() -> void:
|
||||||
# Checking if stack is actually empty (arrays must have same size)
|
# Checking if stack is actually empty (arrays must have same size)
|
||||||
if command_queue[Side.LEFT].size() == 0:
|
if command_queue[Side.LEFT].size() == 0:
|
||||||
return
|
return
|
||||||
|
@ -50,7 +50,7 @@ func pop():
|
||||||
commands.push_back(command_queue[side].pop_front())
|
commands.push_back(command_queue[side].pop_front())
|
||||||
command_popped.emit(commands)
|
command_popped.emit(commands)
|
||||||
|
|
||||||
func current_command(side: CommandQueue.Side):
|
func current_command(side: CommandQueue.Side) -> CommandQueue.Command:
|
||||||
if command_queue[side].is_empty():
|
if command_queue[side].is_empty():
|
||||||
return DEFAULT_COMMAND
|
return DEFAULT_COMMAND
|
||||||
var command = command_queue[side].front()
|
var command = command_queue[side].front()
|
||||||
|
|
|
@ -14,7 +14,7 @@ var queue: CommandQueue = CommandQueue.new()
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
queue.command_pushed.connect(on_queue_command_pushed)
|
queue.command_pushed.connect(on_queue_command_pushed)
|
||||||
queue.command_popped.connect(on_queue_command_popped)
|
queue.command_popped.connect(on_queue_command_popped)
|
||||||
weapon_player.current_animation = "static"
|
weapon_player.play("static")
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue