… | |
… | |
631 | }, |
631 | }, |
632 | self => { |
632 | self => { |
633 | }, |
633 | }, |
634 | }, |
634 | }, |
635 | }; |
635 | }; |
|
|
636 | |
636 | for my $emotion (keys %$emotes) { |
637 | for my $emotion (keys %$emotes) { |
637 | cf::register_command $emotion => sub { |
638 | cf::register_command $emotion => sub { |
638 | my ($ob, $tname) = @_; |
639 | my ($ob, $tname) = @_; |
639 | |
640 | |
640 | cf::async { |
641 | cf::async { |
641 | my $name = $ob->name; |
642 | my $name = $ob->name; |
642 | |
643 | |
643 | if ($tname eq $name) { |
644 | if ($tname eq $name) { |
644 | my $emote = $emotes->{$emotion}->{self}; |
645 | my $emote = $emotes->{$emotion}->{self}; |
|
|
646 | |
|
|
647 | $emote->{other} = "You look away from <self>." |
|
|
648 | if !$emote->{other}; |
|
|
649 | $emote->{self} = "My god! Is that LEGAL?" |
|
|
650 | if !$emote->{self}; |
|
|
651 | |
645 | $emote->{other} =~ s/<self>/$name/; |
652 | $emote->{other} =~ s/<self>/$name/; |
646 | |
653 | |
647 | for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { |
654 | for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { |
648 | next |
655 | next |
649 | if $other->ob == $ob; |
656 | if $other->ob == $ob; |
… | |
… | |
654 | } elsif ($tname) { |
661 | } elsif ($tname) { |
655 | my $target = cf::player::find $tname |
662 | my $target = cf::player::find $tname |
656 | or return $ob->reply (undef, "$tname is not around."); |
663 | or return $ob->reply (undef, "$tname is not around."); |
657 | |
664 | |
658 | my $emote = $emotes->{$emotion}->{params}; |
665 | my $emote = $emotes->{$emotion}->{params}; |
|
|
666 | |
|
|
667 | $emote->{other} = "<self> is eyeing <other> quizzically." |
|
|
668 | if !$emote->{other}; |
|
|
669 | $emote->{self} = "You are still nuts." |
|
|
670 | if !$emote->{self}; |
|
|
671 | $emote->{target} = "You get the distinct feeling that <other> is nuts." |
|
|
672 | if !$emote->{target}; |
|
|
673 | |
659 | $emote->{self} =~ s/<other>/$tname/; |
674 | $emote->{self} =~ s/<other>/$tname/; |
660 | $emote->{target} =~ s/<self>/$name/; |
675 | $emote->{target} =~ s/<self>/$name/; |
661 | $emote->{other} =~ s/<other>/$tname/; |
676 | $emote->{other} =~ s/<other>/$tname/; |
662 | $emote->{other} =~ s/<self>/$name/; |
677 | $emote->{other} =~ s/<self>/$name/; |
663 | |
678 | |
… | |
… | |
670 | $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); |
685 | $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); |
671 | $ob->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
686 | $ob->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
672 | } else { |
687 | } else { |
673 | my $emote = $emotes->{$emotion}->{noparams}; |
688 | my $emote = $emotes->{$emotion}->{noparams}; |
674 | $emote->{other} =~ s/<self>/$name/; |
689 | $emote->{other} =~ s/<self>/$name/; |
|
|
690 | |
|
|
691 | $emote->{other} = "<self> dances with glee." |
|
|
692 | if !$emote->{other}; |
|
|
693 | $emote->{self} = "You are a nut." |
|
|
694 | if !$emote->{self}; |
675 | |
695 | |
676 | for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { |
696 | for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { |
677 | next |
697 | next |
678 | if $other->ob == $ob; |
698 | if $other->ob == $ob; |
679 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
699 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |