Skip to content

Commit

Permalink
UtBS: unified dehydration and stunned theme status icon checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jul 12, 2015
1 parent 5eebd30 commit 7b5dacb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 42 deletions.
19 changes: 1 addition & 18 deletions data/campaigns/Under_the_Burning_Suns/_main.cfg
Expand Up @@ -167,24 +167,7 @@
{UTBS_INCLUDE scenarios}

[lua]
code=<<
local _ = wesnoth.textdomain "wesnoth-utbs"
local old_unit_status = wesnoth.theme_items.unit_status

function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()

if u.status.stunned then
table.insert(s, { "element", { image = "misc/stunned-status-icon.png",
tooltip = _"stunned: This unit is stunned. It cannot enforce its Zone of Control."
} } )
end

return s
end
>>
code="wesnoth.require 'campaigns/Under_the_Burning_Suns/lua/theme.lua'"
[/lua]

#endif
Expand Down
25 changes: 25 additions & 0 deletions data/campaigns/Under_the_Burning_Suns/lua/theme.lua
@@ -0,0 +1,25 @@
-- #textdomain wesnoth-utbs

local _ = wesnoth.textdomain "wesnoth-utbs"
local old_unit_status = wesnoth.theme_items.unit_status

function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()

if u.status.dehydrated then
table.insert(s, { "element", {
image = "misc/dehydration-status.png",
tooltip = _ "dehydrated: This unit is dehydrated. It will lose 4 HP and have its damage reduced by 1 each turn during the day unless prevented by healers or cured by water at an oasis.\n\nUnits cannot be killed or deal no damage as a result of dehydration."
} })
end

if u.status.stunned then
table.insert(s, { "element", { image = "misc/stunned-status-icon.png",
tooltip = _ "stunned: This unit is stunned. It cannot enforce its Zone of Control."
} } )
end

return s
end
24 changes: 0 additions & 24 deletions data/campaigns/Under_the_Burning_Suns/utils/dehydration-utils.cfg
Expand Up @@ -187,30 +187,6 @@ Hd, Dd*, Dd^E*, Rd #enddef
#
# Events
#

[event]
name=preload
first_time_only=no
[lua]
code=<<
local _ = wesnoth.textdomain "wesnoth-utbs"
local old_unit_status = wesnoth.theme_items.unit_status
function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()
if u.status.dehydrated then
table.insert(s, { "element", {
image = "misc/dehydration-status.png",
tooltip = _"dehydrated: This unit is dehydrated. It will lose 4 HP and have its damage reduced by 1 each turn during the day unless prevented by healers or cured by water at an oasis.\n\nUnits cannot be killed or deal no damage as a result of dehydration."
} })
end
return s
end
>>
[/lua]
[/event]

[event]
name=prestart

Expand Down

0 comments on commit 7b5dacb

Please sign in to comment.