00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #include <global.h>
00029 #include <ob_methods.h>
00030 #include <ob_types.h>
00031 #include <sounds.h>
00032 #include <sproto.h>
00033
00034 static method_ret player_changer_type_process(ob_methods *context, object *op);
00035
00039 void init_type_player_changer(void) {
00040 register_process(PLAYER_CHANGER, player_changer_type_process);
00041 }
00042
00056 static method_ret player_changer_type_process(ob_methods *context, object *op) {
00057 object *player;
00058 object *walk;
00059 char c;
00060
00061 if (!op->above || !EXIT_PATH(op))
00062 return METHOD_OK;
00063
00064
00065
00066
00067 if (op->above->type == PLAYER) {
00068
00069 if (execute_event(op, EVENT_TRIGGER, op->above, NULL, NULL, SCRIPT_FIX_NOTHING) != 0)
00070 return METHOD_OK;
00071 player = op->above;
00072 for (walk = op->inv; walk != NULL; walk = walk->below)
00073 apply_changes_to_player(player, walk);
00074
00075 fix_object(player);
00076 esrv_send_inventory(op->above, op->above);
00077 esrv_update_item(UPD_FACE, op->above, op->above);
00078
00079
00080 sscanf(EXIT_PATH(op), "%c", &c);
00081 if (c == '/') {
00082 strcpy(player->contr->savebed_map, EXIT_PATH(op));
00083 player->contr->bed_x = EXIT_X(op);
00084 player->contr->bed_y = EXIT_Y(op);
00085 } else
00086 LOG(llevDebug, "WARNING: destination '%s' in player_changer must be an absolute path!\n", EXIT_PATH(op));
00087
00088 enter_exit(op->above, op);
00089 save_player(player, 1);
00090 }
00091
00092 return METHOD_OK;
00093 }