diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-08-19 09:05:18 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-08-19 09:05:18 +0000 |
commit | 70f67f351c5d568a1d4cd3d831dfba372f60a7cf (patch) | |
tree | 6e59e0570046cea17c191d249ecfa565ab5cc544 /crawl-ref/source/acr.cc | |
parent | 9095c0dff2d69101a11fe350c7085e3822c50518 (diff) | |
download | crawl-ref-70f67f351c5d568a1d4cd3d831dfba372f60a7cf.tar.gz crawl-ref-70f67f351c5d568a1d4cd3d831dfba372f60a7cf.zip |
C code for Chapayev's and Eino's request for a wall mounted "switch": if the
player takes a swing at a solid grid (ctrl-direction at it), or it's hit by
a solid-ish beam (normal thrown item, Magic Dart, etc), then a "wall hit"
dungeon event will be issued for that square; a Lua marker can listen to
that event to implement a switch/lever/button.
No Lua glue or Lua convenience classes yet.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10573 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/acr.cc')
-rw-r--r-- | crawl-ref/source/acr.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index f43a5130f4..fedea2c60f 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3007,11 +3007,28 @@ static bool _untrap_target(const coord_def move, bool check_confused) _close_door(move); // for convenience return (true); default: - mpr("You swing at nothing."); + { + bool do_msg = true; + + // Press trigger/switch/button in wall. + if (grid_is_solid(feat)) + { + dgn_event event(DET_WALL_HIT, target); + event.arg1 = NON_MONSTER; + + // Listener can veto the event to prevent the "You swing at + // nothing" message. + do_msg = + dungeon_events.fire_vetoable_position_event(event, + target); + } + if (do_msg) + mpr("You swing at nothing."); make_hungry(3, true); you.turn_is_over = true; return (true); } + } } // Else it's a closed door and needs further handling. |