mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 07:28:14 +00:00
ok, working now, wanna just get unbinding working
This commit is contained in:
@@ -106,17 +106,11 @@ func save_inputs() -> void:
|
||||
event = InputMap.action_get_events(i)
|
||||
else:
|
||||
event = InputMap.action_get_events(i + \"_0\")
|
||||
var size = event.size()
|
||||
if type == 0:
|
||||
if size > 2:
|
||||
events = [get_str_for_event(event[0]), get_str_for_event(event[2])]
|
||||
else:
|
||||
events = [get_str_for_event(event[0])]
|
||||
elif type == 1:
|
||||
if size > 3:
|
||||
events = [get_str_for_event(event[1]), get_str_for_event(event[3])]
|
||||
else:
|
||||
events = [get_str_for_event(event[1])]
|
||||
for x in event:
|
||||
if type == 0 and x is InputEventKey:
|
||||
events.append(get_str_for_event(x))
|
||||
elif type == 1 and (x is InputEventJoypadButton or x is InputEventJoypadMotion):
|
||||
events.append(get_str_for_event(x))
|
||||
Settings.file[[\"keyboard\", \"controller\"][type]][i] = events
|
||||
|
||||
func get_str_for_event(event: InputEvent):
|
||||
|
@@ -400,9 +400,9 @@ func handle_tile_cursor() -> void:
|
||||
|
||||
if current_state == EditorState.IDLE:
|
||||
if Input.is_action_just_pressed("scroll_up"):
|
||||
selected_tile_index += 1
|
||||
if Input.is_action_just_pressed("scroll_down"):
|
||||
selected_tile_index -= 1
|
||||
if Input.is_action_just_pressed("scroll_down"):
|
||||
selected_tile_index += 1
|
||||
|
||||
if Input.is_action_just_pressed("editor_copy"):
|
||||
copy_node(tile_position)
|
||||
|
@@ -113,7 +113,7 @@ func show_best_time() -> void:
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if can_transition:
|
||||
if Input.is_action_just_pressed("jump_0"):
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
transition()
|
||||
|
||||
func _exit_tree() -> void:
|
||||
|
@@ -107,25 +107,33 @@ func map_event_to_action(event, idx := 0) -> void:
|
||||
var action = action_name
|
||||
if action.contains("ui_") == false and action != "pause":
|
||||
action = action_name + "_" + str(player_idx)
|
||||
var replace_event = null
|
||||
var events = InputMap.action_get_events(action).duplicate()
|
||||
if events.size() < 4:
|
||||
for i in abs(4 - events.size()):
|
||||
var dummy = InputEventKey.new()
|
||||
dummy.keycode = KEY_UNKNOWN
|
||||
events.append(dummy)
|
||||
events[type + (idx * 2)] = event
|
||||
var matching_type_events := []
|
||||
for i in events:
|
||||
if type == 0 and i is InputEventKey:
|
||||
matching_type_events.append(i)
|
||||
elif type == 1 and (i is InputEventJoypadButton or i is InputEventJoypadMotion):
|
||||
matching_type_events.append(i)
|
||||
if matching_type_events.size() - 1 < idx:
|
||||
matching_type_events.append(event)
|
||||
replace_event = matching_type_events[clamp(idx, 0, matching_type_events.size() - 1)]
|
||||
var itr := 0
|
||||
for i in events:
|
||||
if i == replace_event:
|
||||
events[itr] = event
|
||||
itr += 1
|
||||
InputMap.action_erase_events(action)
|
||||
for i in events:
|
||||
print([action, i])
|
||||
InputMap.action_add_event(action, i)
|
||||
input_changed.emit(action, event)
|
||||
input_events[idx] = event
|
||||
awaiting_input = false
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
rebinding_input = false
|
||||
get_parent().can_input = true
|
||||
can_remap = true
|
||||
update_value()
|
||||
awaiting_input = false
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
rebinding_input = false
|
||||
get_parent().can_input = true
|
||||
can_remap = true
|
||||
update_value()
|
||||
|
||||
func get_event_string(event: InputEvent) -> String:
|
||||
var event_string := ""
|
||||
|
@@ -130,7 +130,9 @@ ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"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":90,"physical_keycode":0,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||
, null]
|
||||
, null, 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":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
ui_select={
|
||||
"deadzone": 0.5,
|
||||
@@ -220,6 +222,8 @@ pause={
|
||||
"deadzone": 0.5,
|
||||
"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":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
|
||||
, 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":4194306,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
drop_item={
|
||||
@@ -472,6 +476,8 @@ ui_back={
|
||||
"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":88,"physical_keycode":0,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
|
||||
, 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":4194308,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
pick_tile={
|
||||
|
Reference in New Issue
Block a user