2
* Copyright (C) 2008 Ronald Lamprecht
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
* When a laser is switched on or off this may directly cause an action.
31
* A part of such an action can be another laser switching of the same laser.
32
* To break infinit loops and to avoid laser flickering at a frequency that
33
* the user cannot recognize laser switching is limited. After a switching
34
* a laser stays in a NEW* state where further switch requests are delayed.
36
class LaserStone : public Stone, public TimeHandler {
46
typedef std::list<LaserStone*> InstanceList;
47
static InstanceList instances;
50
static void reemit_all();
52
LaserStone(Direction dir=EAST);
55
virtual std::string getClass() const;
56
virtual LaserStone *clone();
57
virtual void dispose();
58
virtual void setAttr(const string& key, const Value &val);
59
virtual Value message(const Message &m);
61
// StateObject interface
62
virtual int externalState() const;
63
virtual void setState(int extState);
64
virtual void toggleState();
66
// GridObject interface
67
virtual void init_model();
68
virtual void on_creation(GridPos p);
69
virtual void on_removal(GridPos p);
70
virtual DirectionBits emissionDirections() const;
72
// TimeHandler interface
79
Direction getOrientation() const;