diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/dgnevent.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/luadgn.cc | 1 |
4 files changed, 33 insertions, 2 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. diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 50e3fd5c6a..735bb18e1a 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -30,6 +30,7 @@ REVISION("$Rev$"); #include "cio.h" #include "cloud.h" #include "delay.h" +#include "dgnevent.h" #include "effects.h" #include "enum.h" #include "fight.h" @@ -1850,6 +1851,17 @@ void bolt::hit_wall() // Well, we warned them. } + // Press trigger/switch/button in wall if hit by something solid + // or solid-ish. + if (!is_explosion && !is_tracer && !monster_at(pos()) + && (flavour == BEAM_MISSILE || flavour == BEAM_MMISSILE)) + { + dgn_event event(DET_WALL_HIT, pos());; + event.arg1 = beam_source; + + dungeon_events.fire_vetoable_position_event(event, target); + } + if (affects_wall(feat)) affect_wall(); else if (is_bouncy(feat) && !in_explosion_phase) diff --git a/crawl-ref/source/dgnevent.h b/crawl-ref/source/dgnevent.h index cff604d2c1..4e415ffadb 100644 --- a/crawl-ref/source/dgnevent.h +++ b/crawl-ref/source/dgnevent.h @@ -29,7 +29,8 @@ enum dgn_event_type DET_MONSTER_DIED = 0x0100, DET_ITEM_PICKUP = 0x0200, DET_ITEM_MOVED = 0x0400, - DET_FEAT_CHANGE = 0x0800 + DET_FEAT_CHANGE = 0x0800, + DET_WALL_HIT = 0x1000 }; class dgn_event diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index b092fd246c..c62198de72 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -1457,6 +1457,7 @@ static const char *dgn_event_type_names[] = "none", "turn", "mons_move", "player_move", "leave_level", "entering_level", "entered_level", "player_los", "player_climb", "monster_dies", "item_pickup", "item_moved", "feat_change", + "wall_hit" }; static dgn_event_type dgn_event_type_by_name(const std::string &name) |