Skip to content

Commit

Permalink
more custom stuff
Browse files Browse the repository at this point in the history
uzkbwza committed Dec 2, 2022
1 parent dec9841 commit acd814d
Showing 50 changed files with 819 additions and 303 deletions.
48 changes: 40 additions & 8 deletions Custom.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
extends Node

const SUPPORTER_PACK = 2232850

var hitsparks = {
"bash": "res://fx/HitEffect1.tscn",
"bash2": "res://fx/hitsparks/HitEffect1Alt.tscn",
@@ -17,6 +19,9 @@ var simple_colors = ["94e4ff", "ffc1a1", "ecffa4", "fec2ff", "6e8696", "ffea5d",
var simple_outlines = ["04579a", "85001f", "008561", "9f42ba", "343537", "ff9444", "94e4ff", "ffc1a1", "ecffa4", "fec2ff", "6e8696", "ffea5d"]

func _ready():
for i in range(simple_colors.size()):
simple_colors[i] = Color(simple_colors[i])
simple_outlines[i] = Color(simple_outlines[i])
make_custom_folder()

func make_custom_folder():
@@ -25,31 +30,58 @@ func make_custom_folder():
dir.make_dir("user://custom")

func apply_style_to_material(style, material: ShaderMaterial):
material.set_shader_param("color", style.character_color)
if style.character_color != null:
material.set_shader_param("color", style.character_color)
material.set_shader_param("use_outline", style.use_outline)
material.set_shader_param("outline_color", style.outline_color)
if style.outline_color != null:
material.set_shader_param("outline_color", style.outline_color)
pass


func is_combo_simple(color, outline):
return simple_colors.find(color) == simple_outlines.find(outline)

func is_color_dlc(color):
if color is Color:
return color.to_html(false) in simple_colors
return color in simple_colors
if color == null:
return false
if !(color is Color):
return !(Color(color) in simple_colors)
return !(color in simple_colors)

func is_outline_dlc(color):
if color is Color:
return color.to_html(false) in simple_outlines
return color in simple_outlines
if color == null:
return false
if !(color is Color):
return !(Color(color) in simple_outlines)
return !(color in simple_outlines)

func hitspark_to_dlc(spark_name):
if spark_name in hitspark_dlc:
return hitspark_dlc[spark_name]
return 0

func can_use_style(player_id, style):
if !requires_dlc(style):
return true
if !Network.multiplayer_active:
# return Global.has_supporter_pack()
return true
elif SteamYomi.STARTED:
if player_id == SteamLobby.PLAYER_SIDE:
var has_supporter_pack = SteamYomi.has_supporter_pack(SteamYomi.STEAM_ID)
if has_supporter_pack:
print("You have the supporter pack.")
return has_supporter_pack
elif SteamLobby.OPPONENT_ID != 0:
var has_supporter_pack = SteamYomi.has_supporter_pack(SteamLobby.OPPONENT_ID)
if has_supporter_pack:
print("Your opponent has the supporter pack.")
return has_supporter_pack
return false

func requires_dlc(data):
if data == null:
return false
if data.show_aura:
return true
if is_color_dlc(data.character_color):
17 changes: 16 additions & 1 deletion Global.gd
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ var show_playback_controls = false
var playback_speed_mod = 1
var default_dojo = 0
var current_game = null
var css_open = false
var has_supporter_pack_file = false

var name_paths = {
"Ninja": "res://characters/stickman/NinjaGuy.tscn",
@@ -43,11 +45,21 @@ func _enter_tree():
# show_hitboxes = data.options.show_hitboxes
set_music_enabled(music_enabled)
set_fullscreen(fullscreen)
load_supporter_pack()

func load_supporter_pack():
var success = ProjectSettings.load_resource_pack(OS.get_executable_path().get_base_dir() + "/Supporter.pck")
if success:
has_supporter_pack_file = true
print(has_supporter_pack_file)

func _ready():
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
randomize()
if randi() % 20 == 0 and SteamYomi.IS_ONLINE:
if randi() % 1 == 0 and SteamYomi.IS_ONLINE and !SteamYomi.has_supporter_pack(SteamYomi.STEAM_ID):
emit_signal("nag_window")

func set_music_enabled(on):
@@ -59,6 +71,9 @@ func set_music_enabled(on):
audio_player.stop()
pass

func has_supporter_pack():
return has_supporter_pack_file

func set_playback_controls(on):
show_playback_controls = on
save_options()
28 changes: 14 additions & 14 deletions Main.tscn
Original file line number Diff line number Diff line change
@@ -905,20 +905,6 @@ margin_bottom = 11.0
text = "E: Edit replay - ESC: Open menu - F1: Toggle HUD"
align = 1

[node name="AdvantageLabel" type="Label" parent="UILayer/GameUI"]
unique_name_in_owner = true
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_top = 71.0
margin_bottom = 85.0
theme = ExtResource( 4 )
custom_colors/font_color = Color( 1, 0.2, 0.239216, 1 )
align = 1
__meta__ = {
"_edit_lock_": true
}

[node name="BottomBar" type="VBoxContainer" parent="UILayer/GameUI"]
unique_name_in_owner = true
anchor_left = 0.5
@@ -1438,6 +1424,20 @@ zoom"
align = 1
clip_text = true

[node name="AdvantageLabel" type="Label" parent="UILayer/GameUI"]
unique_name_in_owner = true
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_top = 71.0
margin_bottom = 85.0
theme = ExtResource( 4 )
custom_colors/font_color = Color( 1, 0.2, 0.239216, 1 )
align = 1
__meta__ = {
"_edit_lock_": true
}

[node name="ChatWindow" parent="UILayer" instance=ExtResource( 30 )]
unique_name_in_owner = true
visible = false
15 changes: 15 additions & 0 deletions Network.gd
Original file line number Diff line number Diff line change
@@ -47,6 +47,11 @@ var ticks = {
2: null
}

var styles = {
1: null,
2: null
}

var auto = false

# Names for remote players in id:name format.
@@ -290,6 +295,11 @@ func _reset():
2: false
}

styles = {
1: null,
2: null
}

action_inputs = {
1: {
"action": null,
@@ -374,6 +384,10 @@ remote func player_disconnected(id):
# multiplayer_active = false
if !(id in players):
return
if Global.css_open:
get_tree().reload_current_scene()
if steam:
SteamLobby.quit_match()
emit_signal("player_disconnected")
if is_host():
if players.has(id):
@@ -741,6 +755,7 @@ remotesync func send_rematch_request(player_id):

remotesync func sync_character_selection(player_id, character, style=null):
print("player %s selected character" % [str(player_id)])
styles[player_id] = style
emit_signal("character_selected", player_id, character, style)

remotesync func open_chara_select():
Loading

0 comments on commit acd814d

Please sign in to comment.