Skip to content

Commit

Permalink
1.9.20
Browse files Browse the repository at this point in the history
  • Loading branch information
uzkbwza committed Sep 12, 2024
1 parent d899937 commit bf32841
Show file tree
Hide file tree
Showing 33 changed files with 281 additions and 86 deletions.
14 changes: 13 additions & 1 deletion Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends Node

signal nag_window()

var VERSION = "1.9.18-steam-unstable"
var VERSION = "1.9.20-steam"
const RESOLUTION = Vector2(640, 360)

var audio_player
Expand Down Expand Up @@ -32,10 +32,13 @@ var show_last_move_indicators = true
var speed_lines_enabled = true
var replay_extra_freeze_frames = true
var seen_custom_character_nag = false
var forfeit_buttons_enabled = false
var auto_fc = true
var ghost_speed = 2

var mods_loaded = false
var loading_character = ""

var mouse_world_position = Vector2()
var rng = BetterRng.new()

Expand All @@ -52,6 +55,8 @@ var songs = {
"bg1": preload("res://sound/music/bg1.mp3")
}

var character_select_node = null

var characters_cache = {}

func get_cached_character(name):
Expand Down Expand Up @@ -215,6 +220,7 @@ func save_options():
"auto_fc": auto_fc,
"replay_extra_freeze_frames": replay_extra_freeze_frames,
"seen_custom_character_nag": seen_custom_character_nag,
# "forfeit_buttons_enabled": forfeit_buttons_enabled,
}
})

Expand Down Expand Up @@ -244,6 +250,7 @@ func get_default_player_data():
"show_extra_info": false,
"replay_extra_freeze_frames": true,
"seen_custom_character_nag": false,
# "forfeit_buttons_enabled": false,
}
}

Expand Down Expand Up @@ -287,3 +294,8 @@ func save_player_data(data: Dictionary):
file.store_string(JSON.print(existing_data, " "))
file.close()
return

func reload():
if character_select_node:
character_select_node.get_parent().remove_child(character_select_node)
get_tree().reload_current_scene()
45 changes: 41 additions & 4 deletions Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2559,6 +2559,10 @@ anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 7 )

[node name="CharacterSelect" parent="UILayer" instance=ExtResource( 12 )]
unique_name_in_owner = true
visible = false

[node name="HBoxContainer" type="HBoxContainer" parent="UILayer"]
visible = false
anchor_top = 1.0
Expand All @@ -2574,10 +2578,6 @@ rect_min_size = Vector2( 50, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="CharacterSelect" parent="UILayer" instance=ExtResource( 12 )]
unique_name_in_owner = true
visible = false

[node name="P1TurnTimer" type="Timer" parent="UILayer"]
unique_name_in_owner = true
wait_time = 10.0
Expand Down Expand Up @@ -2924,6 +2924,43 @@ pitch_variation = 0.05
[node name="MLMainHook" type="Node" parent="ModLoaderHooks"]
script = ExtResource( 56 )

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="LoadingCharactersLabel" type="Label" parent="CanvasLayer"]
unique_name_in_owner = true
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -65.5
margin_top = -103.0
margin_right = 65.5
margin_bottom = -89.0
theme = ExtResource( 4 )
text = "loading mod:"
align = 1

[node name="LoadingCharactersLabel2" type="Label" parent="CanvasLayer"]
unique_name_in_owner = true
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -65.5
margin_top = -93.0
margin_right = 65.5
margin_bottom = -79.0
grow_horizontal = 2
theme = ExtResource( 4 )
align = 1

[node name="InputBlocker" type="Control" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0

[connection signal="pressed" from="UILayer/GameUI/BottomBar/OptionsBarContainer/OptionsBar/ClearParticlesButton" to="UILayer" method="_on_ClearParticlesButton_pressed"]
[connection signal="text_entered" from="UILayer/GameUI/PausePanel/VBoxContainer/ReplayName" to="." method="_on_ReplayName_text_entered"]
[connection signal="pressed" from="UILayer/MainMenu/ButtonContainer/WorkshopUploader" to="UILayer" method="_on_WorkshopUploader_pressed"]
Expand Down
52 changes: 45 additions & 7 deletions Network.gd
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ var second_register = false
var player1_hashes
var player2_hashes

var rpc_whitelist = {}
var rpc_blacklist = {
"_whitelist_rpc_method": true,
"_blacklist_rpc_method": true,
}

onready var timer = Timer.new()

# Signals to let lobby GUI know what's going on.
Expand Down Expand Up @@ -133,7 +139,10 @@ func _ready():
timer.connect("timeout", self, "_on_network_timer_timeout")
add_child(timer)
timer.start(NETWORK_TIMER_CYCLE)

randomize()
_setup_rpc_whitelist()


func get_multiplayer_active():
return multiplayer_active and !SteamLobby.SPECTATING
Expand All @@ -144,12 +153,13 @@ func rpc_(function_name: String, arg=null, type="remotesync"):

if !multiplayer_active:
return
# yield(get_tree().create_timer(rng.randf_range(0.5, 2.0)), "timeout")

if direct_connect:
if arg is Array:
var all_args = [function_name]
all_args.append_array(arg)
callv("rpc", all_args)
if check_valid_rpc(function_name):
callv("rpc", all_args)
elif arg != null:
rpc(function_name, arg)
else:
Expand All @@ -168,11 +178,38 @@ func rpc_(function_name: String, arg=null, type="remotesync"):
else:
rpc_id(1, "relay", function_name, arg)
if arg is Array:
callv(function_name, arg)
if check_valid_rpc(function_name):
callv(function_name, arg)
elif arg != null:
call(function_name, arg)
if check_valid_rpc(function_name):
call(function_name, arg)
else:
call(function_name)
if check_valid_rpc(function_name):
call(function_name)

func _whitelist_rpc_method(function_name):
rpc_blacklist.erase(function_name)
rpc_whitelist[function_name] = true

func _blacklist_rpc_method(function_name):
rpc_whitelist.erase(function_name)
rpc_blacklist[function_name] = true

func _setup_rpc_whitelist():
var script: Script = get_script()
if script != null:
var method_list = script.get_script_method_list()
for method in method_list:
var name = method.name
if (name in rpc_blacklist):
continue
_whitelist_rpc_method(name)

func check_valid_rpc(function_name):
if !(function_name in rpc_whitelist):
print("unrecognized method %s for RPC call. modders please use _whitelist_rpc_method() to fix this." % function_name)
return false
return true

remotesync func send_match_data(match_data):
emit_signal("match_locked_in", match_data)
Expand Down Expand Up @@ -392,7 +429,7 @@ remote func player_disconnected(id):
if !(id in players):
return
if Global.css_open:
get_tree().reload_current_scene()
Global.reload()
if steam:
SteamLobby.quit_match()
emit_signal("player_disconnected")
Expand Down Expand Up @@ -523,6 +560,7 @@ func select_character(character, style=null):
rpc_("sync_character_selection", [player_id, character, style])

func forfeit(opponent=false):
print("forfeiting")
if !opponent:
rpc_("player_forfeit", player_id)
else:
Expand Down Expand Up @@ -765,7 +803,7 @@ remotesync func send_rematch_request(player_id):
ReplayManager.init()
if steam:
SteamLobby.REMATCHING_ID = SteamLobby.OPPONENT_ID
# get_tree().reload_current_scene()
# Global.reload()
# begin_game()
SteamLobby.exit_match_from_button()
else:
Expand Down
17 changes: 8 additions & 9 deletions SteamLobby.gd
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func _ready() -> void:
func _on_game_error(error):
print(error)
# quit_match()
# get_tree().reload_current_scene()
# Global.reload()

func _on_spectator_update_timer_timeout():
SteamLobby.update_spectators(ReplayManager.frames)
Expand Down Expand Up @@ -231,7 +231,7 @@ func exit_match_from_button():
if !SPECTATING:
quit_match()
Network.stop_multiplayer()
get_tree().reload_current_scene()
Global.reload()

func has_supporter_pack(steam_id):
# TODO: fix this
Expand Down Expand Up @@ -424,9 +424,6 @@ func _read_P2P_Packet():
var PACKET_CODE:PoolByteArray = PACKET["data"]
var readable:Dictionary = bytes2var(PACKET_CODE)





if readable.has("rpc_data"):
print("received rpc")
Expand All @@ -442,7 +439,7 @@ func _read_P2P_Packet():
emit_signal("quit_on_rematch")
Steam.setLobbyMemberData(LOBBY_ID, "status", "busy")
if not is_instance_valid(Global.current_game):
get_tree().reload_current_scene()
Global.reload()
Steam.setLobbyMemberData(LOBBY_ID, "opponent_id", "")
Steam.setLobbyMemberData(LOBBY_ID, "character", "")
Steam.setLobbyMemberData(LOBBY_ID, "player_id", "")
Expand Down Expand Up @@ -570,7 +567,7 @@ func _validate_Auth_Session(ticket: Dictionary, steam_id: int) -> void:
if steam_id == OPPONENT_ID and OPPONENT_ID != 0:
quit_match()
if is_instance_valid(Global.current_game):
get_tree().reload_current_scene()
Global.reload()

func _on_received_spectate_request(steam_id):
if Steam.getLobbyMemberData(LOBBY_ID, SteamHustle.STEAM_ID, "status") == "fighting" and is_instance_valid(Network.game):
Expand Down Expand Up @@ -857,7 +854,7 @@ func _on_P2P_Session_Connect_Fail(steamID: int, session_error: int) -> void:
# Else no known error
else:
print("WARNING: Session failure with "+str(steamID)+" [unknown error "+str(session_error)+"].")
# get_tree().reload_current_scene()
# Global.reload()

func get_status():
return Steam.getLobbyMemberData(LOBBY_ID, SteamHustle.STEAM_ID, "status")
Expand Down Expand Up @@ -949,7 +946,9 @@ func _receive_rpc(data):
args = []
elif not args is Array:
args = [args]
Network.callv(data.rpc_data.func , args)
var func_ = data.rpc_data.func
if Network.check_valid_rpc(func_):
Network.callv(func_, args)

func request_spectate(steam_id):
REQUESTING_TO_SPECTATE = steam_id
Expand Down
2 changes: 1 addition & 1 deletion addons/helpers/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func make_visible(visible):
pass

func get_plugin_name():
return "Hi"
return """1738 ayy im like hey whats up hello"""

func get_plugin_icon():
return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
2 changes: 2 additions & 0 deletions characters/BaseChar.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,8 @@ Aerial"

[node name="ForfeitExplosion" type="Node2D" parent="StateMachine" index="56"]
script = ExtResource( 153 )
reset_momentum = true
endless = true
particle_scene = ExtResource( 154 )
particle_position = Vector2( 0, -16 )
spawn_particle_on_enter = true
Expand Down
7 changes: 5 additions & 2 deletions characters/mutant/DashThroughAttack.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ func _frame_6():
host.turn_around()

func _tick():
var vel = host.get_vel()
var opp_dist = Utils.int_abs(host.obj_local_pos(host.opponent).x)
if current_tick > 3 and current_tick < 12 and !tracked_yet:
if host.get_opponent_dir() != starting_dir and opp_dist >= MIN_TRACKING_SPEED:
tracking = true
tracked_yet = true
host.set_vel(host.get_vel().x, "0")
host.set_vel(vel.x, "0")
host.update_data()
vel = host.get_vel()
if tracking and opp_dist >= MIN_TRACKING_SPEED:
# host.move_directly(host.get_opponent_dir() * TRACKING_SPEED, 0)
host.set_vel(str(-starting_dir * TRACKING_SPEED), host.get_vel().y)
host.set_vel(str(-starting_dir * TRACKING_SPEED), vel.y)
if host.get_opponent_dir() == starting_dir:
tracking = false

Expand Down
Binary file modified characters/robo/ground_pound_indicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions characters/states/CharState.gd
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export(String, MULTILINE) var interrupt_into_string
export(String, MULTILINE) var hit_cancel_into_string
export(String, MULTILINE) var interrupt_exceptions_string
export(String, MULTILINE) var hit_cancel_exceptions_string
export var always_usable = false

export var _c_Stances = 0
export(String, MULTILINE) var allowed_stances_string = "Normal"
Expand Down Expand Up @@ -207,6 +208,7 @@ func init():
allowed_stances.append_array(get_categories(allowed_stances_string))
interrupt_exceptions.append_array(get_categories(interrupt_exceptions_string))
start_interruptible_on_opponent_turn = interruptible_on_opponent_turn

for node in get_children():
if node is UsableRequirement:
usable_requirement_nodes.append(node)
Expand All @@ -220,6 +222,7 @@ func init():
hit_cancel_into.append("AerialGrab")
hit_cancel_into.append("Wait")
hit_cancel_into.append("Fall")

if title == "":
title = state_name
match busy_interrupt_type:
Expand Down
9 changes: 9 additions & 0 deletions characters/states/Forfeit.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends CharacterState

func is_usable():
if Network.multiplayer_active and host.id != Network.pid:
return false
return Global.forfeit_buttons_enabled

func _enter():
host.forfeit()
1 change: 1 addition & 0 deletions characters/states/ForfeitExplosion.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ func _frame_0():
host.flip.hide()
host.screen_bump(Vector2(), 20, 10 / 60.0)
host.hp = 0
host.play_sound("HitBass")
Loading

0 comments on commit bf32841

Please sign in to comment.