Mutators: refactoring

This commit is contained in:
bi 2018-05-20 16:43:31 +03:00
parent a603ac007c
commit b44dac106e
5 changed files with 231 additions and 264 deletions

View file

@ -6,7 +6,6 @@ return {
},
short_title = "", --@TODO: rename it?
title_placement = "after",
description = "No description provided",
difficulty_levels = {
"easy",
"normal",
@ -21,5 +20,7 @@ return {
incompatible_with_all = false,
compatible_with_all = false,
incompatible_with = {},
compatible_with = {}
compatible_with = {},
enable_before_these = {},
enable_after_these = {}
}

View file

@ -1,32 +1,35 @@
--[[ Notify players of enabled mutators via chat and tab menu --]]
--[[
Notify players of enabled mutators via chat and tab menu
--]]
local vmf = get_mod("VMF")
local mutators = vmf.mutators
local _MUTATORS = vmf.mutators
local were_enabled_before = false
local _WERE_ENABLED_BEFORE = false
-- Assembles a list of enabled mutators
local function add_enabled_mutators_titles_to_string(str, separator, short)
local _mutators = {}
for _, mutator in ipairs(mutators) do
local function add_enabled_mutators_titles_to_string(separator, is_short)
local enabled_mutators = {}
for _, mutator in ipairs(_MUTATORS) do
if mutator:is_enabled() then
table.insert(_mutators, mutator)
table.insert(enabled_mutators, mutator)
end
end
return vmf.add_mutator_titles_to_string(_mutators, str, separator, short)
return vmf.add_mutator_titles_to_string(enabled_mutators, separator, is_short)
end
-- Sets the lobby name
local function set_lobby_data()
if (
not Managers.matchmaking or
if not Managers.matchmaking or
not Managers.matchmaking.lobby or
not Managers.matchmaking.lobby.set_lobby_data or
not Managers.matchmaking.lobby.get_stored_lobby_data
) then return end
then
return
end
local name = add_enabled_mutators_titles_to_string("", " ", true)
local name = add_enabled_mutators_titles_to_string(" ", true) -- @TODO: change separator?
local default_name = LobbyAux.get_unique_server_name()
if string.len(name) > 0 then
@ -45,7 +48,7 @@ end
local function get_peer_id_from_cookie(client_cookie)
local peer_id = tostring(client_cookie)
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, "-"))))
end
peer_id = string.sub(peer_id, 2)
peer_id = string.reverse(peer_id)
@ -56,18 +59,15 @@ local function get_peer_id_from_cookie(client_cookie)
end
-- Append difficulty name with enabled mutators' titles
vmf:hook("IngamePlayerListUI.update_difficulty", function(func, self)
vmf:hook("IngamePlayerListUI.update_difficulty", function(func_, self)
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 ""
--name = add_enabled_mutators_titles_to_string(name, ", ", true)
local name = add_enabled_mutators_titles_to_string("", ", ", true)
local name = add_enabled_mutators_titles_to_string(", ", true)
local localized_difficulty_name = not self.is_in_inn and Localize(difficulty_name) or ""
if name == "" then -- no mutators
name = localized_difficulty_name
elseif localized_difficulty_name ~= "" then -- no difficulty (inn)
elseif localized_difficulty_name ~= "" then -- it can be "" if player is in the inn with no selected level
name = name .. " (" .. localized_difficulty_name .. ")"
end
@ -80,24 +80,24 @@ end)
vmf:hook("MatchmakingStateHostGame.host_game", function(func, self, ...)
func(self, ...)
set_lobby_data()
local names = add_enabled_mutators_titles_to_string("", ", ")
if string.len(names) > 0 then
local names = add_enabled_mutators_titles_to_string(", ")
if names ~= "" then
vmf:chat_broadcast(vmf:localize("broadcast_enabled_mutators") .. ": " .. names)
were_enabled_before = true
elseif were_enabled_before then
_WERE_ENABLED_BEFORE = true
elseif _WERE_ENABLED_BEFORE then
vmf:chat_broadcast(vmf:localize("broadcast_all_disabled"))
were_enabled_before = false
_WERE_ENABLED_BEFORE = false
end
end)
-- Send special messages with enabled mutators list to players just joining the lobby
vmf:hook("MatchmakingManager.rpc_matchmaking_request_join_lobby", function(func, self, sender, client_cookie, host_cookie, lobby_id, friend_join)
local name = add_enabled_mutators_titles_to_string("", ", ")
if string.len(name) > 0 then
vmf:hook("MatchmakingManager.rpc_matchmaking_request_join_lobby", function(func, self, sender, client_cookie, ...)
local name = add_enabled_mutators_titles_to_string(", ")
if name ~= "" then
local message = vmf:localize("whisper_enabled_mutators") .. ": " .. name
vmf:chat_whisper(get_peer_id_from_cookie(client_cookie), message)
end
func(self, sender, client_cookie, host_cookie, lobby_id, friend_join)
func(self, sender, client_cookie, ...)
end)
return set_lobby_data

View file

@ -1,15 +1,6 @@
--[[
INCOMPATIBLE WITH:
COMPATIBLE ONLY WITH: (incompatible with everything except)
]]
--[[ Add ability to turn mods into mutators --]]
Converts mods into mutators
--]]
local vmf = get_mod("VMF")
-- List of mods that are also mutators in order in which they should be enabled
@ -35,7 +26,6 @@ local _MUTATORS_SORTED = false
local _ALL_MUTATORS_DISABLED = false
-- External modules
--local _MUTATORS_VIEW
local _DICE_MANAGER
local _SET_LOBBY_DATA
@ -57,21 +47,41 @@ local function get_index(tbl, o)
return nil
end
-- Adds mutator names from enable_these_after to the list of mutators that should be enabled after the mutator_name
local function update_mutators_sequence(mutator_name, enable_these_after)
if not _MUTATORS_SEQUENCE[mutator_name] then
_MUTATORS_SEQUENCE[mutator_name] = {}
end
for _, other_mutator_name in ipairs(enable_these_after) do
-- Adds mutator names from enable_these_after to the list of mutators that should be enabled after the mutator_name
local function update_mutators_sequence(mutator)
local config = mutator:get_config()
local enable_before_these = config.enable_before_these
local enable_after_these = config.enable_after_these
local mutator_name = mutator:get_name()
if enable_before_these then
_MUTATORS_SEQUENCE[mutator_name] = _MUTATORS_SEQUENCE[mutator_name] or {}
for _, other_mutator_name in ipairs(enable_before_these) do
if _MUTATORS_SEQUENCE[other_mutator_name] and table.contains(_MUTATORS_SEQUENCE[other_mutator_name], mutator_name) then
vmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, other_mutator_name)
elseif not table.contains(_MUTATORS_SEQUENCE[mutator_name], other_mutator_name) then
table.insert(_MUTATORS_SEQUENCE[mutator_name], other_mutator_name)
end
end
end
if enable_after_these then
for _, other_mutator_name in ipairs(enable_after_these) do
_MUTATORS_SEQUENCE[other_mutator_name] = _MUTATORS_SEQUENCE[other_mutator_name] or {}
if _MUTATORS_SEQUENCE[mutator_name] and table.contains(_MUTATORS_SEQUENCE[mutator_name], other_mutator_name) then
vmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, other_mutator_name)
elseif not table.contains(_MUTATORS_SEQUENCE[other_mutator_name], mutator_name) then
table.insert(_MUTATORS_SEQUENCE[other_mutator_name], mutator_name)
end
end
end
end
-- Checks if mutators are compatible both ways
local function is_compatible(mutator, other_mutator)
local config = mutator:get_config()
@ -117,6 +127,7 @@ end
-- 'compatibility.is_mostly_compatible' is 'true' when mutator is not specifically set to be incompatible with
-- all other mutators. All the incompatible mutators will be added to 'compatibility.except'. And vice versa,
-- if 'is_mostly_compatible' is 'false', all the compatible mutators will be added to 'except'.
-- Also, converts given difficulties compatibility to optimized form.
local function update_compatibility(mutator)
-- Create default 'compatibility' entry
@ -168,25 +179,6 @@ local function update_compatibility(mutator)
compatibility.compatible_difficulties_number = compatible_difficulties_number
end
function vmf.temp_show_mutator_compatibility()
print("MUTATORS COMPATIBILITY:")
print("")
for _, mutator in ipairs(_MUTATORS) do
local compatibility = mutator:get_config().compatibility
print(mutator:get_readable_name() .. (compatibility.is_mostly_compatible and "[+]" or "[-]") .. ":")
local ident = compatibility.is_mostly_compatible and " - " or " + "
for other_mutator in pairs(compatibility.except) do
print(ident .. other_mutator:get_readable_name())
end
print("")
end
end
-- Called after mutator is enabled
local function on_enabled(mutator)
@ -276,32 +268,52 @@ vmf.mutators = _MUTATORS
-- # LOCAL #
-- #########
-- Checks current difficulty, map selection screen settings (optionally), incompatible mutators and whether player is server
-- to determine if a mutator can be enabled
function vmf.mutator_can_be_enabled(mutator)
if #vmf.get_incompatible_mutators(mutator, true) > 0 then return false end
return player_is_server() and vmf.mutator_supports_current_difficulty(mutator)
-- Determine if a mutator can be enabled
local function mutator_can_be_enabled(mutator)
-- If conflicting mutators are enabled
local mutator_compatibility_config = mutator:get_config().compatibility
local is_mostly_compatible = mutator_compatibility_config.is_mostly_compatible
local except = mutator_compatibility_config.except
for _, other_mutator in ipairs(_MUTATORS) do
if other_mutator:is_enabled() and other_mutator ~= mutator and
(is_mostly_compatible and except[other_mutator] or not is_mostly_compatible and not except[other_mutator]) then
return false
end
end
-- If player is no longer the server
if not player_is_server() then
return false
end
-- If conflicting difficulty is set (if no difficulty is set, all mutators are allowed)
local actual_difficulty = Managers.state and Managers.state.difficulty:get_difficulty()
local compatible_difficulties = mutator_compatibility_config.compatible_difficulties
return not actual_difficulty or compatible_difficulties[actual_difficulty]
end
-- Appends, prepends and replaces the string with mutator titles
-- M, I
function vmf.add_mutator_titles_to_string(_mutators, str, separator, short)
if #_mutators == 0 then return str end
function vmf.add_mutator_titles_to_string(mutators, separator, is_short)
if #mutators == 0 then
return ""
end
local before = nil
local after = nil
local replace = nil
for _, mutator in ipairs(_mutators) do
for _, mutator in ipairs(mutators) do
local config = mutator:get_config()
local added_name = (short and config.short_title or mutator:get_readable_name())
local added_name = (is_short and config.short_title or mutator:get_readable_name())
if config.title_placement == "before" then
if before then
before = added_name .. separator .. before
else
before = added_name
end
elseif config.title_placement == "replace" then
elseif config.title_placement == "replace" then --@TODO: get rid of replace? Or maybe title_placement as a whole?
if replace then
replace = replace .. separator .. added_name
else
@ -315,7 +327,7 @@ function vmf.add_mutator_titles_to_string(_mutators, str, separator, short)
end
end
end
local new_str = replace or str
local new_str = replace or ""
if before then
new_str = before .. (string.len(new_str) > 0 and separator or "") .. new_str
end
@ -325,65 +337,27 @@ function vmf.add_mutator_titles_to_string(_mutators, str, separator, short)
return new_str
end
-- Returns a list of incompatible with self mutators, all or only enabled ones
-- M, G
function vmf.get_incompatible_mutators(mutator, enabled_only)
local incompatible_mutators = {}
for _, other_mutator in ipairs(_MUTATORS) do
if (
other_mutator ~= mutator and
(not enabled_only or other_mutator:is_enabled()) and
not is_compatible(mutator, other_mutator)
) then
table.insert(incompatible_mutators, other_mutator)
end
end
return incompatible_mutators
end
-- Disables mutators that cannot be enabled right now
-- M, G
function vmf.disable_impossible_mutators(notify, everybody, reason)
local function disable_impossible_mutators(everybody, reason)
local disabled_mutators = {}
for i = #_MUTATORS, 1, -1 do
local mutator = _MUTATORS[i]
if mutator:is_enabled() and not vmf.mutator_can_be_enabled(mutator) then
if mutator:is_enabled() and not mutator_can_be_enabled(mutator) then
vmf.mod_state_changed(mutator:get_name(), false)
table.insert(disabled_mutators, mutator)
end
end
if #disabled_mutators > 0 and notify then
if not reason then reason = "" end
if #disabled_mutators > 0 then
local loc = everybody and "broadcast_disabled_mutators" or "local_disabled_mutators"
local message = vmf:localize(loc) .. " " .. vmf:localize(reason) .. ":"
message = message .. " " .. vmf.add_mutator_titles_to_string(disabled_mutators, "", ", ", false)
message = message .. " " .. vmf.add_mutator_titles_to_string(disabled_mutators, ", ", false)
if everybody then
vmf:chat_broadcast(message)
else
vmf:echo(message)
end
end
return disabled_mutators
end
-- Only checks difficulty
-- M, G
function vmf.mutator_supports_current_difficulty(mutator)
local mutator_difficulty_levels = mutator:get_config().difficulty_levels
local actual_difficulty = Managers.state and Managers.state.difficulty:get_difficulty()
local right_difficulty = not actual_difficulty or table.contains(mutator_difficulty_levels, actual_difficulty)
local right_unapplied_difficulty = false
local map_view_exists, map_view = pcall(function () return Managers.matchmaking.ingame_ui.views.map_view end)
local map_view_active = map_view_exists and map_view.active
if map_view_active then
local difficulty_data = map_view.selected_level_index and map_view:get_difficulty_data(map_view.selected_level_index)
local difficulty_layout = difficulty_data and difficulty_data[map_view.selected_difficulty_stepper_index]
local difficulty_key = difficulty_layout and difficulty_layout.key
right_unapplied_difficulty = difficulty_key and table.contains(mutator_difficulty_levels, difficulty_key)
end
return (map_view_active and right_unapplied_difficulty) or (not map_view_active and right_difficulty)
end
-- ##########
@ -407,25 +381,11 @@ function vmf.register_mod_as_mutator(mod, config)
mod._data.config = _config
update_compatibility(mod)
local mod_name = mod:get_name()
-- @TODO: probably move these 2 blocks to the function of something like that
if config.enable_before_these then
update_mutators_sequence(mod_name, config.enable_before_these)
end
if config.enable_after_these then
for _, other_mod_name in ipairs(config.enable_after_these) do
update_mutators_sequence(other_mod_name, {mod_name})
end
end
update_mutators_sequence(mod)
table.insert(_MUTATORS, mod)
_MUTATORS_SORTED = false
--_MUTATORS_VIEW:update_mutator_list()
end
-- Enables/disables mutator while preserving the sequence in which they were enabled
@ -476,7 +436,7 @@ end
-- Check if player is still hosting (on update)
function vmf.check_mutators_state()
if not _ALL_MUTATORS_DISABLED and not player_is_server() then
vmf.disable_impossible_mutators(true, false, "disabled_reason_not_server")
disable_impossible_mutators(false, "disabled_reason_not_server")
_ALL_MUTATORS_DISABLED = true
end
end
@ -486,12 +446,32 @@ function vmf.is_mutator_enabled(mutator_name)
return _ENABLED_MUTATORS[mutator_name]
end
function vmf.temp_show_mutator_compatibility()
print("MUTATORS COMPATIBILITY:")
print("")
for _, mutator in ipairs(_MUTATORS) do
local compatibility = mutator:get_config().compatibility
print(mutator:get_readable_name() .. (compatibility.is_mostly_compatible and "[+]" or "[-]") .. ":")
local ident = compatibility.is_mostly_compatible and " - " or " + "
for other_mutator in pairs(compatibility.except) do
print(ident .. other_mutator:get_readable_name())
end
print("")
end
end
-- ####################################################################################################################
-- ##### Hooks ########################################################################################################
-- ####################################################################################################################
vmf:hook("DifficultyManager.set_difficulty", function(func, self, difficulty)
vmf.disable_impossible_mutators(true, true, "disabled_reason_difficulty_change")
disable_impossible_mutators(true, "disabled_reason_difficulty_change")
return func(self, difficulty)
end)
@ -501,13 +481,9 @@ end)
_DEFAULT_CONFIG = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_default_config")
--_MUTATORS_VIEW = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_gui")
_DICE_MANAGER = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_dice")
_SET_LOBBY_DATA = vmf:dofile("scripts/mods/vmf/modules/ui/mutators/mutator_info")
-- Initialize mutators view when map_view has been initialized already
--_MUTATORS_VIEW:init(_MUTATORS_VIEW:get_map_view())
-- Testing
vmf:dofile("scripts/mods/vmf/modules/ui/mutators/test/mutator_test")
--vmf:dofile("scripts/mods/vmf/modules/ui/mutators/test/mutation")

View file

@ -1,6 +1,5 @@
local vmf = get_mod("VMF")
local _MUTATORS = vmf.mutators
local _SELECTED_DIFFICULTY_KEY -- Currently selected difficulty in the map view.
@ -18,7 +17,6 @@ local _IS_MUTATOR_LIST_VISIBLE -- 'true' if Mutator view is active, 'false' if P
local _CURRENT_PAGE_NUMBER
local _TOTAL_PAGES_NUMBER
local _IS_MUTATORS_GUI_INITIALIZED = false
-- ####################################################################################################################
@ -121,8 +119,7 @@ local function calculate_tooltip_offset (widget_content, widget_style, ui_render
end
end
-- Callback function for mutator widgets. It's not defined in definitions file because it works with
-- mutators array and vmf.various_internal_functions.
-- Callback function for mutator widgets. It's not defined in definitions file because it works with mutators array.
local function offset_function_callback(ui_scenegraph_, style, content, ui_renderer)
local mutator = content.mutator
@ -150,7 +147,7 @@ local function offset_function_callback(ui_scenegraph_, style, content, ui_rende
-- Enable/disable mutator.
if content.highlight_hotspot.on_release then
if mutator:is_enabled() then
vmf.set_mutator_state(mutator, false, false)
vmf.set_mutator_state(mutator, false, false) --@TODO: change method?
elseif can_be_enabled then
vmf.set_mutator_state(mutator, true, false)
end

View file

@ -1,10 +1,11 @@
local vmf = get_mod("VMF")
local mod
local mod_data
----------------------------------------------------------------------------------
local mutator555 = new_mod("mutator555")
mod = new_mod("test_legendary")
mod_data = {}
mod_data.name = "Legendary"
mod_data.description = "Legendary description"
@ -12,34 +13,33 @@ mod_data.is_mutator = true
mod_data.mutator_settings = {
incompatible_with_all = true,
compatible_with = {
--"mutator3"
"test_something"
}
--title = "Legendary"
}
mutator555:initialize_data(mod_data)
mutator555.on_enabled = function(init_call) mutator555:echo("Legendary on_enabled(" .. (init_call and "init)" or ")")) end
mutator555.on_disabled = function(init_call) mutator555:echo("Legendary on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mutator555)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("Legendary on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("Legendary on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local mutator3 = new_mod("mutator3")
mod = new_mod("test_something")
mod_data = {}
mod_data.name = "Something"
mod_data.is_mutator = true
mod_data.mutator_settings = {
incompatible_with = {
"mutator4"
},
--title = "Something"
"test_true_solo",
"test_slayer"
}
}
mutator3:initialize_data(mod_data)
mutator3.on_enabled = function(init_call) mutator3:echo("Something on_enabled(" .. (init_call and "init)" or ")")) end
mutator3.on_disabled = function(init_call) mutator3:echo("Something on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mutator3)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("Something on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("Something on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local mutator2 = new_mod("mutator2")
mod = new_mod("test_deathwish")
mod_data = {}
mod_data.name = "?Deathwish"
mod_data.is_mutator = true
@ -48,17 +48,16 @@ mod_data.mutator_settings = {
"hardest",
"survival_hardest"
},
--title = "?Deathwish",
title_placement = "after"
}
mutator2:initialize_data(mod_data)
mutator2.on_enabled = function(init_call) mutator3:echo("?Deathwish on_enabled(" .. (init_call and "init)" or ")")) end
mutator2.on_disabled = function(init_call) mutator3:echo("?Deathwish on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mutator2)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("?Deathwish on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("?Deathwish on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local slayer = new_mod("slayer")
mod = new_mod("test_slayer")
mod_data = {}
mod_data.name = "Slayer's Oath"
mod_data.is_mutator = true
@ -67,179 +66,173 @@ mod_data.mutator_settings = {
"survival_hard",
"survival_harder",
"survival_hardest"
},
--title = "Slayer's Oath"
}
}
slayer:initialize_data(mod_data)
slayer.on_enabled = function(init_call) mutator3:echo("Slayer's Oath on_enabled(" .. (init_call and "init)" or ")")) end
slayer.on_disabled = function(init_call) mutator3:echo("Slayer's Oath on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(slayer)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("Slayer's Oath on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("Slayer's Oath on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local true_solo = new_mod("true_solo")
mod = new_mod("test_true_solo")
mod_data = {}
mod_data.name = "True Solo"
mod_data.is_mutator = true
mod_data.mutator_settings = {
compatible_with_all = true,
--title = "True Solo",
title_placement = "before"
}
true_solo:initialize_data(mod_data)
true_solo.on_enabled = function(init_call) mutator3:echo("True Solo on_enabled(" .. (init_call and "init)" or ")")) end
true_solo.on_disabled = function(init_call) mutator3:echo("True Solo on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(true_solo)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("True Solo on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("True Solo on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local onslaught = new_mod("onslaught")
mod = new_mod("test_onslaught")
mod_data = {}
mod_data.name = "Onslaught"
mod_data.is_mutator = true
--mod_data.mutator_settings = {
-- title = "Onslaught"
--}
onslaught:initialize_data(mod_data)
onslaught.on_enabled = function(init_call) mutator3:echo("Onslaught on_enabled(" .. (init_call and "init)" or ")")) end
onslaught.on_disabled = function(init_call) mutator3:echo("Onslaught on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(onslaught)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("Onslaught on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("Onslaught on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local one_hit_one_kill = new_mod("one_hit_one_kill")
mod = new_mod("test_one_hit_one_kill")
mod_data = {}
mod_data.name = "One Hit One Kill"
mod_data.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt placerat nulla eget pharetra. Vivamus consequat tristique vestibulum. Nullam vitae feugiat arcu, non porta ante. Phasellus consequat facilisis quam quis dignissim"
mod_data.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt placerat" ..
" nulla eget pharetra. Vivamus consequat tristique vestibulum. Nullam vitae feugiat arcu," ..
" non porta ante. Phasellus consequat facilisis quam quis dignissim"
mod_data.is_mutator = true
mod_data.mutator_settings = {
--title = "One Hit One Kill",
difficulty_levels = {"hardest"},
enable_after_these = {"more_rat_weapons"}
enable_after_these = {"test_more_rats_weapons"}
}
one_hit_one_kill:initialize_data(mod_data)
one_hit_one_kill.on_enabled = function(init_call) mutator3:echo("One Hit One Kill on_enabled(" .. (init_call and "init)" or ")")) end
one_hit_one_kill.on_disabled = function(init_call) mutator3:echo("One Hit One Kill on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(one_hit_one_kill)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("One Hit One Kill on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("One Hit One Kill on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local ayyyy = new_mod("ayyyy")
mod = new_mod("ayyyy")
mod_data = {}
mod_data.name = "ayyyy"
mod_data.is_mutator = true
ayyyy:initialize_data(mod_data)
ayyyy.on_enabled = function(init_call) mutator3:echo("ayyyy on_enabled(" .. (init_call and "init)" or ")")) end
ayyyy.on_disabled = function(init_call) mutator3:echo("ayyyy on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(ayyyy)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("ayyyy on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("ayyyy on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local lmao = new_mod("lmao")
mod = new_mod("lmao")
mod_data = {}
mod_data.name = "lmao"
mod_data.is_mutator = true
mod_data.mutator_settings = {
--title = "One Hit One Kill",
difficulty_levels = {"hardest"},
enable_after_these = {"ayyyy"}
}
lmao:initialize_data(mod_data)
lmao.on_enabled = function(init_call) mutator3:echo("lmao on_enabled(" .. (init_call and "init)" or ")")) end
lmao.on_disabled = function(init_call) mutator3:echo("lmao on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(lmao)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("lmao on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("lmao on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
----------------------------------------------------------------------------------
local more_rat_weapons = new_mod("more_rat_weapons")
mod = new_mod("test_more_rats_weapons")
mod_data = {}
mod_data.name = "More Rat Weapons"
mod_data.is_mutator = true
mod_data.mutator_settings = {
compatible_with_all = true,
--title = "More Rat Weapons",
difficulty_levels = {"hardest"}
}
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("111")
--[[ -- scrollbar test
mod = new_mod("111")
mod_data = {}
mod_data.name = "111"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("111 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("111 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("222")
mod = new_mod("222")
mod_data = {}
mod_data.name = "222"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("222 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("222 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("333")
mod = new_mod("333")
mod_data = {}
mod_data.name = "333"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("333 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("333 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("444")
mod = new_mod("444")
mod_data = {}
mod_data.name = "444"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("444 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("444 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("555")
mod = new_mod("555")
mod_data = {}
mod_data.name = "555"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("555 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("555 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("666")
mod = new_mod("666")
mod_data = {}
mod_data.name = "666"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("666 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("666 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("777")
mod = new_mod("777")
mod_data = {}
mod_data.name = "777"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("777 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("777 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
more_rat_weapons = new_mod("888")
mod = new_mod("888")
mod_data = {}
mod_data.name = "888"
mod_data.is_mutator = true
more_rat_weapons:initialize_data(mod_data)
more_rat_weapons.on_enabled = function(init_call) mutator3:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
more_rat_weapons.on_disabled = function(init_call) mutator3:echo("More Rat Weapons on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(more_rat_weapons)
mod:initialize_data(mod_data)
mod.on_enabled = function(init_call) mod:echo("888 on_enabled(" .. (init_call and "init)" or ")")) end
mod.on_disabled = function(init_call) mod:echo("888 on_disabled(" .. (init_call and "init)" or ")")) end
vmf.initialize_mod_state(mod)
]]