mutators: add a bit of logging
This commit is contained in:
parent
b8caf1d98e
commit
bbd12c1175
3 changed files with 14 additions and 14 deletions
|
@ -64,7 +64,7 @@ local mutators_view = {
|
||||||
self:setup_hooks()
|
self:setup_hooks()
|
||||||
|
|
||||||
self.initialized = true
|
self.initialized = true
|
||||||
--print("INIT")
|
print("[MUTATORS] GUI initialized")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
deinitialize = function(self)
|
deinitialize = function(self)
|
||||||
|
@ -93,7 +93,7 @@ local mutators_view = {
|
||||||
self.map_view = nil
|
self.map_view = nil
|
||||||
|
|
||||||
self.initialized = false
|
self.initialized = false
|
||||||
--print("DEINIT")
|
print("[MUTATORS] GUI deinitialized")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Sorts mutators by title
|
-- Sorts mutators by title
|
||||||
|
@ -212,7 +212,6 @@ local mutators_view = {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local checkbox = self.mutator_checkboxes[1]
|
|
||||||
if #mutators == 0 then
|
if #mutators == 0 then
|
||||||
|
|
||||||
widgets.adventure["no_mutators_text"] = self.widgets.no_mutators_text
|
widgets.adventure["no_mutators_text"] = self.widgets.no_mutators_text
|
||||||
|
@ -251,7 +250,7 @@ local mutators_view = {
|
||||||
|
|
||||||
self.active = true
|
self.active = true
|
||||||
|
|
||||||
--print("ACTIVE!")
|
print("[MUTATORS] GUI activated")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Deactivate on button click or map close
|
-- Deactivate on button click or map close
|
||||||
|
@ -288,7 +287,7 @@ local mutators_view = {
|
||||||
widgets.survival["mutator_checkbox_" .. i] = nil
|
widgets.survival["mutator_checkbox_" .. i] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--print("DEACTIVE")
|
print("[MUTATORS] GUI deactivated")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Changes which muttators are displayed
|
-- Changes which muttators are displayed
|
||||||
|
|
|
@ -102,6 +102,7 @@ local function on_enabled(mutator)
|
||||||
local config = mutator:get_config()
|
local config = mutator:get_config()
|
||||||
dice_manager.addDice(config.dice)
|
dice_manager.addDice(config.dice)
|
||||||
set_lobby_data()
|
set_lobby_data()
|
||||||
|
print("[MUTATORS] Enabled " .. mutator:get_name() .. " (" .. tostring(table.index_of(mutators, mutator)) .. ")")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Called after mutator is disabled
|
-- Called after mutator is disabled
|
||||||
|
@ -109,6 +110,7 @@ local function on_disabled(mutator)
|
||||||
local config = mutator:get_config()
|
local config = mutator:get_config()
|
||||||
dice_manager.removeDice(config.dice)
|
dice_manager.removeDice(config.dice)
|
||||||
set_lobby_data()
|
set_lobby_data()
|
||||||
|
print("[MUTATORS] Disabled " .. mutator:get_name() .. " (" .. tostring(table.index_of(mutators, mutator)) .. ")")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Enables/disables mutator while preserving the sequence in which they were enabled
|
-- Enables/disables mutator while preserving the sequence in which they were enabled
|
||||||
|
@ -155,11 +157,9 @@ local function set_mutator_state(mutator, state)
|
||||||
-- Enable/disable current mutator
|
-- Enable/disable current mutator
|
||||||
-- We're calling methods on the class object because we've overwritten them on the current one
|
-- We're calling methods on the class object because we've overwritten them on the current one
|
||||||
if state then
|
if state then
|
||||||
--print("Enabled ", mutator:get_name(), "!")
|
|
||||||
VMFMod.enable(mutator)
|
VMFMod.enable(mutator)
|
||||||
on_enabled(mutator)
|
on_enabled(mutator)
|
||||||
else
|
else
|
||||||
--print("Disabled ", mutator:get_name(), "!")
|
|
||||||
VMFMod.disable(mutator)
|
VMFMod.disable(mutator)
|
||||||
on_disabled(mutator)
|
on_disabled(mutator)
|
||||||
end
|
end
|
||||||
|
@ -238,14 +238,12 @@ manager.sort_mutators = function()
|
||||||
end
|
end
|
||||||
mutators_sorted = true
|
mutators_sorted = true
|
||||||
|
|
||||||
--[[
|
|
||||||
-- LOG --
|
-- LOG --
|
||||||
|
print("[MUTATORS] Sorted")
|
||||||
for k, v in ipairs(mutators) do
|
for k, v in ipairs(mutators) do
|
||||||
print(k, v:get_name())
|
print(" ", k, v:get_name())
|
||||||
end
|
end
|
||||||
print("-----------")
|
|
||||||
-- /LOG --
|
-- /LOG --
|
||||||
--]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Disables mutators that cannot be enabled right now
|
-- Disables mutators that cannot be enabled right now
|
||||||
|
@ -340,7 +338,6 @@ end
|
||||||
-- Checks current difficulty, map selection screen settings (optionally), incompatible mutators and whether player is server
|
-- Checks current difficulty, map selection screen settings (optionally), incompatible mutators and whether player is server
|
||||||
-- to determine if a mutator can be enabled
|
-- to determine if a mutator can be enabled
|
||||||
local function can_be_enabled(self, ignore_map)
|
local function can_be_enabled(self, ignore_map)
|
||||||
|
|
||||||
if #self:get_incompatible_mutators(true) > 0 then return false end
|
if #self:get_incompatible_mutators(true) > 0 then return false end
|
||||||
return player_is_server() and self:supports_current_difficulty(ignore_map)
|
return player_is_server() and self:supports_current_difficulty(ignore_map)
|
||||||
end
|
end
|
||||||
|
@ -456,6 +453,6 @@ mutators_view:init(mutators_view:get_map_view())
|
||||||
--[[
|
--[[
|
||||||
Testing
|
Testing
|
||||||
--]]
|
--]]
|
||||||
-- manager:dofile("scripts/mods/vmf/modules/mutators/mutator_test")
|
manager:dofile("scripts/mods/vmf/modules/mutators/mutator_test")
|
||||||
-- manager:dofile("scripts/mods/vmf/modules/mutators/mutators/mutation")
|
-- manager:dofile("scripts/mods/vmf/modules/mutators/mutators/mutation")
|
||||||
-- manager:dofile("scripts/mods/vmf/modules/mutators/mutators/deathwish")
|
-- manager:dofile("scripts/mods/vmf/modules/mutators/mutators/deathwish")
|
||||||
|
|
|
@ -51,7 +51,11 @@ true_solo.on_disabled = function() end
|
||||||
|
|
||||||
local onslaught = new_mod("onslaught")
|
local onslaught = new_mod("onslaught")
|
||||||
onslaught:register_as_mutator({
|
onslaught:register_as_mutator({
|
||||||
title = "Onslaught"
|
title = "Onslaught",
|
||||||
|
enable_after_these = {
|
||||||
|
"one_hit_one_kill",
|
||||||
|
"more_rat_weapons"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
onslaught.on_enabled = function() end
|
onslaught.on_enabled = function() end
|
||||||
onslaught.on_disabled = function() end
|
onslaught.on_disabled = function() end
|
||||||
|
|
Loading…
Add table
Reference in a new issue