Recent weapon
This commit is contained in:
parent
3a4e0f30bf
commit
f234ca974e
4 changed files with 15 additions and 1 deletions
|
|
@ -8,4 +8,3 @@ func _ready() -> void:
|
||||||
|
|
||||||
func update_version(version: StringName):
|
func update_version(version: StringName):
|
||||||
text = "Текущая версия игры: " + preload("res://version.tres").version + "\n" + version
|
text = "Текущая версия игры: " + preload("res://version.tres").version + "\n" + version
|
||||||
print(text)
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ signal walk_begin
|
||||||
signal walk_end
|
signal walk_end
|
||||||
signal interact_begin
|
signal interact_begin
|
||||||
signal interact_end
|
signal interact_end
|
||||||
|
signal recent_weapon
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if not is_multiplayer_authority(): return
|
if not is_multiplayer_authority(): return
|
||||||
|
|
@ -111,6 +112,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("plr_jump"):
|
if event.is_action_pressed("plr_jump"):
|
||||||
jump_on_server.rpc_id(1)
|
jump_on_server.rpc_id(1)
|
||||||
|
|
||||||
|
if event.is_action_pressed("plr_recent_weapon"):
|
||||||
|
recent_weapon_on_server.rpc_id(1)
|
||||||
|
|
||||||
@rpc("authority","call_local","reliable")
|
@rpc("authority","call_local","reliable")
|
||||||
func switch_on_server(slot: StringName) -> void:
|
func switch_on_server(slot: StringName) -> void:
|
||||||
if not multiplayer.is_server(): return
|
if not multiplayer.is_server(): return
|
||||||
|
|
@ -180,3 +184,8 @@ func interact_on_server(end: bool) -> void:
|
||||||
func jump_on_server() -> void:
|
func jump_on_server() -> void:
|
||||||
if not multiplayer.is_server(): return
|
if not multiplayer.is_server(): return
|
||||||
jumped.emit()
|
jumped.emit()
|
||||||
|
|
||||||
|
@rpc("authority","call_local","reliable")
|
||||||
|
func recent_weapon_on_server() -> void:
|
||||||
|
if not multiplayer.is_server(): return
|
||||||
|
recent_weapon.emit()
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,11 @@ menu_scoretable={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
plr_recent_weapon={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ func _ready() -> void:
|
||||||
player_input.switch_weapon.connect(switch)
|
player_input.switch_weapon.connect(switch)
|
||||||
player_input.alternate_state.connect(alternate_state)
|
player_input.alternate_state.connect(alternate_state)
|
||||||
player_input.switch_firemode.connect(switch_mode)
|
player_input.switch_firemode.connect(switch_mode)
|
||||||
|
player_input.recent_weapon.connect(return_to_previous)
|
||||||
|
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue