Mutators: moving, removig and renaming stuff

This commit is contained in:
bi 2018-05-22 11:52:57 +03:00
parent 59ca071b0f
commit a54d0528d9
9 changed files with 6 additions and 988 deletions

View file

@ -16,12 +16,13 @@ lua = [
"scripts/mods/vmf/*" "scripts/mods/vmf/*"
"scripts/mods/vmf/modules/*" "scripts/mods/vmf/modules/*"
"scripts/mods/vmf/modules/core/*" "scripts/mods/vmf/modules/core/*"
"scripts/mods/vmf/modules/core/mutators/*"
"scripts/mods/vmf/modules/core/mutators/test/*"
"scripts/mods/vmf/modules/debug/*" "scripts/mods/vmf/modules/debug/*"
"scripts/mods/vmf/modules/gui/*" "scripts/mods/vmf/modules/gui/*"
"scripts/mods/vmf/modules/ui/options/*" "scripts/mods/vmf/modules/ui/options/*"
"scripts/mods/vmf/modules/ui/chat/*" "scripts/mods/vmf/modules/ui/chat/*"
"scripts/mods/vmf/modules/ui/mutators/*" "scripts/mods/vmf/modules/ui/mutators/*"
"scripts/mods/vmf/modules/ui/mutators/test/*"
"materials/vmf/vmf_atlas" "materials/vmf/vmf_atlas"
] ]

View file

@ -23,10 +23,10 @@ local _MUTATORS_SORTED = false
local _ALL_MUTATORS_DISABLED = false local _ALL_MUTATORS_DISABLED = false
-- External modules -- External modules
local _DICE_MANAGER = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_dice") local _DICE_MANAGER = vmf:dofile("scripts/mods/vmf/modules/core/mutators/mutators_dice")
local _SET_LOBBY_DATA = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_info") local _SET_LOBBY_DATA = vmf:dofile("scripts/mods/vmf/modules/core/mutators/mutators_info")
local _DEFAULT_CONFIG = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_default_config") local _DEFAULT_CONFIG = vmf:dofile("scripts/mods/vmf/modules/core/mutators/mutators_default_config")
-- List of enabled mutators in case VMF is reloaded in the middle of the game -- List of enabled mutators in case VMF is reloaded in the middle of the game
local _ENABLED_MUTATORS = vmf:persistent_table("enabled_mutators") local _ENABLED_MUTATORS = vmf:persistent_table("enabled_mutators")
@ -501,4 +501,4 @@ end)
-- #################################################################################################################### -- ####################################################################################################################
-- Testing -- Testing
vmf:dofile("scripts/mods/vmf/modules/ui/mutators/test/mutator_test") vmf:dofile("scripts/mods/vmf/modules/core/mutators/test/mutators_test")

View file

@ -1,119 +0,0 @@
# Mutators
A mutator is a mod that affects other players as well as you by modifying the game rules, enemies, weapon balance etc.
You can turn your mod into a mutator by calling `mod:register_as_mutator(config)` instead of `mod:init_state()`. This way it will show up on the map screen and have additional features and options to control its behavior.
Note that you can still have additional options for your mutator in the mod options menu:
``vmf:create_options(options_widgets, false, "Title", "Description")``
## Features
* Show the toggle for the mutator on the map screen
* Choose which game modes and difficulty levels the mutator can be played on
* Add additional dice to the end game roll
* Control the order in which mutators are enabled/disabled
* Control compatibility with other mutators
* Notify players already in the lobby and just joining about enabled mutators
## Configuration
The config object is optional but obviously you'd want to provide at least a readable title for your mutator. Here are the default values:
```lua
{
title = "",
short_title = "",
description = "No description provided",
title_placement = "after",
dice = {
grims = 0,
tomes = 0,
bonus = 0
},
difficulty_levels = {
"easy",
"normal",
"hard",
"harder",
"hardest",
"survival_hard",
"survival_harder",
"survival_hardest"
},
enable_before_these = {},
enable_after_these = {},
incompatible_with_all = false,
compatible_with_all = false,
incompatible_with = {},
compatible_with = {}
}
```
``title = ""``
The full title will show up on the map screen as well as when notifying players of enabled mutators.
``short_title = ""``
The short title will be used in the lobby browser.
``description = "No description provided"``
The description will show up in the tooltip of your mutator on the map screen.
``title_placement = "after"``
The determines where the title of your mod will be placed in the tab menu, the lobby name and chat messages: before all other, after all other or in the middle instead of the regular difficulty name (if it is present).
Possible values: `"before", "after", "replace"`
``dice = { grims = 0, tomes = 0, bonus = 0 }``
This determines how many additional dice the players will get for completing maps with your mutator enabled.
```
difficulty_levels = {
"easy",
"normal",
"hard",
"harder",
"hardest",
"survival_hard",
"survival_harder",
"survival_hardest"
}
```
This determines which difficulty levels your mutator will be available at. First five are for Adventure and the last three are for Last Stand game mode.
You have a few ways to set compatibility with other mutators. Note that this should be used in the cases where combining mutators somehow breaks the game, not for making your mutator special by prohibiting other to be enabled with it:
``incompatible_with_all = false,``
Set this to true if you are sure combining other mutators with yours will cause problems. Exceptions can be specified in `compatible_with` on this or other mutators.
``compatible_with_all = false``
Set this to true if you are sure this mutator won't cause any problems. This overwrites `incompatible_with_all` on other mutators. Exceptions can be specified in `incompatible_with` on this or other mutators.
``compatible_with = {}``
``incompatible_with = {}``
You can provide a list of names of mutators you know for sure yours does/doesn't work with respectively. `compatible_with` overwrites `incompatible_with_all` and `incompatible_with` overwrites `compatible_with_all` on other mutators. Use these to provide exceptions to `incompatible_with_all` and `compatible_with_all` on this mutator.
``enable_before_these = {},``
``enable_after_these = {},``
You can improve the compatibility of your mutator with other ones by specifiying which mutators should be enabled after or before this one. This can help with mutators that modify the same portions of the game.
# Methods
Mutators have the same methods and event handlers as other mods plus a few additional ones. These are mostly used behind the scenes.
``mutator:get_config()`` - returns the configuration object without `enable_before_these/enable_after_these` fields. This shouldn't be modified.
``mutator:can_be_enabled(ignore_map)`` - returns whether the difficulty is right for the mutator and that there are no incompatible mutators enabled. `ignore_map` only takes into account the set difficulty and ignores difficulty selection on the map screen before Play button is pressed.
``mutator:supports_current_difficulty(ignore_map)`` - same as the last one only doesn't check for incompatible mutators
``mutator:get_incompatible_mutators(enabled_only)`` - returns an array of incompatible mutators. `enabled_only` only checks for enabled ones.
The mutators module creates a new mod `vmf_mutator_manager` that has a few additional fields and methods:
`get_mod("vmf_mutator_manager").mutators` - array of all mutators. A mod can be checked for being a mutator: `table.has_item(get_mod("vmf_mutator_manager").mutators, mod)`
`get_mod("vmf_mutator_manager").sort_mutators()` - this sorts the mutators in order they should be enabled/disabled. As this only happens when mutators are first enabled and not when they are added, I decided to expose this method for possible future use.
`get_mod("vmf_mutator_manager").disable_impossible_mutators(notify, everybody)` - disables mutators that can't be enabled on current difficulty settings. This takes into account the difficulty set on the map screen, which is what this was used for at first, but that feature has been disabled due to being annoying. Again, this is exposed for potential future use.

View file

@ -1,451 +0,0 @@
--[[ Add mutators panel to the map view --]]
--@TODO: button highlighted incorrectly
local vmf = get_mod("VMF")
local _MUTATORS = vmf.mutators
--vmf:custom_textures("mutator_button", "mutator_button_hover")
--vmf:inject_materials("ingame_ui", "materials/vmf/mutator_button", "materials/vmf/mutator_button_hover")
local _DEFINITIONS = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_gui_definitions")
local _PER_PAGE = _DEFINITIONS.PER_PAGE
local mutators_view = {
initialized = false,
active = false,
was_active = false,
map_view = nil,
current_page = 1,
mutators_sorted = {},
mutator_checkboxes = {},
init = function(self, map_view)
if self.initialized then return end
self.map_view = map_view
if not self.map_view then return end
self:update_mutator_list()
-- Recreate the map_view scenegraph defs
self.map_view.scenegraph_definition = UISceneGraph.init_scenegraph(_DEFINITIONS.scenegraph_definition)
-- Setup custom widgets
self.widgets = {
banner_mutators = UIWidget.init(_DEFINITIONS.new_widgets.banner_mutators_widget),
mutators_button = UIWidget.init(_DEFINITIONS.new_widgets.mutators_button_widget),
no_mutators_text = UIWidget.init(_DEFINITIONS.new_widgets.no_mutators_text_widget)
}
for i = 1, _PER_PAGE do
table.insert(self.mutator_checkboxes, UIWidget.init(_DEFINITIONS.new_widgets["mutator_checkbox_" .. i]))
end
-- Save widgets we're gonna mess with
local widgets = self.map_view.normal_settings_widget_types
self.saved_widgets = {
level_preview = widgets.adventure.level_preview,
level_preview_text = widgets.adventure.level_preview_text
}
-- Add our button to render lists
widgets.adventure.mutators_button = self.widgets.mutators_button
widgets.survival.mutators_button = self.widgets.mutators_button
self.map_view.advanced_settings_widgets.mutators_button = self.widgets.mutators_button
-- Move other buttons over
self.map_view.ui_scenegraph.settings_button.position[1] = -50
self.map_view.ui_scenegraph.lobby_button.position[1] = 150
self.map_view.ui_scenegraph.friends_button.position[1] = 50
-- Alter level select stepper's callback
self.map_view.steppers.level.callback = function(index_change)
self:on_mutators_page_change(index_change)
end
self:setup_hooks()
self.initialized = true
print("[MUTATORS] GUI initialized")
end,
deinitialize = function(self)
if not self.initialized then return end
self:deactivate()
self.was_active = false
-- Reset the stepper callback
self.map_view.steppers.level.callback = callback(self.map_view, "on_level_index_changed")
-- Remove our button
self.map_view.normal_settings_widget_types.adventure.mutators_button = nil
self.map_view.normal_settings_widget_types.survival.mutators_button = nil
self.map_view.advanced_settings_widgets.mutators_button = nil
-- Move other buttons back
self.map_view.ui_scenegraph.settings_button.position[1] = -100
self.map_view.ui_scenegraph.lobby_button.position[1] = 100
self.map_view.ui_scenegraph.friends_button.position[1] = 0
self.saved_widgets = {}
self:reset_hooks()
self.map_view = nil
self.initialized = false
print("[MUTATORS] GUI deinitialized")
end,
-- Sorts mutators by title
update_mutator_list = function(self)
self.mutators_sorted = {}
for _, mutator in ipairs(_MUTATORS) do
table.insert(self.mutators_sorted, {mutator:get_name(), mutator:get_readable_name()})
end
table.sort(self.mutators_sorted, function(a, b) return string.lower(a[2]) < string.lower(b[2]) end)
end,
update = function(self)
if not self.initialized then
self:init()
end
if not self.initialized or not self.map_view.active then return end
local transitioning = self.map_view:transitioning()
local friends = self.map_view.friends
local friends_menu_active = friends:is_active()
local mutators_button = self.widgets.mutators_button
local mutators_button_hotspot = mutators_button.content.button_hotspot
local settings_button = self.map_view.settings_button_widget
-- Handle menu toggles
if not transitioning and not friends_menu_active then
if mutators_button_hotspot.on_release then
self.map_view:play_sound("Play_hud_select")
mutators_button.content.toggled = not mutators_button.content.toggled
if mutators_button.content.toggled then
settings_button.content.toggled = false
end
elseif settings_button.content.toggled then
mutators_button.content.toggled = false
end
end
-- Open/close mutators view
if mutators_button.content.toggled then
self:activate()
self.was_active = true
else
self:deactivate()
self.was_active = false
end
if self.active then
-- Disable the Mission banner tooltip
local widgets = self.map_view.normal_settings_widget_types
widgets.adventure.banner_level.content.tooltip_hotspot.disabled = true
widgets.survival.banner_level.content.tooltip_hotspot.disabled = true
self:update_checkboxes()
end
end,
-- Sets appropriate text and style to checkboxes, hides/shows them as needed
update_checkboxes = function(self)
local widgets = self.map_view.normal_settings_widget_types
for i = 1, _PER_PAGE do
local current_index = _PER_PAGE * (self.current_page - 1) + i
local checkbox = self.mutator_checkboxes[i]
local hotspot = checkbox.content.button_hotspot
-- Hide if fewer mutators shown than there are checkboxes
if #self.mutators_sorted < current_index then
checkbox.content.setting_text = ""
checkbox.content.tooltip_text = ""
-- Remove from render lists
widgets.adventure["mutator_checkbox_" .. i] = nil
widgets.survival["mutator_checkbox_" .. i] = nil
else
local mutator_info = self.mutators_sorted[current_index]
local mutator = get_mod(mutator_info[1])
-- Set text and tooltip
checkbox.content.setting_text = mutator_info[2]
checkbox.content.tooltip_text = self:generate_tooltip_for(mutator)
-- Add to render lists
widgets.adventure["mutator_checkbox_" .. i] = checkbox
widgets.survival["mutator_checkbox_" .. i] = checkbox
-- Set colors based on whether mutator can be enabled
local active = vmf.mutator_can_be_enabled(mutator)
local color = active and "cheeseburger" or "slate_gray"
local color_hover = active and "white" or "slate_gray"
checkbox.style.setting_text.text_color = Colors.get_color_table_with_alpha(color, 255)
checkbox.style.setting_text_hover.text_color = Colors.get_color_table_with_alpha(color_hover, 255)
checkbox.style.checkbox_style.color = Colors.get_color_table_with_alpha(color_hover, 255)
-- Sound on hover
if hotspot.on_hover_enter then
self.map_view:play_sound("Play_hud_hover")
end
-- Click event
if hotspot.on_release then
self.map_view:play_sound("Play_hud_select")
if mutator:is_enabled() then
vmf.mod_state_changed(mutator:get_name(), false)
else
vmf.mod_state_changed(mutator:get_name(), true)
end
end
checkbox.content.selected = mutator:is_enabled()
end
end
if #_MUTATORS == 0 then
widgets.adventure["no_mutators_text"] = self.widgets.no_mutators_text
widgets.survival["no_mutators_text"] = self.widgets.no_mutators_text
else
widgets.adventure["no_mutators_text"] = nil
widgets.survival["no_mutators_text"] = nil
end
end,
-- Activate on button click or map open
activate = function(self)
if not self.initialized or not self.map_view.active or self.active then return end
-- Widgets
local widgets = self.map_view.normal_settings_widget_types
widgets.adventure.level_preview = nil
widgets.adventure.level_preview_text = nil
widgets.adventure.banner_mutators = self.widgets.banner_mutators
widgets.survival.level_preview = nil
widgets.survival.level_preview_text = nil
widgets.survival.banner_mutators = self.widgets.banner_mutators
-- "Mission" banner position
self.map_view.ui_scenegraph.banner_level_text.position[2] = -10000
-- Update steppers
local level_stepper_widget = self.map_view.steppers.level.widget
local num_pages = math.ceil(#_MUTATORS/_PER_PAGE)
level_stepper_widget.style.setting_text.offset[2] = -10000
level_stepper_widget.style.hover_texture.offset[2] = -10000
level_stepper_widget.content.left_button_hotspot.disable_button = num_pages <= 1
level_stepper_widget.content.right_button_hotspot.disable_button = num_pages <= 1
self.active = true
print("[MUTATORS] GUI activated")
end,
-- Deactivate on button click or map close
deactivate = function(self)
if not self.initialized or not self.active then return end
self.active = false
-- Widgets
local widgets = self.map_view.normal_settings_widget_types
widgets.adventure.level_preview = self.saved_widgets.level_preview
widgets.adventure.level_preview_text = self.saved_widgets.level_preview
widgets.adventure.banner_mutators = nil
widgets.survival.level_preview = self.saved_widgets.level_preview
widgets.survival.level_preview_text = self.saved_widgets.level_preview
widgets.survival.banner_mutators = nil
widgets.adventure["no_mutators_text"] = nil
widgets.survival["no_mutators_text"] = nil
-- "Mission" banner position
self.map_view.ui_scenegraph.banner_level_text.position[2] = 0
-- Update steppers
self.map_view.steppers.level.widget.style.setting_text.offset[2] = -120
self.map_view.steppers.level.widget.style.hover_texture.offset[2] = -19.5
self.map_view:update_level_stepper()
-- Mutator checkboxes
for i = 1, _PER_PAGE do
widgets.adventure["mutator_checkbox_" .. i] = nil
widgets.survival["mutator_checkbox_" .. i] = nil
end
print("[MUTATORS] GUI deactivated")
end,
-- Changes which muttators are displayed
on_mutators_page_change = function(self, index_change)
if not self.initialized then return end
if self.active then
local current_index = self.current_page
local new_index = current_index + index_change
local num_pages = math.ceil(#_MUTATORS/_PER_PAGE)
if new_index < 1 then
new_index = num_pages
elseif num_pages < new_index then
new_index = 1
end
self.current_page = new_index
else
self.map_view:on_level_index_changed(index_change)
end
end,
-- Creates and return text for checkbox tooltip
generate_tooltip_for = function(self, mutator)
local config = mutator:get_config()
local text = ""
-- Show supported difficulty when can't be enabled due to difficulty level
local supports_difficulty = vmf.mutator_supports_current_difficulty(mutator)
if not supports_difficulty then
text = text .. "\n" .. vmf:localize("tooltip_supported_difficulty") .. ":"
for i, difficulty in ipairs(config.difficulty_levels) do
text = text .. (i == 1 and " " or ", ") .. vmf:localize(difficulty)
end
end
-- Show enabled incompatible
local incompatible_mutators = vmf.get_incompatible_mutators(mutator, true)
local currently_compatible = #incompatible_mutators == 0
-- Or all incompatible if difficulty is compatible
if supports_difficulty and #incompatible_mutators == 0 then
incompatible_mutators = vmf.get_incompatible_mutators(mutator)
end
if #incompatible_mutators > 0 then
if currently_compatible and config.incompatible_with_all or #incompatible_mutators == #_MUTATORS - 1 then
-- Show special message when incompatible with all
text = text .. "\n" .. vmf:localize("tooltip_incompatible_with_all")
else
text = text .. "\n" .. vmf:localize("tooltip_incompatible_with") .. ":"
for i, other_mutator in ipairs(incompatible_mutators) do
text = text .. (i == 1 and " " or ", ") .. other_mutator:get_readable_name()
end
end
elseif config.compatible_with_all then
-- Special message when compatible with all
text = text .. "\n" .. vmf:localize("tooltip_compatible_with_all")
end
-- Special message if switched to unsupported difficulty level
if mutator:is_enabled() and not supports_difficulty then
text = text .. "\n" .. vmf:localize("tooltip_will_be_disabled")
end
-- Description
if string.len(text) > 0 then
text = "\n-------------" .. text
end
text = config.description .. text
return text
end,
setup_hooks = function(self)
-- Update the view after map_view has updated
vmf:hook("MapView.update", function(func, map_view, dt, t)
func(map_view, dt, t)
self:update(dt, t)
end)
-- Activate the view on enter if it was active on exit
vmf:hook("MapView.on_enter", function(func, map_view)
func(map_view)
if self.was_active then
self.widgets.mutators_button.content.toggled = true
self:activate()
end
end)
-- Deactivate the view on exit
vmf:hook("MapView.on_exit", function(func, map_view)
func(map_view)
self:deactivate()
end)
-- We don't want to let the game disable steppers when mutators view is active
vmf:hook("MapView.update_level_stepper", function(func, map_view)
if not self.active then
func(map_view)
end
end)
--[[
vmf:hook("MapView.on_level_index_changed", function(func, map_view, ...)
func(map_view, ...)
print("on_level_index_changed")
vmf.disable_impossible_mutators(true)
end)
vmf:hook("MapView.on_difficulty_index_changed", function(func, map_view, ...)
func(map_view, ...)
print("on_difficulty_index_changed")
vmf.disable_impossible_mutators(true)
end)
vmf:hook("MapView.set_difficulty_stepper_index", function(func, map_view, ...)
func(map_view, ...)
print("set_difficulty_stepper_index")
vmf.disable_impossible_mutators(true)
end)
--]]
end,
reset_hooks = function(self)
vmf:hook_remove("MapView.update")
vmf:hook_remove("MapView.on_enter")
vmf:hook_remove("MapView.on_exit")
vmf:hook_remove("MapView.update_level_stepper")
-- vmf:hook_remove("MapView.on_level_index_changed")
-- vmf:hook_remove("MapView.on_difficulty_index_changed")
-- vmf:hook_remove("MapView.set_difficulty_stepper_index")
end,
get_map_view = function(self)
local ingame_ui = Managers.matchmaking and Managers.matchmaking.ingame_ui
return ingame_ui and ingame_ui.views and ingame_ui.views.map_view
end
}
-- Initialize mutators view after map view
vmf:hook("MapView.init", function(func, self, ...)
func(self, ...)
mutators_view:init(self)
end)
-- Destroy mutators view after map view
vmf:hook("MapView.destroy", function(func, ...)
mutators_view:deinitialize()
func(...)
end)
return mutators_view

View file

@ -1,413 +0,0 @@
local vmf = get_mod("VMF")
local definitions = local_require("scripts/ui/views/map_view_definitions")
local scenegraph_definition = definitions.scenegraph_definition
-- Mutators to show per page
definitions.PER_PAGE = 6
-- Button to toggle mutators view
scenegraph_definition.mutators_button = {
vertical_alignment = "bottom",
parent = "banner_party",
horizontal_alignment = "center",
size = {
64,
64
},
position = {
-150,
90,
1
}
}
-- This will replace the Mission text
scenegraph_definition.banner_mutators_text = {
vertical_alignment = "center",
parent = "banner_level",
horizontal_alignment = "center",
size = {
300,
40
},
position = {
0,
0,
1
}
}
scenegraph_definition.no_mutators_text = {
vertical_alignment = "center",
parent = "banner_party",
horizontal_alignment = "center",
size = {
310,
30
},
position = {
0,
520,
1
}
}
local new_widgets = {
-- This will replace the banner behind the Mission text
banner_mutators_widget = UIWidgets.create_texture_with_text_and_tooltip(
"title_bar",
vmf:localize("mutators_title"),
vmf:localize("mutators_banner_tooltip"),
"banner_level",
"banner_mutators_text", {
vertical_alignment = "center",
scenegraph_id = "banner_mutators_text",
localize = false,
font_size = 28,
horizontal_alignment = "center",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("cheeseburger", 255)
},
{
font_size = 24,
max_width = 500,
localize = false,
horizontal_alignment = "left",
vertical_alignment = "top",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255),
line_colors = {},
offset = {
0,
0,
50
}
}
),
-- Button to toggle mutators view
mutators_button_widget = {
element = UIElements.ToggleIconButton,
content = {
click_texture = "octagon_button_clicked",
toggle_hover_texture = "octagon_button_toggled_hover",
toggle_texture = "octagon_button_toggled",
hover_texture = "octagon_button_hover",
normal_texture = "octagon_button_normal",
icon_texture = "map_view_party_button",
icon_hover_texture = "map_view_party_button_lit",
tooltip_text = vmf:localize("mutators_title"),
toggled_tooltip_text = vmf:localize("mutators_title"),
button_hotspot = {}
},
style = {
normal_texture = {
color = {
255,
255,
255,
255
}
},
hover_texture = {
color = {
255,
255,
255,
255
}
},
click_texture = {
color = {
255,
255,
255,
255
}
},
toggle_texture = {
color = {
255,
255,
255,
255
}
},
toggle_hover_texture = {
color = {
255,
255,
255,
255
}
},
icon_texture = {
color = {
255,
255,
255,
255
},
offset = {
0,
0,
1
}
},
icon_hover_texture = {
color = {
255,
255,
255,
255
},
offset = {
0,
0,
1
}
},
icon_click_texture = {
color = {
255,
255,
255,
255
},
offset = {
0,
-1,
1
}
},
tooltip_text = {
font_size = 24,
max_width = 500,
localize = false,
horizontal_alignment = "left",
vertical_alignment = "top",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255),
line_colors = {},
offset = {
0,
0,
20
}
}
},
scenegraph_id = "mutators_button"
},
no_mutators_text_widget = {
element = {
passes = {
{
style_id = "text",
pass_type = "text",
text_id = "text"
},
{
pass_type = "hotspot",
content_id = "tooltip_hotspot"
},
{
style_id = "tooltip_text",
pass_type = "tooltip_text",
text_id = "tooltip_text",
content_check_function = function (ui_content)
return ui_content.tooltip_hotspot.is_hover
end
}
}
},
content = {
text = vmf:localize("no_mutators"),
tooltip_text = vmf:localize("no_mutators_tooltip"),
tooltip_hotspot = {},
color = Colors.get_color_table_with_alpha("slate_gray", 255)
},
style = {
text = {
vertical_alignment = "center",
font_size = 22,
localize = false,
horizontal_alignment = "center",
word_wrap = true,
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("slate_gray", 255),
offset = {
0,
2,
4
}
},
tooltip_text = {
font_size = 24,
max_width = 500,
localize = false,
horizontal_alignment = "left",
vertical_alignment = "top",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255),
line_colors = {},
offset = {
0,
0,
50
}
}
},
scenegraph_id = "no_mutators_text"
}
}
-- Checkboxes
for i = 1, definitions.PER_PAGE do
new_widgets["mutator_checkbox_" .. i] = {
scenegraph_id = "mutator_checkbox_" .. i,
element = {
passes = {
{
pass_type = "hotspot",
content_id = "button_hotspot"
},
{
style_id = "tooltip_text",
pass_type = "tooltip_text",
text_id = "tooltip_text",
content_check_function = function (ui_content)
return ui_content.button_hotspot.is_hover
end
},
{
style_id = "setting_text",
pass_type = "text",
text_id = "setting_text",
content_check_function = function (content)
return not content.button_hotspot.is_hover
end
},
{
style_id = "setting_text_hover",
pass_type = "text",
text_id = "setting_text",
content_check_function = function (content)
return content.button_hotspot.is_hover
end
},
{
pass_type = "texture",
style_id = "checkbox_style",
texture_id = "checkbox_unchecked_texture",
content_check_function = function (content)
return not content.selected
end
},
{
pass_type = "texture",
style_id = "checkbox_style",
texture_id = "checkbox_checked_texture",
content_check_function = function (content)
return content.selected
end
}
}
},
content = {
tooltip_text = "",
checkbox_unchecked_texture = "checkbox_unchecked",
checkbox_checked_texture = "checkbox_checked",
selected = false,
setting_text = "",
button_hotspot = {}
},
style = {
checkbox_style = {
size = {
20,
20
},
offset = {
0,
6,
1
},
color = {
255,
255,
255,
255
}
},
setting_text = {
vertical_alignment = "center",
font_size = 22,
localize = false,
horizontal_alignment = "left",
word_wrap = true,
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("cheeseburger", 255),
offset = {
24,
2,
4
}
},
setting_text_hover = {
vertical_alignment = "center",
font_size = 22,
localize = false,
horizontal_alignment = "left",
word_wrap = true,
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255),
offset = {
24,
2,
4
}
},
tooltip_text = {
font_size = 18,
max_width = 500,
localize = false,
cursor_side = "right",
horizontal_alignment = "left",
vertical_alignment = "top",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255),
line_colors = {},
offset = {
0,
0,
50
},
cursor_offset = {
-10,
-27
}
}
}
}
scenegraph_definition["mutator_checkbox_" .. i] = {
vertical_alignment = "center",
parent = "banner_party",
horizontal_alignment = "left",
size = {
310,
30
},
position = {
30,
520 - 40 * (i - 1),
1
}
}
end
definitions.new_widgets = new_widgets
return definitions