sa_y.c

skylib_mudos_v1/mudlib/cmds/living/sa_y.c · 1.6 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/* command, trial out by Turrican for a commands daemon. */
#include <language.h>
#include <player.h>
#include <drinks.h>

inherit COMMAND_BASE;
inherit SPEECH_BASE;

mixed cmd(string arg) {
  string word, s1, cur_lang;
  
  if (!arg) 
    arg = "";
  if (arg == "" || arg == " ")
    return notify_fail("Syntax: say <something>\n");

  if(TP->query_gagged()) {
        return notify_fail("You have been gagged!  You will not be able "
            "to say things again until the gag is removed.  Perhaps you should "
            "talk to a creator about this.\n");
   }


  cur_lang = TP->query_current_language();
  
  if (!LANGUAGE_HAND->query_language_spoken(cur_lang))
    return notify_fail(capitalize(cur_lang)+" is not a spoken language.\n");

   if ( !interactive( this_player() ) ) {
      arg = (string)this_player()->convert_message( arg );
      arg = (string)this_player()->fit_message( arg );
   }

  word = query_word_type(arg);
  if(TP->query_volume(D_ALCOHOL))
    arg = drunk_speech(arg);
  // General speech modifications (curses, etc)
  s1 = TP->mangle_speech(arg);
  if (stringp(s1))
    arg = s1;
  arg = de_eight(arg);
  TP->remove_hide_invis( "hiding" );


  if(!environment(TP))
    write("You are in limbo, noone can hear you.\n");
  
  TP->comm_event(environment(TP), "person_say",
     "$one_short:"+file_name(TP)+"$ "+
     "$V$0=" + word + "s," + word + "$V$: ", arg, cur_lang);

  if (cur_lang != "common")
    word += " in "+cur_lang;
  my_mess("You " + word + ": ", arg);

  TP->add_say_history( "You " + word + ": ", arg );

  TP->adjust_time_left(-5);
  return 1;
}

Site Stats

Snippets: 1791
Codebases: 571