forked from github/server
snowglobe error messages. todo: testing (how?)
This commit is contained in:
parent
e7c23b15db
commit
4952f212b8
2 changed files with 43 additions and 8 deletions
|
@ -14,7 +14,36 @@
|
||||||
your faction with a $resource($item,1).</text>
|
your faction with a $resource($item,1).</text>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
|
<message name="target_region_invalid">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="region" type="region"/>
|
||||||
|
<arg name="command" type="order"/>
|
||||||
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Ungültige Zielregion."</text>
|
||||||
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - invalid target region."</text>
|
||||||
|
</type>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="missing_direction">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="region" type="region"/>
|
||||||
|
<arg name="command" type="order"/>
|
||||||
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - keine Richtung angegeben."</text>
|
||||||
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - no direction was specified."</text>
|
||||||
|
</type>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="target_region_not_empty">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="region" type="region"/>
|
||||||
|
<arg name="command" type="order"/>
|
||||||
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - In der Zielregion befinden sich noch Einheiten."</text>
|
||||||
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - There are units in the target region."</text>
|
||||||
|
</type>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="force_leave_ship" section="events">
|
<message name="force_leave_ship" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
|
@ -6,6 +6,15 @@ local function get_direction(locale, token)
|
||||||
return nil
|
return nil
|
||||||
end
|
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)
|
function use_snowglobe(u, amount, token, ord)
|
||||||
local transform = {
|
local transform = {
|
||||||
ocean = "glacier",
|
ocean = "glacier",
|
||||||
|
@ -17,8 +26,7 @@ function use_snowglobe(u, amount, token, ord)
|
||||||
if direction then
|
if direction then
|
||||||
local r = u.region:next(direction)
|
local r = u.region:next(direction)
|
||||||
if r.units() then
|
if r.units() then
|
||||||
-- message "target region not empty"
|
return error_message('target_region_not_empty', u, ord)
|
||||||
return -1
|
|
||||||
end
|
end
|
||||||
if r then
|
if r then
|
||||||
local trans = transform[r.terrain]
|
local trans = transform[r.terrain]
|
||||||
|
@ -26,15 +34,13 @@ function use_snowglobe(u, amount, token, ord)
|
||||||
r.terrain = trans
|
r.terrain = trans
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
-- message "invalid terrain"
|
return error_message('target_region_invalid', u, ord)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- message "invalid terrain"
|
return error_message('target_region_invalid', u, ord)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
-- message "need to specify direction"
|
|
||||||
end
|
end
|
||||||
return -1
|
return error_message('missing_direction', u, ord)
|
||||||
end
|
end
|
||||||
|
|
||||||
function use_snowman(u, amount)
|
function use_snowman(u, amount)
|
||||||
|
|
Loading…
Reference in a new issue