Skip to content

Commit

Permalink
Fix problem with undestroy UI references and unload from options modu…
Browse files Browse the repository at this point in the history
…le when terminate module
  • Loading branch information
Egzo committed May 11, 2019
1 parent 4324bda commit d2a071b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions game_healthcircle/game_healthcircle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,29 @@ end

function terminate()
healthCircle:destroy()
healthCircle = nil
manaCircle:destroy()
manaCircle = nil
expCircle:destroy()
expCircle = nil
skillCircle:destroy()
skillCircle = nil

healthCircleFront:destroy()
healthCircleFront = nil
manaCircleFront:destroy()
manaCircleFront = nil
expCircleFront:destroy()
expCircleFront = nil
skillCircleFront:destroy()
skillCircleFront = nil

terminateOnHpAndMpChange()
terminateOnGeometryChange()
terminateOnLoginChange()

--Delete from options module
destroyOptionsModule()
end

-------------------------------------------------
Expand Down Expand Up @@ -406,6 +417,17 @@ end
--Option Settings--------------------------------
-------------------------------------------------

optionPanel = nil
healthCheckBox = nil
manaCheckBox = nil
experienceCheckBox = nil
skillCheckBox = nil
chooseSkillComboBox = nil
distFromCenLabel = nil
distFromCenScrollbar = nil
opacityLabel = nil
opacityScrollbar = nil

function addToOptionsModule()
--Add to options module
optionPanel = g_ui.loadUI('option_healthcircle')
Expand Down Expand Up @@ -445,4 +467,19 @@ function addToOptionsModule()
distFromCenScrollbar:setValue(distanceFromCenter)
opacityLabel:setText('Opacity: ' .. opacityCircle)
opacityScrollbar:setValue(opacityCircle * 100)
end

function destroyOptionsModule()
healthCheckBox = nil
manaCheckBox = nil
experienceCheckBox = nil
skillCheckBox = nil
chooseSkillComboBox = nil
distFromCenLabel = nil
distFromCenScrollbar = nil
opacityLabel = nil
opacityScrollbar = nil

modules.client_options.removeTab('Hp Mp Circle')
optionPanel = nil
end
2 changes: 1 addition & 1 deletion game_healthcircle/game_healthcircle.otmod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Module
description: Draw health circle and mana circle in game map.
author: EgzoT, GustavoBlaze, Tekadon58
website: https://github.com/EgzoT/-OTClient-Mod-health_and_mana_circle
version: 1.3.2
version: 1.3.3

autoload: true
autoload-priority: 1000
Expand Down

0 comments on commit d2a071b

Please sign in to comment.