MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | /* Einfaches Beispiel zur Demonstration von Vererbung. |
| 2 | ACHTUNG: Dieses Beispiel stellt _kein_ sinnvolles Lebensmittelobjekt dar. |
| 3 | Hierfuer sollte /std/food verwendet werden, siehe auch |
| 4 | /doc/beispiele/food/ |
| 5 | */ |
| 6 | |
| 7 | #include <properties.h> |
| 8 | #include <moving.h> |
| 9 | inherit "/std/thing"; |
| 10 | |
| 11 | protected void create() { |
| 12 | ::create(); |
| 13 | SetProp(P_NAME, "Keks"); |
| 14 | SetProp(P_GENDER, MALE); |
| 15 | AddId(({"keks"})); |
| 16 | AddCmd("iss&@ID", "action_essen", "Was willst du essen?"); |
| 17 | } |
| 18 | |
| 19 | public int action_essen(string cmd) { |
| 20 | if(this_player()->eat_food(1, 0, |
| 21 | "Du bekommst "+QueryPronoun(WEN)+ |
| 22 | " nicht mehr hineingestopft.\n")>0) { |
| 23 | write("Du isst "+name(WEN,1)+".\n"); |
| 24 | say(this_player()->Name(WER)+" isst "+name(WEN)+".\n"); |
| 25 | remove(1); |
| 26 | } |
| 27 | return 1; |
| 28 | } |