Compare commits
2
Commits
5e4507ab24
...
def2925a43
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
def2925a43 | ||
|
|
4cb27f991e |
@@ -674,27 +674,37 @@ func server_receive_inputs(input_dir: Vector2, wish_dir: Vector3, jump: bool, ju
|
||||
func _physics_process(_delta: float) -> void:
|
||||
# Local client captures input and sends it
|
||||
if is_multiplayer_authority():
|
||||
var raw_input := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var forward := -global_transform.basis.z
|
||||
forward.y = 0.0
|
||||
forward = forward.normalized()
|
||||
var right := global_transform.basis.x
|
||||
right.y = 0.0
|
||||
right = right.normalized()
|
||||
var raw_input := Vector2.ZERO
|
||||
var input_jump := false
|
||||
var input_jump_just := false
|
||||
var input_crouch := false
|
||||
var input_dash := false
|
||||
var input_grapple := false
|
||||
var input_grapple_just := false
|
||||
var world_dir := Vector3.ZERO
|
||||
|
||||
var world_dir := (forward * (-raw_input.y) + right * raw_input.x)
|
||||
if world_dir.length_squared() > 1.0:
|
||||
world_dir = world_dir.normalized()
|
||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
raw_input = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var forward := -global_transform.basis.z
|
||||
forward.y = 0.0
|
||||
forward = forward.normalized()
|
||||
var right := global_transform.basis.x
|
||||
right.y = 0.0
|
||||
right = right.normalized()
|
||||
|
||||
var input_jump = Input.is_action_pressed("jump")
|
||||
var input_jump_just = Input.is_action_just_pressed("jump")
|
||||
var input_crouch = Input.is_action_pressed("crouch")
|
||||
var input_dash = Input.is_action_just_pressed("dash")
|
||||
var input_grapple = Input.is_action_pressed("grapple")
|
||||
var input_grapple_just = Input.is_action_just_pressed("grapple")
|
||||
world_dir = (forward * (-raw_input.y) + right * raw_input.x)
|
||||
if world_dir.length_squared() > 1.0:
|
||||
world_dir = world_dir.normalized()
|
||||
|
||||
if Input.is_action_just_pressed("toggle_flashlight") and is_instance_valid(flashlight):
|
||||
flashlight.visible = !flashlight.visible
|
||||
input_jump = Input.is_action_pressed("jump")
|
||||
input_jump_just = Input.is_action_just_pressed("jump")
|
||||
input_crouch = Input.is_action_pressed("crouch")
|
||||
input_dash = Input.is_action_just_pressed("dash")
|
||||
input_grapple = Input.is_action_pressed("grapple")
|
||||
input_grapple_just = Input.is_action_just_pressed("grapple")
|
||||
|
||||
if Input.is_action_just_pressed("toggle_flashlight") and is_instance_valid(flashlight):
|
||||
flashlight.visible = !flashlight.visible
|
||||
|
||||
server_receive_inputs.rpc_id(1, raw_input, world_dir, input_jump, input_jump_just, input_crouch, input_dash, input_grapple, input_grapple_just)
|
||||
|
||||
|
||||
+8
-4
@@ -271,14 +271,16 @@ func _build_ui() -> void:
|
||||
var user_save = Button.new()
|
||||
user_save.text = "Save"
|
||||
user_save.pressed.connect(func():
|
||||
SettingsManager.username = user_input.text
|
||||
var final_name = user_input.text.strip_edges()
|
||||
user_input.text = final_name
|
||||
SettingsManager.username = final_name
|
||||
SettingsManager._save_settings()
|
||||
var nm = get_node_or_null("/root/NetworkManager")
|
||||
if nm:
|
||||
if nm.multiplayer.has_multiplayer_peer() and not nm.multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
|
||||
nm.update_username.rpc_id(1, user_input.text)
|
||||
nm.update_username.rpc_id(1, final_name)
|
||||
else:
|
||||
nm.update_username(user_input.text)
|
||||
nm.update_username(final_name)
|
||||
)
|
||||
user_hbox.add_child(user_save)
|
||||
|
||||
@@ -920,7 +922,9 @@ func _populate_options(opt: OptionButton, category: String, current_id: String)
|
||||
func _save_current_loadout() -> void:
|
||||
if editing_index >= 0 and editing_index < LoadoutManager.loadouts.size():
|
||||
var l = LoadoutManager.loadouts[editing_index]
|
||||
l["name"] = name_edit.text
|
||||
if name_edit.text.strip_edges() != "":
|
||||
l["name"] = name_edit.text.strip_edges()
|
||||
name_edit.text = l["name"]
|
||||
l["primary_1"] = primary1_opt.get_item_metadata(primary1_opt.get_selected_id())
|
||||
l["primary_2"] = primary2_opt.get_item_metadata(primary2_opt.get_selected_id())
|
||||
l["special"] = special_opt.get_item_metadata(special_opt.get_selected_id())
|
||||
|
||||
Reference in New Issue
Block a user