order of possible commands:
Special game commands: WHO, QUIT, etc.
- "home" command
Single-token commands: ", :, ;, +
Exits in the room
@-commands
notify(player, MSG_HUH);
}
+COMMAND (cmd_home) {
+ if (!Mobile(player))
+ return;
+ if (Fixed(player))
+ notify(player, T("You can't do that IC!"));
+ else
+ do_move(player, "home", MOVE_NORMAL);
+}
+
COMMAND (cmd_kick) {
do_kick(player, arg_left);
}
{"GET", NULL, cmd_get, CMD_T_PLAYER | CMD_T_THING | CMD_T_NOGAGGED, NULL},
{"GIVE", "SILENT", cmd_give, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL},
{"GOTO", NULL, cmd_goto, CMD_T_PLAYER | CMD_T_THING, NULL},
+ {"HOME", NULL, cmd_home, CMD_T_PLAYER | CMD_T_THING, NULL},
{"INVENTORY", NULL, cmd_inventory, CMD_T_ANY, NULL},
{"LOOK", "OUTSIDE", cmd_look, CMD_T_ANY, NULL},
* usual processing. Exits have next priority. We still pass them
* through the parser so @hook on GOTO can work on them.
*/
- if (can_move(player, p)) {
+ if (strcasecmp(p, "home") && can_move(player, p)) {
ec = exit_command;
safe_str("GOTO ", exit_command, &ec);
safe_str(p, exit_command, &ec);
/** Attempt to match and execute a command.
* This function performs some sanity checks and then attempts to
- * run a command. It checks, in order: home, built-in commands,
+ * run a command. It checks, in order: built-in commands,
* enter aliases, leave aliases, $commands on neighboring objects or
* the player, $commands on the container, $commands on inventory,
* exits in the zone master room, $commands on objects in the ZMR,
raw_notify(Owner(player), tprintf("#%d] %s", player, msg));
}
- /* important home checking comes first! */
- if (strcmp(command, "home") == 0) {
- if (!Mobile(player))
- return;
- if (Fixed(player))
- notify(player, T("You can't do that IC!"));
- else
- do_move(player, command, 0);
- return;
- }
-
-
strcpy(unp, command);
cptr = command_parse(player, cause, realcause, command, from_port);
int
can_move(dbref player, const char *direction)
{
- if (!strcasecmp(direction, "home") && !Fixed(player) && !RPMODE(player))
- return 1;
-
- /* otherwise match on exits - don't use GoodObject here! */
- return (match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT) !=
+ int ok;
+ if (!strcasecmp(direction, "home")) {
+ ok = !Fixed(player);
+ ok = ok && command_check_byname(player, "HOME");
+ } else {
+ /* otherwise match on exits - don't use GoodObject here! */
+ ok = (match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT) !=
NOTHING);
+ }
+ return ok;
}
static dbref
do_move(dbref player, const char *direction, enum move_type type)
{
dbref exit_m, loc, var_dest;
- if(!strcasecmp(direction, "home") && (RPMODE(player) || Fixed(player))) {
+ if(!strcasecmp(direction, "home") && can_move(player, "home")) {
notify(player, "Not right now pal.");
return;
}
return;
}
#endif
- if (!strcasecmp(direction, "home")) {
+ if (!strcasecmp(direction, "home") && can_move(player, "home")) {
/* send him home */
/* but steal all his possessions */
if (!Mobile(player) || !GoodObject(Home(player)) ||
COMMAND_PROTO(cmd_halt);
COMMAND_PROTO(cmd_helpcmd);
COMMAND_PROTO(cmd_hide);
+COMMAND_PROTO(cmd_home);
COMMAND_PROTO(cmd_hook);
COMMAND_PROTO(cmd_huh_command);
COMMAND_PROTO(cmd_inventory);