… | |
… | |
431 | object_freezer freezer; |
431 | object_freezer freezer; |
432 | op->write (freezer); |
432 | op->write (freezer); |
433 | return freezer.as_string (); |
433 | return freezer.as_string (); |
434 | } |
434 | } |
435 | |
435 | |
|
|
436 | char * |
|
|
437 | object::as_string () |
|
|
438 | { |
|
|
439 | return dump_object (this); |
|
|
440 | } |
|
|
441 | |
436 | /* |
442 | /* |
437 | * get_nearest_part(multi-object, object 2) returns the part of the |
443 | * get_nearest_part(multi-object, object 2) returns the part of the |
438 | * multi-object 1 which is closest to the second object. |
444 | * multi-object 1 which is closest to the second object. |
439 | * If it's not a multi-object, it is returned. |
445 | * If it's not a multi-object, it is returned. |
440 | */ |
446 | */ |
… | |
… | |
555 | update_stats (); |
561 | update_stats (); |
556 | |
562 | |
557 | new_draw_info_format (NDI_UNIQUE, 0, this, |
563 | new_draw_info_format (NDI_UNIQUE, 0, this, |
558 | "You try to balance all your items at once, " |
564 | "You try to balance all your items at once, " |
559 | "but the %s is just too much for your body. " |
565 | "but the %s is just too much for your body. " |
560 | "[You need to unapply some items first.]", &ob->name); |
566 | "[You need to unapply some items first - use the 'body' command to see " |
|
|
567 | "how many items you cna wera on a specific body part.]", &ob->name); |
561 | return false; |
568 | return false; |
562 | } |
569 | } |
563 | |
570 | |
564 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
571 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
565 | } |
572 | } |
… | |
… | |
2540 | return splay (tmp); |
2547 | return splay (tmp); |
2541 | |
2548 | |
2542 | return 0; |
2549 | return 0; |
2543 | } |
2550 | } |
2544 | |
2551 | |
|
|
2552 | void |
|
|
2553 | object::force_set_timer (int duration) |
|
|
2554 | { |
|
|
2555 | this->duration = 1; |
|
|
2556 | this->speed_left = -1.f; |
|
|
2557 | |
|
|
2558 | this->set_speed (duration ? 1.f / duration : 0.f); |
|
|
2559 | } |
|
|
2560 | |
2545 | object * |
2561 | object * |
2546 | object::force_add (shstr_tmp name, int duration) |
2562 | object::force_add (shstr_tmp name, int duration) |
2547 | { |
2563 | { |
2548 | if (object *force = force_find (name)) |
2564 | if (object *force = force_find (name)) |
2549 | force->destroy (); |
2565 | force->destroy (); |
2550 | |
2566 | |
2551 | object *force = get_archetype (FORCE_NAME); |
2567 | object *force = get_archetype (FORCE_NAME); |
2552 | |
2568 | |
2553 | force->slaying = name; |
2569 | force->slaying = name; |
2554 | force->stats.food = 1; |
|
|
2555 | force->speed_left = -1.f; |
|
|
2556 | |
2570 | |
2557 | force->set_speed (duration ? 1.f / duration : 0.f); |
2571 | force->force_set_timer (duration); |
2558 | force->flag [FLAG_IS_USED_UP] = true; |
2572 | |
2559 | force->flag [FLAG_APPLIED] = true; |
2573 | force->flag [FLAG_APPLIED] = true; |
2560 | |
2574 | |
2561 | return insert (force); |
2575 | return insert (force); |
2562 | } |
2576 | } |
2563 | |
2577 | |