diff --git a/res/core/messages.xml b/res/core/messages.xml index c79416c25..b89019aa9 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -14,7 +14,36 @@ your faction with a $resource($item,1). - + + + + + + "$unit($unit) in $region($region): '$order($command)' - Ungültige Zielregion." + "$unit($unit) in $region($region): '$order($command)' - invalid target region." + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - keine Richtung angegeben." + "$unit($unit) in $region($region): '$order($command)' - no direction was specified." + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - In der Zielregion befinden sich noch Einheiten." + "$unit($unit) in $region($region): '$order($command)' - There are units in the target region." + + + diff --git a/scripts/eressea/xmasitems.lua b/scripts/eressea/xmasitems.lua index 666836be4..4f8a20767 100644 --- a/scripts/eressea/xmasitems.lua +++ b/scripts/eressea/xmasitems.lua @@ -6,6 +6,15 @@ local function get_direction(locale, token) return nil end +local function error_message(msg, u, ord) + local msg = message.create(msg) + msg:set_unit("unit", u) + msg:set_region("region", u.region) + msg:set_order("command", ord) + msg:send_faction(u.faction) + return -1 +end + function use_snowglobe(u, amount, token, ord) local transform = { ocean = "glacier", @@ -17,8 +26,7 @@ function use_snowglobe(u, amount, token, ord) if direction then local r = u.region:next(direction) if r.units() then - -- message "target region not empty" - return -1 + return error_message('target_region_not_empty', u, ord) end if r then local trans = transform[r.terrain] @@ -26,15 +34,13 @@ function use_snowglobe(u, amount, token, ord) r.terrain = trans return 1 else - -- message "invalid terrain" + return error_message('target_region_invalid', u, ord) end else - -- message "invalid terrain" + return error_message('target_region_invalid', u, ord) end - else - -- message "need to specify direction" end - return -1 + return error_message('missing_direction', u, ord) end function use_snowman(u, amount)