diff options
Diffstat (limited to 'crawl-ref/source/dat/clua/lm_1way.lua')
-rw-r--r-- | crawl-ref/source/dat/clua/lm_1way.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/clua/lm_1way.lua b/crawl-ref/source/dat/clua/lm_1way.lua new file mode 100644 index 0000000000..6ce1e6d722 --- /dev/null +++ b/crawl-ref/source/dat/clua/lm_1way.lua @@ -0,0 +1,35 @@ +------------------------------------------------------------------------------ +-- lm_1way.lua: +-- One-way stair marker. +------------------------------------------------------------------------------ + +OneWayStair = { } +OneWayStair.__index = OneWayStair + +function OneWayStair.new() + local ows = { } + setmetatable(ows, OneWayStair) + return ows +end + +function OneWayStair:activate(marker) + local ev = dgn.dgn_event_type('player_climb') + dgn.register_listener(ev, marker, marker:pos()) +end + +function OneWayStair:event(marker, ev) + if ev:type() == dgn.dgn_event_type('player_climb') then + local x, y = ev:pos() + dgn.terrain_changed(x, y, 'floor', false) + dgn.remove_listener(marker, ev:pos()) + dgn.remove_marker(marker) + end +end + +function OneWayStair.read(marker, th) + return OneWayStair.new() +end + +function one_way_stair() + return OneWayStair.new() +end |