mutators: button icon; fix notifications; disable tests
This commit is contained in:
parent
d581e0a9ce
commit
162926abc7
11 changed files with 163 additions and 38 deletions
BIN
vmf_source/gui/vmf/mutator_button.dds
Normal file
BIN
vmf_source/gui/vmf/mutator_button.dds
Normal file
Binary file not shown.
17
vmf_source/gui/vmf/mutator_button.texture
Normal file
17
vmf_source/gui/vmf/mutator_button.texture
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
common = {
|
||||||
|
input = {
|
||||||
|
filename = "gui/vmf/mutator_button"
|
||||||
|
}
|
||||||
|
output = {
|
||||||
|
apply_processing = true
|
||||||
|
correct_gamma = true
|
||||||
|
cut_alpha_threshold = 0.5
|
||||||
|
enable_cut_alpha_threshold = false
|
||||||
|
format = "A8R8G8B8"
|
||||||
|
mipmap_filter = "kaiser"
|
||||||
|
mipmap_filter_wrap_mode = "mirror"
|
||||||
|
mipmap_keep_original = false
|
||||||
|
mipmap_num_largest_steps_to_discard = 0
|
||||||
|
mipmap_num_smallest_steps_to_discard = 0
|
||||||
|
}
|
||||||
|
}
|
BIN
vmf_source/gui/vmf/mutator_button_hover.dds
Normal file
BIN
vmf_source/gui/vmf/mutator_button_hover.dds
Normal file
Binary file not shown.
17
vmf_source/gui/vmf/mutator_button_hover.texture
Normal file
17
vmf_source/gui/vmf/mutator_button_hover.texture
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
common = {
|
||||||
|
input = {
|
||||||
|
filename = "gui/vmf/mutator_button_hover"
|
||||||
|
}
|
||||||
|
output = {
|
||||||
|
apply_processing = true
|
||||||
|
correct_gamma = true
|
||||||
|
cut_alpha_threshold = 0.5
|
||||||
|
enable_cut_alpha_threshold = false
|
||||||
|
format = "A8R8G8B8"
|
||||||
|
mipmap_filter = "kaiser"
|
||||||
|
mipmap_filter_wrap_mode = "mirror"
|
||||||
|
mipmap_keep_original = false
|
||||||
|
mipmap_num_largest_steps_to_discard = 0
|
||||||
|
mipmap_num_smallest_steps_to_discard = 0
|
||||||
|
}
|
||||||
|
}
|
14
vmf_source/materials/vmf/mutator_button.material
Normal file
14
vmf_source/materials/vmf/mutator_button.material
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
mutator_button = {
|
||||||
|
material_contexts = {
|
||||||
|
surface_material = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
shader = "gui_gradient:DIFFUSE_MAP"
|
||||||
|
|
||||||
|
textures = {
|
||||||
|
diffuse_map = "gui/vmf/mutator_button"
|
||||||
|
}
|
||||||
|
|
||||||
|
variables = {
|
||||||
|
}
|
||||||
|
}
|
14
vmf_source/materials/vmf/mutator_button_hover.material
Normal file
14
vmf_source/materials/vmf/mutator_button_hover.material
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
mutator_button_hover = {
|
||||||
|
material_contexts = {
|
||||||
|
surface_material = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
shader = "gui_gradient:DIFFUSE_MAP"
|
||||||
|
|
||||||
|
textures = {
|
||||||
|
diffuse_map = "gui/vmf/mutator_button_hover"
|
||||||
|
}
|
||||||
|
|
||||||
|
variables = {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
local definitions = local_require("scripts/ui/views/map_view_definitions")
|
local definitions = local_require("scripts/ui/views/map_view_definitions")
|
||||||
local scenegraph_definition = definitions.scenegraph_definition
|
local scenegraph_definition = definitions.scenegraph_definition
|
||||||
|
|
||||||
|
@ -75,8 +76,8 @@ local new_widgets = {
|
||||||
toggle_texture = "octagon_button_toggled",
|
toggle_texture = "octagon_button_toggled",
|
||||||
hover_texture = "octagon_button_hover",
|
hover_texture = "octagon_button_hover",
|
||||||
normal_texture = "octagon_button_normal",
|
normal_texture = "octagon_button_normal",
|
||||||
icon_texture = "map_icon_browser_01",
|
icon_texture = "mutator_button",
|
||||||
icon_hover_texture = "map_icon_browser_01",
|
icon_hover_texture = "mutator_button_hover",
|
||||||
tooltip_text = "Mutators",
|
tooltip_text = "Mutators",
|
||||||
toggled_tooltip_text = "Mutators",
|
toggled_tooltip_text = "Mutators",
|
||||||
button_hotspot = {}
|
button_hotspot = {}
|
||||||
|
|
|
@ -42,9 +42,8 @@ local function set_lobby_data()
|
||||||
Managers.matchmaking.lobby:set_lobby_data(lobby_data)
|
Managers.matchmaking.lobby:set_lobby_data(lobby_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return a function for chat system to only send messages to specific client
|
-- Return a function for chat system to only send messages to specific client
|
||||||
-- TODO: test if this works
|
local function get_peer_id_from_cookie(client_cookie)
|
||||||
local function get_member_func(client_cookie)
|
|
||||||
local peer_id = tostring(client_cookie)
|
local peer_id = tostring(client_cookie)
|
||||||
for _ = 1, 3 do
|
for _ = 1, 3 do
|
||||||
peer_id = string.sub(peer_id, 1 + tonumber(tostring(string.find(peer_id,"-"))))
|
peer_id = string.sub(peer_id, 1 + tonumber(tostring(string.find(peer_id,"-"))))
|
||||||
|
@ -54,24 +53,25 @@ local function get_member_func(client_cookie)
|
||||||
peer_id = string.sub(peer_id, 2)
|
peer_id = string.sub(peer_id, 2)
|
||||||
peer_id = string.reverse(peer_id)
|
peer_id = string.reverse(peer_id)
|
||||||
|
|
||||||
return function()
|
return peer_id
|
||||||
for _, v in ipairs(Managers.matchmaking.lobby:members():get_members()) do
|
|
||||||
if v == peer_id then
|
|
||||||
return {v}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return Managers.matchmaking.lobby:members():get_members()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set difficulty in the tab menu
|
-- Append difficulty name with enabled mutators' titles
|
||||||
-- TODO: see if this can be set every time a mutator is enabled/disable
|
manager:hook("IngamePlayerListUI.update_difficulty", function(func, self)
|
||||||
manager:hook("IngamePlayerListUI.set_difficulty_name", function(func, self, name)
|
local difficulty_settings = Managers.state.difficulty:get_difficulty_settings()
|
||||||
|
local difficulty_name = difficulty_settings.display_name
|
||||||
|
|
||||||
|
local name = not self.is_in_inn and Localize(difficulty_name) or nil
|
||||||
local mutators_name = get_enabled_mutators_names(" ", true)
|
local mutators_name = get_enabled_mutators_names(" ", true)
|
||||||
if mutators_name then
|
if mutators_name then
|
||||||
name = name .. " " .. mutators_name
|
if name then name = name .. " " else name = "" end
|
||||||
|
name = name .. mutators_name
|
||||||
|
else
|
||||||
|
name = ""
|
||||||
end
|
end
|
||||||
self.headers.content.game_difficulty = name
|
self.set_difficulty_name(self, name)
|
||||||
|
|
||||||
|
self.current_difficulty_name = difficulty_name
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Notify everybody about enabled/disabled mutators when Play button is pressed on the map screen
|
-- Notify everybody about enabled/disabled mutators when Play button is pressed on the map screen
|
||||||
|
@ -79,24 +79,22 @@ manager:hook("MatchmakingStateHostGame.host_game", function(func, self, ...)
|
||||||
func(self, ...)
|
func(self, ...)
|
||||||
set_lobby_data()
|
set_lobby_data()
|
||||||
local names = get_enabled_mutators_names(", ")
|
local names = get_enabled_mutators_names(", ")
|
||||||
|
manager:echo("TEST")
|
||||||
if names then
|
if names then
|
||||||
Managers.chat:send_system_chat_message(1, "ENABLED MUTATORS: " .. names, 0, true)
|
manager:chat_broadcast("ENABLED MUTATORS: " .. names)
|
||||||
were_enabled_before = true
|
were_enabled_before = true
|
||||||
elseif were_enabled_before then
|
elseif were_enabled_before then
|
||||||
Managers.chat:send_system_chat_message(1, "ALL MUTATORS DISABLED", 0, true)
|
manager:chat_broadcast("ALL MUTATORS DISABLED")
|
||||||
were_enabled_before = false
|
were_enabled_before = false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Send special messages with enabled mutators list to players just joining the lobby
|
-- Send special messages with enabled mutators list to players just joining the lobby
|
||||||
-- TODO: test if this works
|
|
||||||
manager:hook("MatchmakingManager.rpc_matchmaking_request_join_lobby", function(func, self, sender, client_cookie, host_cookie, lobby_id, friend_join)
|
manager:hook("MatchmakingManager.rpc_matchmaking_request_join_lobby", function(func, self, sender, client_cookie, host_cookie, lobby_id, friend_join)
|
||||||
local name = get_enabled_mutators_names(", ")
|
local name = get_enabled_mutators_names(", ")
|
||||||
if name then
|
if name then
|
||||||
local message = "[Automated message] This lobby has the following difficulty mod active : " .. name
|
local message = "[Automated message] This lobby has the following difficulty mod active : " .. name
|
||||||
manager:hook("Managers.chat.channels[1].members_func", get_member_func(client_cookie))
|
manager:chat_whisper(get_peer_id_from_cookie(client_cookie), message)
|
||||||
Managers.chat:send_system_chat_message(1, message, 0, true)
|
|
||||||
manager:hook_remove("Managers.chat.channels[1].members_func")
|
|
||||||
end
|
end
|
||||||
func(self, sender, client_cookie, host_cookie, lobby_id, friend_join)
|
func(self, sender, client_cookie, host_cookie, lobby_id, friend_join)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -109,7 +109,7 @@ manager.disable_impossible_mutators = function(notify, everybody)
|
||||||
message = message .. (i == 1 and " " or ", ") .. (mutator:get_config().title or mutator:get_name())
|
message = message .. (i == 1 and " " or ", ") .. (mutator:get_config().title or mutator:get_name())
|
||||||
end
|
end
|
||||||
if everybody then
|
if everybody then
|
||||||
Managers.chat:send_system_chat_message(1, message, 0, true)
|
manager:chat_broadcast(message)
|
||||||
else
|
else
|
||||||
manager:echo(message)
|
manager:echo(message)
|
||||||
end
|
end
|
||||||
|
@ -395,4 +395,4 @@ manager:pcall(function() mutators_view:init(mutators_view:get_map_view()) end)
|
||||||
--[[
|
--[[
|
||||||
Testing
|
Testing
|
||||||
--]]
|
--]]
|
||||||
manager:dofile("scripts/mods/vmf/modules/mutators/mutator_test")
|
--manager:dofile("scripts/mods/vmf/modules/mutators/mutator_test")
|
||||||
|
|
|
@ -1,32 +1,76 @@
|
||||||
local mutator2 = new_mod("mutator2")
|
|
||||||
local mutator3 = new_mod("mutator3")
|
|
||||||
local mutator555 = new_mod("mutator555")
|
local mutator555 = new_mod("mutator555")
|
||||||
|
|
||||||
mutator555:register_as_mutator({
|
mutator555:register_as_mutator({
|
||||||
incompatible_with_all = true
|
incompatible_with_all = true,
|
||||||
|
title = "Legendary"
|
||||||
})
|
})
|
||||||
mutator555:create_options({}, true, "mutator555", "mutator555 description")
|
|
||||||
mutator555.on_enabled = function() end
|
mutator555.on_enabled = function() end
|
||||||
mutator555.on_disabled = function() end
|
mutator555.on_disabled = function() end
|
||||||
|
|
||||||
|
|
||||||
|
local mutator3 = new_mod("mutator3")
|
||||||
mutator3:register_as_mutator({
|
mutator3:register_as_mutator({
|
||||||
incompatible_with = {
|
incompatible_with = {
|
||||||
"mutator4"
|
"mutator4"
|
||||||
}
|
},
|
||||||
|
title = "Stormvermin Mutation"
|
||||||
})
|
})
|
||||||
mutator3.on_enabled = function() end
|
mutator3.on_enabled = function() end
|
||||||
mutator3.on_disabled = function() end
|
mutator3.on_disabled = function() end
|
||||||
|
|
||||||
|
local mutator2 = new_mod("mutator2")
|
||||||
mutator2:register_as_mutator({
|
mutator2:register_as_mutator({
|
||||||
compatible_with_all = true,
|
|
||||||
difficulty_levels = {
|
difficulty_levels = {
|
||||||
"hardest"
|
"hardest",
|
||||||
}
|
"survival_hardest"
|
||||||
|
},
|
||||||
|
title = "Deathwish"
|
||||||
})
|
})
|
||||||
mutator2.on_enabled = function() end
|
mutator2.on_enabled = function() end
|
||||||
mutator2.on_disabled = function() end
|
mutator2.on_disabled = function() end
|
||||||
|
|
||||||
|
local slayer = new_mod("slayer")
|
||||||
|
slayer:register_as_mutator({
|
||||||
|
difficulty_levels = {
|
||||||
|
"survival_hard",
|
||||||
|
"survival_harder",
|
||||||
|
"survival_hardest"
|
||||||
|
},
|
||||||
|
title = "Slayer's Oath"
|
||||||
|
})
|
||||||
|
slayer.on_enabled = function() end
|
||||||
|
slayer.on_disabled = function() end
|
||||||
|
|
||||||
|
local true_solo = new_mod("true_solo")
|
||||||
|
true_solo:register_as_mutator({
|
||||||
|
compatible_with_all = true,
|
||||||
|
title = "True Solo"
|
||||||
|
})
|
||||||
|
true_solo.on_enabled = function() end
|
||||||
|
true_solo.on_disabled = function() end
|
||||||
|
|
||||||
|
local onslaught = new_mod("onslaught")
|
||||||
|
onslaught:register_as_mutator({
|
||||||
|
title = "Onslaught"
|
||||||
|
})
|
||||||
|
onslaught.on_enabled = function() end
|
||||||
|
onslaught.on_disabled = function() end
|
||||||
|
|
||||||
|
local one_hit_one_kill = new_mod("one_hit_one_kill")
|
||||||
|
one_hit_one_kill:register_as_mutator({
|
||||||
|
title = "One Hit One Kill"
|
||||||
|
})
|
||||||
|
one_hit_one_kill.on_enabled = function() end
|
||||||
|
one_hit_one_kill.on_disabled = function() end
|
||||||
|
|
||||||
|
local more_rat_weapons = new_mod("more_rat_weapons")
|
||||||
|
more_rat_weapons:register_as_mutator({
|
||||||
|
compatible_with_all = true,
|
||||||
|
title = "More Rat Weapons"
|
||||||
|
})
|
||||||
|
more_rat_weapons.on_enabled = function() end
|
||||||
|
more_rat_weapons.on_disabled = function() end
|
||||||
|
|
||||||
--[[for i=4,17 do
|
--[[for i=4,17 do
|
||||||
local mutator = new_mod("mutator" .. i)
|
local mutator = new_mod("mutator" .. i)
|
||||||
mutator:register_as_mutator({})
|
mutator:register_as_mutator({})
|
||||||
|
|
|
@ -19,6 +19,10 @@ inject_material("materials/vmf/header_fav_icon_lit", "header_fav_icon_lit", "ing
|
||||||
inject_material("materials/vmf/header_fav_arrow", "header_fav_arrow", "ingame_ui")
|
inject_material("materials/vmf/header_fav_arrow", "header_fav_arrow", "ingame_ui")
|
||||||
inject_material("materials/vmf/search_bar_icon", "search_bar_icon", "ingame_ui")
|
inject_material("materials/vmf/search_bar_icon", "search_bar_icon", "ingame_ui")
|
||||||
|
|
||||||
|
-- TODO: move to mutator_gui
|
||||||
|
inject_material("materials/vmf/mutator_button", "mutator_button", "ingame_ui")
|
||||||
|
inject_material("materials/vmf/mutator_button_hover", "mutator_button_hover", "ingame_ui")
|
||||||
|
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### MENU WIDGETS DEFINITIONS #####################################################################################
|
-- ##### MENU WIDGETS DEFINITIONS #####################################################################################
|
||||||
|
@ -4215,7 +4219,11 @@ if ingame_ui_exists then
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/header_fav_arrow",
|
"materials/vmf/header_fav_arrow",
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/search_bar_icon")
|
"materials/vmf/search_bar_icon",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button_hover")
|
||||||
|
|
||||||
local gui_retained = World.create_screen_gui(ingame_ui.ui_renderer.world,
|
local gui_retained = World.create_screen_gui(ingame_ui.ui_renderer.world,
|
||||||
"material",
|
"material",
|
||||||
|
@ -4237,7 +4245,11 @@ if ingame_ui_exists then
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/header_fav_arrow",
|
"materials/vmf/header_fav_arrow",
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/search_bar_icon")
|
"materials/vmf/search_bar_icon",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button_hover")
|
||||||
|
|
||||||
World.destroy_gui(ingame_ui.ui_renderer.world, ingame_ui.ui_renderer.gui)
|
World.destroy_gui(ingame_ui.ui_renderer.world, ingame_ui.ui_renderer.gui)
|
||||||
World.destroy_gui(ingame_ui.ui_renderer.world, ingame_ui.ui_renderer.gui_retained)
|
World.destroy_gui(ingame_ui.ui_renderer.world, ingame_ui.ui_renderer.gui_retained)
|
||||||
|
@ -4265,7 +4277,11 @@ if ingame_ui_exists then
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/header_fav_arrow",
|
"materials/vmf/header_fav_arrow",
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/search_bar_icon")
|
"materials/vmf/search_bar_icon",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button_hover")
|
||||||
|
|
||||||
gui_retained = World.create_screen_gui(ingame_ui.ui_top_renderer.world,
|
gui_retained = World.create_screen_gui(ingame_ui.ui_top_renderer.world,
|
||||||
"material",
|
"material",
|
||||||
|
@ -4287,7 +4303,11 @@ if ingame_ui_exists then
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/header_fav_arrow",
|
"materials/vmf/header_fav_arrow",
|
||||||
"material",
|
"material",
|
||||||
"materials/vmf/search_bar_icon")
|
"materials/vmf/search_bar_icon",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button",
|
||||||
|
"material",
|
||||||
|
"materials/vmf/mutator_button_hover")
|
||||||
|
|
||||||
World.destroy_gui(ingame_ui.ui_top_renderer.world, ingame_ui.ui_top_renderer.gui)
|
World.destroy_gui(ingame_ui.ui_top_renderer.world, ingame_ui.ui_top_renderer.gui)
|
||||||
World.destroy_gui(ingame_ui.ui_top_renderer.world, ingame_ui.ui_top_renderer.gui_retained)
|
World.destroy_gui(ingame_ui.ui_top_renderer.world, ingame_ui.ui_top_renderer.gui_retained)
|
||||||
|
|
Loading…
Add table
Reference in a new issue