local enable_debug = false local function trace(str, ...) if enable_debug then printf(str, ...) end end local dbg_increase_thirst_sleep = { sec = "dbg_increase_thirst_sleep", section = function(self) return self.sec end } local dbg_decrease_thirst_sleep = { sec = "dbg_decrease_thirst_sleep", section = function(self) return self.sec end } local dbg_increase_thirst_sleep_small = { sec = "dbg_increase_thirst_sleep_small", section = function(self) return self.sec end } local dbg_decrease_thirst_sleep_small = { sec = "dbg_decrease_thirst_sleep_small", section = function(self) return self.sec end } function change_thirst(perc) if not game_difficulties.get_game_factor("thirst") then trace("thirst not enabled, nothing changed") return end local inc = perc >= 0 local perc = math.abs(perc) if perc <= 1 then perc = round(perc * 100) end for i = 1, perc do if inc then actor_status_thirst.actor_on_item_use(dbg_increase_thirst_sleep) else actor_status_thirst.actor_on_item_use(dbg_decrease_thirst_sleep) end end trace("thirst changed by %s%", perc) end function change_sleep(perc) if not game_difficulties.get_game_factor("sleep") then trace("sleep not enabled, nothing changed") return end local inc = perc >= 0 local perc = math.abs(perc) if perc <= 1 then perc = round(perc * 100) end for i = 1, perc do if inc then actor_status_sleep.actor_on_item_use(dbg_increase_thirst_sleep) else actor_status_sleep.actor_on_item_use(dbg_decrease_thirst_sleep) end end trace("sleep changed by %s%", perc) end function change_thirst_small(perc) if not game_difficulties.get_game_factor("thirst") then trace("thirst not enabled, nothing changed") return end local inc = perc >= 0 local perc = math.abs(perc) if perc <= 1 then perc = round(perc * 100) end for i = 1, perc do if inc then actor_status_thirst.actor_on_item_use(dbg_increase_thirst_sleep_small) else actor_status_thirst.actor_on_item_use(dbg_decrease_thirst_sleep_small) end end trace("thirst changed by %s%", perc * 0.1) end function change_sleep_small(perc) if not game_difficulties.get_game_factor("sleep") then trace("sleep not enabled, nothing changed") return end local inc = perc >= 0 local perc = math.abs(perc) if perc <= 1 then perc = round(perc * 100) end for i = 1, perc do if inc then actor_status_sleep.actor_on_item_use(dbg_increase_thirst_sleep_small) else actor_status_sleep.actor_on_item_use(dbg_decrease_thirst_sleep_small) end end trace("sleep changed by %s%", perc * 0.1) end