From 70f67f351c5d568a1d4cd3d831dfba372f60a7cf Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 19 Aug 2009 09:05:18 +0000 Subject: 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 --- crawl-ref/source/beam.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crawl-ref/source/beam.cc') 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) -- cgit v1.2.3-54-g00ecf