Zesstra | 25387d9 | 2017-02-03 20:20:56 +0100 | [diff] [blame] | 1 | /* Eine Schreibkabine, in der man einigermassen ungestoert seine Post |
| 2 | lesen und schreiben kann. |
| 3 | |
| 4 | (C) 1993/94 by Loco@Morgengrauen |
| 5 | |
| 6 | Verwendung ausserhalb von Morgengrauen ist gestattet unter folgenden |
| 7 | Bedingungen: |
| 8 | - Benutzung erfolgt auf eigene Gefahr. Jegliche Verantwortung wird |
| 9 | abgelehnt. |
| 10 | - Auch in veraenderten oder abgeleiteten Objekten muss ein Hinweis auf |
| 11 | die Herkunft erhalten bleiben. |
| 12 | Ein Update-Service besteht nicht. |
| 13 | |
| 14 | Fuer Fragen, Hinweise und Vorschlaege bitte mich in Morgengrauen oder |
| 15 | Nightfall ansprechen. |
| 16 | */ |
| 17 | |
| 18 | #pragma strong_types,save_types |
| 19 | |
| 20 | #include "/mail/post.h" |
| 21 | #include <config.h> |
| 22 | #include <properties.h> |
| 23 | #include <language.h> |
| 24 | #include <moving.h> |
| 25 | |
| 26 | inherit STDPOST; |
| 27 | inherit "/std/thing/moving"; |
| 28 | inherit "/std/thing/commands"; |
| 29 | |
| 30 | protected void create() { |
| 31 | post::create(); |
| 32 | commands::create(); |
| 33 | SetProp(P_NAME,"Schreibkabine"); |
| 34 | SetProp(P_GENDER,FEMALE); |
| 35 | SetProp(P_SHORT,"Eine Schreibkabine"); |
| 36 | SetProp(P_INT_LONG,"\ |
| 37 | In dieser Kabine kannst Du ungestoert Post lesen und schreiben. Niemand anders\n\ |
| 38 | kann hier rein, solange Du drin bist, dafuer waere die Kabine auch viel zu eng.\n\ |
| 39 | Tippe einfach 'post' oder 'mail', bzw 'mail <spieler>' zum Schreiben.\n\ |
| 40 | Mit 'raus' kommst Du wieder raus.\n"); |
| 41 | SetProp(P_NOGET,"Versuch mal, eine festmontierte Kabine auszubauen!\n"); |
| 42 | AddId("kabine"); |
| 43 | AddId("schreibkabine"); |
| 44 | AddId("postkabine"); |
| 45 | |
| 46 | } |
| 47 | |
| 48 | int besetzt() { |
| 49 | mixed in,i; |
| 50 | in=all_inventory(this_object()); |
| 51 | for (i=0;i<sizeof(in);i++) if (living(in[i]) && in[i]!=this_player()) return 1; |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | public varargs string long() { |
| 56 | return "\ |
| 57 | Eine kleine Ein-Personen-Kabine, in der Du ungestoert Deine Post lesen und\n\ |
| 58 | schreiben kannst. Du kannst sie betreten. \n\ |
| 59 | "+( besetzt() ? "Diese Kabine ist allerdings besetzt.\n" : ""); |
| 60 | } |
| 61 | |
| 62 | string int_short(mixed viewer, mixed viewpoint) { |
| 63 | return (environment()->QueryProp(P_INT_SHORT))+" (Kabine)\n"; |
| 64 | } |
| 65 | |
| 66 | public varargs int move(mixed dest, int method, string dir, string textout, string textin) |
| 67 | { |
| 68 | int r; |
| 69 | r=(::move(dest,method)); |
| 70 | AddExit("raus",object_name(environment())); |
| 71 | return r; |
| 72 | } |
| 73 | |
Arathorn | 306aa03 | 2018-08-29 22:18:28 +0200 | [diff] [blame^] | 74 | public varargs void init(object origin) { |
Zesstra | 25387d9 | 2017-02-03 20:20:56 +0100 | [diff] [blame] | 75 | (commands::init()); |
| 76 | if (environment(this_player())==environment(this_object())) { |
| 77 | add_action("rein","betrete"); |
| 78 | add_action("rein","betritt"); |
| 79 | return; |
| 80 | } |
| 81 | if (besetzt()) { |
| 82 | this_player()->move(environment(this_object()),M_GO,0,"passt hier nicht mehr rein","macht die Tuer einer Kabine auf, aber die ist schon besetzt"); |
| 83 | return; |
| 84 | } |
| 85 | if (environment(this_player())==this_object()) { |
| 86 | (post::init()); |
| 87 | add_action("do_mail","mail"); |
| 88 | add_action("do_mail","post"); |
| 89 | return; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | int rein(string str) { |
| 94 | if (!str || !id(str)) { |
| 95 | notify_fail("Wo willst Du denn rein?\n"); |
| 96 | return 0; |
| 97 | } |
| 98 | if (besetzt()) { |
| 99 | notify_fail("BESETZT!\n"); |
| 100 | return 0; |
| 101 | } |
| 102 | this_player()->move(this_object(),M_GO,0,"betritt eine Schreibkabine","betritt die Kabine"); |
| 103 | return 1; |
| 104 | } |
| 105 | |