3297 |
{ |
{ |
3298 |
class BombStone : public Stone { |
class BombStone : public Stone { |
3299 |
CLONEOBJ(BombStone); |
CLONEOBJ(BombStone); |
3300 |
|
const char *collision_sound() {return "st-stone";} |
3301 |
public: |
public: |
3302 |
BombStone() : Stone("st-bombs") {} |
BombStone() : Stone("st-bombs"),state(IDLE) {} |
3303 |
private: |
private: |
3304 |
|
enum State { IDLE, BREAK }; |
3305 |
|
State state; |
3306 |
void actor_hit(const StoneContact &sc); |
void actor_hit(const StoneContact &sc); |
3307 |
}; |
void change_state (State newstate) { |
3308 |
} |
if (newstate == BREAK) { |
3309 |
|
state = BREAK; |
3310 |
void |
play_sound("explosion1"); |
3311 |
BombStone::actor_hit(const StoneContact &sc) |
set_anim("st-bombs-anim"); |
3312 |
{ |
} |
3313 |
if (player::Inventory *inv = get_inventory(sc.actor)) |
} |
3314 |
{ |
void animcb() { |
3315 |
if (!inv->is_full()) |
if (state == BREAK) |
3316 |
|
KillStone(get_pos()); |
3317 |
|
} |
3318 |
|
void BombStone::message(const string &msg, const Value &) { |
3319 |
|
if (msg =="ignite") |
3320 |
|
change_state(BREAK); |
3321 |
|
} |
3322 |
|
}; |
3323 |
|
} |
3324 |
|
void BombStone::actor_hit(const StoneContact &sc) |
3325 |
|
{ |
3326 |
|
if (player::Inventory *inv = get_inventory(sc.actor)) |
3327 |
|
{ |
3328 |
|
if (!inv->is_full()) |
3329 |
{ |
{ |
3330 |
Item *it = MakeItem("it-blackbomb"); |
Item *it = MakeItem("it-blackbomb"); |
3331 |
inv->add_item(it); |
inv->add_item(it); |