-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathstart_ready_button.lua
More file actions
159 lines (139 loc) · 4.32 KB
/
Copy pathstart_ready_button.lua
File metadata and controls
159 lines (139 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
local Disableable_Button = MP.UI.Disableable_Button
local function get_warnings()
local warnings = {}
-- Check the other player (guest if we're host, host if we're guest)
local other_player = MP.LOBBY.is_host and MP.LOBBY.guest or MP.LOBBY.host
if other_player and other_player.cached == false then
table.insert(warnings, { localize("k_warning_cheating1"), SMODS.Gradients.warning_text, 0.4 })
table.insert(
warnings,
{ string.format(localize("k_warning_cheating2"), MP.UTILS.random_message()), SMODS.Gradients.warning_text }
)
end
if other_player and other_player.config and other_player.config.unlocked == false then
table.insert(warnings, {
localize("k_warning_nemesis_unlock"),
SMODS.Gradients.warning_text,
0.25,
})
end
local bothPlayersInLobby = MP.LOBBY.guest and MP.LOBBY.guest.config ~= nil
-- Content mod compatibility warnings (currently Extra Credit only)
if bothPlayersInLobby then
local hostExtraCreditVersion = MP.LOBBY.host
and MP.LOBBY.host.config
and MP.LOBBY.host.config.Mods["extracredit"]
local guestExtraCreditVersion = MP.LOBBY.guest
and MP.LOBBY.guest.config
and MP.LOBBY.guest.config.Mods["extracredit"]
if hostExtraCreditVersion ~= guestExtraCreditVersion then
table.insert(warnings, {
"Extra Credit mismatch - players may see different jokers",
SMODS.Gradients.warning_text,
})
elseif hostExtraCreditVersion ~= nil and hostExtraCreditVersion == guestExtraCreditVersion then
table.insert(warnings, {
"Extra Credit active - curated jokers replaced with full pool",
G.C.GREEN,
0.25,
})
end
end
if MP.LOBBY.ready_to_start or not MP.LOBBY.is_host then
local hostSteamoddedVersion = MP.LOBBY.host and MP.LOBBY.host.config and MP.LOBBY.host.config.Mods["Steamodded"]
local guestSteamoddedVersion = MP.LOBBY.guest
and MP.LOBBY.guest.config
and MP.LOBBY.guest.config.Mods["Steamodded"]
if hostSteamoddedVersion ~= guestSteamoddedVersion then
table.insert(warnings, {
localize("k_steamodded_warning"),
SMODS.Gradients.warning_text,
})
end
end
if MP.UTILS.mp_version_mismatch() then
table.insert(warnings, {
localize("k_mp_version_warning"),
G.C.RED,
0.4,
})
end
local host_banned_mods = MP.LOBBY.host
and MP.LOBBY.host.config
and MP.UTILS.get_banned_mods(MP.LOBBY.host.config.Mods)
or {}
local guest_banned_mods = MP.LOBBY.guest
and MP.LOBBY.guest.config
and MP.UTILS.get_banned_mods(MP.LOBBY.guest.config.Mods)
or {}
if #host_banned_mods > 0 or #guest_banned_mods > 0 then
table.insert(warnings, {
localize("k_warning_banned_mods"),
G.C.RED,
0.4,
})
end
SMODS.Mods["Multiplayer"].config.unlocked = MP.UTILS.unlock_check()
if not SMODS.Mods["Multiplayer"].config.unlocked then
table.insert(warnings, {
localize("k_warning_unlock_profile"),
SMODS.Gradients.warning_text,
0.25,
})
end
if MP.LOBBY.username == "Guest" then table.insert(warnings, {
localize("k_set_name"),
G.C.UI.TEXT_LIGHT,
}) end
if #warnings == 0 then table.insert(warnings, {
" ",
G.C.UI.TEXT_LIGHT,
}) end
return warnings
end
function MP.UI.lobby_status_display()
local warnings = get_warnings()
local warning_texts = {}
for k, v in pairs(warnings) do
table.insert(
warning_texts,
MP.UI.UTILS.create_row({ align = "cm", padding = -0.25 }, {
MP.UI.UTILS.create_text_node(v[1], {
colour = v[2],
scale = v[3] or 0.25,
}),
})
)
end
return MP.UI.UTILS.create_row({ padding = 0.35, align = "cm" }, warning_texts)
end
-- Component for main start/ready button in lobby
function MP.UI.create_lobby_main_button(text_scale)
if MP.LOBBY.is_host then
return Disableable_Button({
id = "lobby_menu_start",
button = "lobby_start_game",
colour = G.C.BLUE,
minw = 3.65,
minh = 1.55,
label = { localize("b_start") },
disabled_text = MP.LOBBY.guest.username and localize("b_wait_for_guest_ready")
or localize("b_wait_for_players"),
scale = text_scale * 2,
col = true,
enabled_ref_table = MP.LOBBY,
enabled_ref_value = "ready_to_start",
})
else
return UIBox_button({
id = "lobby_menu_start",
button = "lobby_ready_up",
colour = MP.LOBBY.ready_to_start and G.C.GREEN or G.C.RED,
minw = 3.65,
minh = 1.55,
label = { MP.LOBBY.ready_to_start and localize("b_unready") or localize("b_ready") },
scale = text_scale * 2,
col = true,
})
end
end