--- deliantra/server/common/object.C 2007/07/05 08:10:29 1.164 +++ deliantra/server/common/object.C 2007/08/12 13:10:00 1.177 @@ -301,14 +301,14 @@ return 0; } - //TODO: generate an event or call into perl for additional checks if (ob1->self || ob2->self) { ob1->optimise (); ob2->optimise (); if (ob1->self || ob2->self) - return 0; + if (!cfperl_can_merge (ob1, ob2)) + return 0; } /* Everything passes, must be OK. */ @@ -962,6 +962,12 @@ if (destroy_inventory) destroy_inv (false); + if (is_head ()) + if (sound_destroy) + play_sound (sound_destroy); + else if (flag [FLAG_MONSTER]) + play_sound (sound_find ("monster_destroy")); // quick hack, too lazy to create a generic mechanism + attachable::destroy (); } @@ -1085,28 +1091,24 @@ int check_walk_off = !flag [FLAG_NO_APPLY]; + if (object *pl = ms.player ()) + { + if (pl->container == this) + /* If a container that the player is currently using somehow gets + * removed (most likely destroyed), update the player view + * appropriately. + */ + pl->close_container (); + + pl->contr->ns->floorbox_update (); + } + for (tmp = ms.bot; tmp; tmp = tmp->above) { /* No point updating the players look faces if he is the object * being removed. */ - if (tmp->type == PLAYER && tmp != this) - { - /* If a container that the player is currently using somehow gets - * removed (most likely destroyed), update the player view - * appropriately. - */ - if (tmp->container == this) - { - flag [FLAG_APPLIED] = 0; - tmp->container = 0; - } - - if (tmp->contr->ns) - tmp->contr->ns->floorbox_update (); - } - /* See if object moving off should effect something */ if (check_walk_off && ((move_type & tmp->move_off) @@ -1377,7 +1379,6 @@ top = last->below; } } /* If objects on this space */ - if (flag & INS_MAP_LOAD) top = ms.top; @@ -1427,8 +1428,7 @@ */ if (!(flag & INS_MAP_LOAD)) if (object *pl = ms.player ()) - if (pl->contr->ns) - pl->contr->ns->floorbox_update (); + pl->contr->ns->floorbox_update (); /* If this object glows, it may affect lighting conditions that are * visible to others on this map. But update_all_los is really @@ -2346,7 +2346,6 @@ * * Add a check so we can't pick up invisible objects (0.93.8) */ - int can_pick (const object *who, const object *item) { @@ -2642,13 +2641,10 @@ const materialtype_t * object::dominant_material () const { - if (materialtype_t *mat = name_to_material (materialname)) - return mat; + if (materialtype_t *mt = name_to_material (materialname)) + return mt; - // omfg this is slow, this has to be temporary :) - shstr unknown ("unknown"); - - return name_to_material (unknown); + return name_to_material (shstr_unknown); } void @@ -2674,6 +2670,7 @@ esrv_update_item (UPD_FLAGS, this, old_container); new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); + play_sound (sound_find ("chest_close")); } if (new_container) @@ -2699,6 +2696,7 @@ esrv_update_item (UPD_FLAGS, this, new_container); esrv_send_inventory (this, new_container); + play_sound (sound_find ("chest_open")); } } @@ -2734,4 +2732,3 @@ insert (force); } -