Add a CLEAR_FOG macro...

...for temporarily (for the duration of an event) clearing fog from
specific locations. Requires a helper unit, so also added a separate
dir for these kind of fake units in the units directory.
This commit is contained in:
Lari Nieminen 2007-09-17 17:00:56 +00:00
parent cbb91e9552
commit b3707841bb
3 changed files with 87 additions and 0 deletions

View file

@ -202,6 +202,71 @@
[redraw][/redraw]
#enddef
#define CLEAR_FOG SIDE X Y RADIUS
# Clears fog in a specific area for the given side. This is to be used only
# for the duration of an event: always use {UNCLEAR_FOG} (below) before the
# event exits, or otherwise you'll be left with fake fog clearer units on
# the map.
[if]
[have_unit]
type=Fog Clearer
[/have_unit]
[then]
[set_variable]
name=fog_clearer_i
add=1
[/set_variable]
[/then]
[else]
[set_variable]
name=fog_clearer_i
value=1
[/set_variable]
[/else]
[/if]
[unit]
side={SIDE}
type=Fog Clearer
description=fog_clearer_$fog_clearer_i
x,y={X},{Y}
max_moves={RADIUS}
[/unit]
[store_unit]
[filter]
description=fog_clearer_$fog_clearer_i
[/filter]
kill=no
variable=new_fog_clearer
[/store_unit]
[hide_unit]
x,y=$new_fog_clearer.x,$new_fog_clearer.y
[/hide_unit]
[redraw]
side={SIDE}
[/redraw]
#enddef
#define UNCLEAR_FOG
# Restores fog that was temporarily cleared (check CLEAR_FOG above). Only
# one UNCLEAR_FOG is required no matter how many times CLEAR_FOG was used.
[kill]
type=Fog Clearer
animate=no
fire_event=no
[/kill]
[clear_variable]
name=fog_clearer_i
[/clear_variable]
#enddef
#define SET_LABEL X Y TEXT
# Puts TEXT on the map at X,Y. Strictly a syntactic shortcut.
#

View file

@ -25,6 +25,7 @@
{core/units/trolls/}
{core/units/undead/}
{core/units/wose/}
{core/units/fake/}
{~units}
# * R A C I A L T R A I T S A N D N A M E S *

View file

@ -0,0 +1,21 @@
#textdomain wesnoth-units
# Use this unit to temporarily clear fog around a particular location.
[unit]
id=Fog Clearer
name=""
race=monster
image="misc/blank-hex.png"
hitpoints=1
movement_type=fly
movement=1
experience=1
level=1
alignment=neutral
advanceto=null
cost=1
usage=scout
unit_description=""
hide_help=true
[/unit]