Advertisement
ThoraldGM

workroom.c

Sep 7th, 2019
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.98 KB | None | 0 0
  1.  
  2. /**************************************************************************
  3.   Updated 12/5/04 by Torvald.
  4.   Room is Portal-enabled to show construct.gif as room picture,
  5.   and displays tv1.gif or tv2.gif based on tv knob in television_look().
  6. **************************************************************************/
  7.  
  8. inherit "/room/room";
  9.  
  10. object *sitting = ({});
  11. int television = 0;
  12.  
  13. int television_look()
  14. {
  15.   string mcode;
  16.   if(!television)
  17.   {
  18.     if(mcode = this_player()->query("3klient_code"))
  19.     {
  20.       set("picture","tv1.gif");
  21.     }
  22.     write("An old 1950's receiver with a knob you can turn.\n");
  23.   }
  24.   else
  25.   {
  26.     if(mcode = this_player()->query("3klient_code"))
  27.     {
  28.       set("picture","tv2.gif");
  29.     }
  30.     write(
  31.     "Peering into the screen you see dark, towering fields where Mystic's\n"+
  32.     "programmers grow players as crops and harvest them for energy.\n");
  33.   }
  34.   return 1;
  35. }
  36.  
  37. int armchairs_look()
  38. {
  39.   int i = sizeof(sitting = filter(sitting,(: $1 :)));
  40.   write("Burgundy leather armchairs with quilted backs. They were once\n"+
  41.         "of fine quality but have been tarnished by years of use.\n");
  42.  
  43.   if(i == 0) write("Both chairs are currently empty.\n");
  44.   else if(i == 1)
  45.     write(sitting[0]->query_name()+" is sitting in an armchair.\n");
  46.   else
  47.   {
  48.     while(i--)
  49.     {
  50.       if(i>1) write(sitting[i]->query_name()+", ");
  51.       else if(i == 1) write(sitting[i]->query_name()+" and ");
  52.       else write(sitting[i]->query_name()+" are sitting in the armchairs.\n");
  53.     } // End of while loop.
  54.   }   // End of else statement.
  55.   return 1;
  56. } // End of armchairs_look fcn.
  57.  
  58. void reset()
  59. {
  60.   room::reset();
  61.   set("picture","construct.gif");
  62.   if(television)
  63.   {
  64.     television = 0;
  65.     tell_room(this_object(), "The tv screen flickers, then shuts off.\n");
  66.   }
  67. }
  68.  
  69. void create()
  70. {
  71.   seteuid("torvald");
  72.   room::create();
  73.   set("picture","construct.gif");
  74.   set_light(1);
  75.   set_short("The Construct");
  76.   set_long(
  77.    "This is the Construct, where the program you call 'reality' is loaded.\n"+
  78.    "It is a brilliant white void that lacks boundaries, echoes, and other\n"+
  79.    "familiar properties of existence. In striking contrast, there are two\n"+
  80.    "armchairs and a vintage television present.\n");
  81.  
  82.   add_item(({"construct"}),
  83.     "The Construct is merely loading space for a computer program");
  84.   add_item(({"knob"}),
  85.     "A small knob on the television. Try turning it and see what happens");
  86.   add_item(({"void", "white void"}),
  87.     "You are surrounded by empty, white expanse in all directions");
  88.   add_item(({"armchair", "armchairs", "chair", "chairs"}),
  89.     (: armchairs_look :));
  90.   add_item(({"television", "screen", "tv", "tv screen"}),
  91.     (: television_look :));
  92.  
  93.   add_exit("/cont1/room/docks", "aloria");
  94.   add_exit("/cont3/room/town/jetty", "nador");
  95.   add_exit("/w/claw/island/rooms/pier2", "isle");
  96.   add_exit("/w/annihilator/boat/rooms/valgaria_dock", "valg");
  97.   add_exit("/cont2/village/dock", "rura");
  98. }
  99.  
  100. void init()
  101. {
  102.   room::init();
  103.   if(filter(query_shadows(this_player()),
  104.     (:function_exists("move",$1):)) != ({}))
  105.     destruct(filter(query_shadows(this_player()),
  106.     (:function_exists("move",$1):))[0]);
  107.  
  108.   add_action("turn_knob","turn");
  109.   add_action("sit_down","sit");
  110.   add_action("stand_up","stand");
  111. }
  112.  
  113. int turn_knob(string str)
  114. {
  115.   if(!str || str != "knob") return 0;
  116.  
  117.   if(!television) {
  118.     write("You turn on the television.\n");
  119.     say(this_player()->query_name()+" turns on the television.\n");
  120.     television = 1;
  121.     return 1;
  122.   }
  123.  
  124.   else
  125.   {
  126.     write("You turn off the television.\n");
  127.     say(this_player()->query_name()+" turns off the television.\n");
  128.     television = 0;
  129.     return 1;
  130.   } // End of else statement.
  131. } // End of turn_knob fcn.
  132.  
  133. int sit_down(string str)
  134. {
  135.   int i = sizeof(sitting=filter(sitting,(: $1 :)));
  136.  
  137.   if(query_sitting(this_player()))
  138.   {
  139.     notify_fail("You are already seated!\n");
  140.     return 0;
  141.   }
  142.  
  143.   if(i == 2)
  144.   {
  145.     write("Get off my lap! These chairs are already taken!\n");
  146.     say(this_player()->query_name()+" tries to sit on your lap!\n");
  147.     return 1;
  148.   }
  149.  
  150.   else
  151.   {
  152.     write("You settle into an armchair.\n");
  153.     say(this_player()->query_name()+" settles into one of the chairs.\n");
  154.     sitting += ({this_player()});
  155.     return 1;
  156.   } // End of else statement.
  157. } // End of sit_down fcn.
  158.  
  159. int stand_up(string str)
  160. {
  161.   if(str && str != "up") return 0;
  162.  
  163.   if(!query_sitting(this_player()))
  164.   {
  165.     notify_fail("You are already standing.\n");
  166.     return 0;
  167.   }
  168.  
  169.   write("You stand up from the chair.\n");
  170.   say(this_player()->query_name()+" stands up from the chair.\n");
  171.   sitting -= ({this_player()});
  172.   return 1;
  173. }
  174.  
  175. int query_sitting(object who) { return (member_array(who,sitting) >= 0); }
  176.  
  177. int exit(object ob)
  178. {
  179.   object who = (ob || previous_object());
  180.   if(query_sitting(who)) sitting -= ({who});
  181.   return 0;
  182. }
  183.  
  184. query_trans_in_shield() { return 1; }
  185. query_trans_out_shield() { return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement