665 |
return false; // block light |
return false; // block light |
666 |
} |
} |
667 |
void on_drop(Actor *) { change_state(BURNING); } |
void on_drop(Actor *) { change_state(BURNING); } |
668 |
bool actor_hit(Actor *) { |
bool actor_hit(Actor *a) { |
669 |
// don't pick up burning dynamite |
if (state == BURNING) |
670 |
return (state == IDLE); |
return false; // don't pick up burning dynamite |
671 |
|
|
672 |
|
return Item::actor_hit(a); |
673 |
} |
} |
674 |
const ObjectTraits *get_traits () const { |
const ObjectTraits *get_traits () const { |
675 |
static ObjectTraits traits("it-dynamite", OBJTYPE_Item); |
static ObjectTraits traits("it-dynamite", OBJTYPE_Item); |
876 |
CLONEOBJ(Seed); |
CLONEOBJ(Seed); |
877 |
enum State { IDLE, GROWING } state; |
enum State { IDLE, GROWING } state; |
878 |
|
|
879 |
bool actor_hit(Actor *) { return state==IDLE; } |
bool actor_hit(Actor *a) { |
880 |
|
if (state==GROWING) |
881 |
|
return false; // do not pickup growing seed |
882 |
|
return Item::actor_hit(a); |
883 |
|
} |
884 |
void on_drop(Actor *) { start_growing(); } |
void on_drop(Actor *) { start_growing(); } |
885 |
void on_stonehit(Stone *) { start_growing(); } |
void on_stonehit(Stone *) { start_growing(); } |
886 |
|
|
887 |
void start_growing() { |
void start_growing() { |
888 |
state=GROWING; |
state = GROWING; |
889 |
set_anim("it-seed-growing"); |
set_anim("it-seed-growing"); |
890 |
} |
} |
891 |
|
|
892 |
void animcb() { |
void animcb() { |
893 |
|
KillStone(get_pos()); |
894 |
Stone *st = world::MakeStone("st-wood-growing"); |
Stone *st = world::MakeStone("st-wood-growing"); |
895 |
world::SetStone(get_pos(), st); |
world::SetStone(get_pos(), st); |
896 |
world::KillItem(get_pos()); |
world::KillItem(get_pos()); |
1239 |
set_model(get_inventory_model()); |
set_model(get_inventory_model()); |
1240 |
} |
} |
1241 |
|
|
1242 |
bool actor_hit(Actor */*a*/) { |
bool actor_hit(Actor *a) { |
1243 |
return !active; |
if (active) |
1244 |
|
return false; |
1245 |
|
return Item::actor_hit(a); |
1246 |
} |
} |
1247 |
|
|
1248 |
void on_drop(Actor */*a*/) { activate(); } |
void on_drop(Actor */*a*/) { activate(); } |