mutators: add a bit of logging

This commit is contained in:
UnShame 2018-02-23 12:48:32 +03:00
parent b8caf1d98e
commit bbd12c1175
3 changed files with 14 additions and 14 deletions

View file

@ -64,7 +64,7 @@ local mutators_view = {
self:setup_hooks()
self.initialized = true
--print("INIT")
print("[MUTATORS] GUI initialized")
end,
deinitialize = function(self)
@ -93,7 +93,7 @@ local mutators_view = {
self.map_view = nil
self.initialized = false
--print("DEINIT")
print("[MUTATORS] GUI deinitialized")
end,
-- Sorts mutators by title
@ -212,7 +212,6 @@ local mutators_view = {
end
end
local checkbox = self.mutator_checkboxes[1]
if #mutators == 0 then
widgets.adventure["no_mutators_text"] = self.widgets.no_mutators_text
@ -251,7 +250,7 @@ local mutators_view = {
self.active = true
--print("ACTIVE!")
print("[MUTATORS] GUI activated")
end,
-- Deactivate on button click or map close
@ -288,7 +287,7 @@ local mutators_view = {
widgets.survival["mutator_checkbox_" .. i] = nil
end
--print("DEACTIVE")
print("[MUTATORS] GUI deactivated")
end,
-- Changes which muttators are displayed

View file

@ -102,6 +102,7 @@ local function on_enabled(mutator)
local config = mutator:get_config()
dice_manager.addDice(config.dice)
set_lobby_data()
print("[MUTATORS] Enabled " .. mutator:get_name() .. " (" .. tostring(table.index_of(mutators, mutator)) .. ")")
end
-- Called after mutator is disabled
@ -109,6 +110,7 @@ local function on_disabled(mutator)
local config = mutator:get_config()
dice_manager.removeDice(config.dice)
set_lobby_data()
print("[MUTATORS] Disabled " .. mutator:get_name() .. " (" .. tostring(table.index_of(mutators, mutator)) .. ")")
end
-- 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
-- We're calling methods on the class object because we've overwritten them on the current one
if state then
--print("Enabled ", mutator:get_name(), "!")
VMFMod.enable(mutator)
on_enabled(mutator)
else
--print("Disabled ", mutator:get_name(), "!")
VMFMod.disable(mutator)
on_disabled(mutator)
end
@ -238,14 +238,12 @@ manager.sort_mutators = function()
end
mutators_sorted = true
--[[
-- LOG --
print("[MUTATORS] Sorted")
for k, v in ipairs(mutators) do
print(k, v:get_name())
print(" ", k, v:get_name())
end
print("-----------")
-- /LOG --
--]]
end
-- 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
-- to determine if a mutator can be enabled
local function can_be_enabled(self, ignore_map)
if #self:get_incompatible_mutators(true) > 0 then return false end
return player_is_server() and self:supports_current_difficulty(ignore_map)
end
@ -456,6 +453,6 @@ mutators_view:init(mutators_view:get_map_view())
--[[
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/deathwish")

View file

@ -51,7 +51,11 @@ true_solo.on_disabled = function() end
local onslaught = new_mod("onslaught")
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_disabled = function() end