388 |
private: |
private: |
389 |
enum State { IDLE, BREAK }; |
enum State { IDLE, BREAK }; |
390 |
State state; |
State state; |
391 |
|
|
392 |
|
void break_me() { |
393 |
|
play_sound("explosion1"); |
394 |
|
state = BREAK; |
395 |
|
set_anim("st-stone_break-anim"); |
396 |
|
} |
397 |
|
|
398 |
void actor_hit(const StoneContact &sc) |
void actor_hit(const StoneContact &sc) |
399 |
{ |
{ |
400 |
if( state == IDLE) |
if( state == IDLE && wielded_item_is(sc.actor, "it-hammer")) { |
401 |
{ |
break_me(); |
|
if (wielded_item_is(sc.actor, "it-hammer")) { |
|
|
play_sound("explosion1"); |
|
|
state = BREAK; |
|
|
set_anim("st-stone_break-anim"); |
|
|
} |
|
402 |
} |
} |
403 |
} |
} |
404 |
|
bool on_laserhit(Direction) { |
405 |
|
break_me(); |
406 |
|
return false; |
407 |
|
} |
408 |
void animcb() { |
void animcb() { |
409 |
if (state == BREAK) { |
if (state == BREAK) { |
410 |
KillStone(get_pos()); |
KillStone(get_pos()); |
411 |
} |
} |
412 |
} |
} |
413 |
}; |
}; |
414 |
|
|
415 |
} |
} |
416 |
|
|
417 |
//---------------------------------------- |
//---------------------------------------- |
722 |
|
|
723 |
/** \page st-wood Wooden Stone |
/** \page st-wood Wooden Stone |
724 |
|
|
725 |
This stone can is movable. If moved into abyss or water it will |
This stone is movable. If moved into abyss or water it will |
726 |
disappear and change into a wooden plank. |
disappear and change into a wooden plank. |
727 |
|
|
728 |
\subsection woode Example |
\subsection woode Example |
1770 |
|
|
1771 |
GridPos p = get_pos(); |
GridPos p = get_pos(); |
1772 |
Item *it = GetItem(p); |
Item *it = GetItem(p); |
1773 |
if (it && 0 == strcmp(it->get_kind(), "it-blocker")) { |
if (it && it->is_kind("it-blocker")) { |
1774 |
KillItem(p); |
KillItem(p); |
1775 |
play_sound("explosion1"); |
play_sound("explosion1"); |
1776 |
} |
} |