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() { |
Arathorn | e29b77d | 2021-05-13 21:13:50 +0200 | [diff] [blame^] | 49 | mixed inv,i; |
| 50 | inv=all_inventory(this_object()); |
| 51 | for (i=0;i<sizeof(inv);i++) if (living(inv[i]) && inv[i]!=this_player()) |
| 52 | return 1; |
Zesstra | 25387d9 | 2017-02-03 20:20:56 +0100 | [diff] [blame] | 53 | return 0; |
| 54 | } |
| 55 | |
Arathorn | 657f875 | 2020-12-28 11:24:09 +0100 | [diff] [blame] | 56 | public varargs string long(int mode) { |
Zesstra | 25387d9 | 2017-02-03 20:20:56 +0100 | [diff] [blame] | 57 | return "\ |
| 58 | Eine kleine Ein-Personen-Kabine, in der Du ungestoert Deine Post lesen und\n\ |
| 59 | schreiben kannst. Du kannst sie betreten. \n\ |
| 60 | "+( besetzt() ? "Diese Kabine ist allerdings besetzt.\n" : ""); |
| 61 | } |
| 62 | |
| 63 | string int_short(mixed viewer, mixed viewpoint) { |
| 64 | return (environment()->QueryProp(P_INT_SHORT))+" (Kabine)\n"; |
| 65 | } |
| 66 | |
| 67 | public varargs int move(mixed dest, int method, string dir, string textout, string textin) |
| 68 | { |
| 69 | int r; |
| 70 | r=(::move(dest,method)); |
| 71 | AddExit("raus",object_name(environment())); |
| 72 | return r; |
| 73 | } |
| 74 | |
Arathorn | 306aa03 | 2018-08-29 22:18:28 +0200 | [diff] [blame] | 75 | public varargs void init(object origin) { |
Zesstra | 25387d9 | 2017-02-03 20:20:56 +0100 | [diff] [blame] | 76 | (commands::init()); |
| 77 | if (environment(this_player())==environment(this_object())) { |
| 78 | add_action("rein","betrete"); |
| 79 | add_action("rein","betritt"); |
| 80 | return; |
| 81 | } |
| 82 | if (besetzt()) { |
| 83 | 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"); |
| 84 | return; |
| 85 | } |
| 86 | if (environment(this_player())==this_object()) { |
| 87 | (post::init()); |
| 88 | add_action("do_mail","mail"); |
| 89 | add_action("do_mail","post"); |
| 90 | return; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | int rein(string str) { |
| 95 | if (!str || !id(str)) { |
| 96 | notify_fail("Wo willst Du denn rein?\n"); |
| 97 | return 0; |
| 98 | } |
| 99 | if (besetzt()) { |
| 100 | notify_fail("BESETZT!\n"); |
| 101 | return 0; |
| 102 | } |
| 103 | this_player()->move(this_object(),M_GO,0,"betritt eine Schreibkabine","betritt die Kabine"); |
| 104 | return 1; |
| 105 | } |
| 106 | |