Here it is. (My tabs are set to 3 in my eidtor but show up as normal anywhere else <shrug>) < Snip ><act.other.c> /******************************************************************** ** Written by Christopher M. Ryan 7/26/96 ** do_bury & do_dig() ********************************************************************/ /********************************************************************** ** Please note that the way the code is set up all messages that are ** to be displayed to the character use send message so you can't add ** any variable types to your messages that go to the character. **********************************************************************/ const char* msgs[][2] = { {"You start to break some floor boards when you dig.\r\n", "$n starts to break some floor boards as $e starts digging.\r\n" }, {"You wonder if this is a good place after all, with all the gravel.\r\n", "$n breaks a sweat digging up all the gravel here.\r\n" }, {"You make a nice hole while digging up a lot of dirt.\r\n", "$n digs a hole and goes about $s business.\r\n" }, {"You seem to be hitting alot of roots when you dig.\r\n", "$n look like $e is trying to dig up a tree!\r\n" }, {"You dig up more clay than dirt here.\r\n", "$n seems to be digging up alot of clay.\r\n" }, {"You start to chip away at the rock here.\r\n", "$n bangs away at the side of the mountain.\r\n" }, {"You can't dig in the water!\r\n", NULL }, {"You can't dig in the water!\r\n", NULL }, {"You can't dig in the water!\r\n", NULL }, {"You can't dig up air!\r\n", NULL }, /* always keep this as the last message */ { "If you see this please tell a god.\r\n", NULL } }; #pragma argsused ACMD(do_bury) { struct obj_data *obj; half_chop(argument, arg, buf); if (!*arg) { sprintf(buf2, "What do you want to %s?\r\n", CMD_NAME); send_to_char(buf2, ch); return; } if (!(obj = get_obj_in_list_vis(ch, arg, ch->carrying))) { sprintf(buf, "You don't have %s %s.\r\n", AN(arg), arg); send_to_char(buf, ch); return; } /* ** find the sector types that you don't want people ** to be able to dig or bury in. */ if((world[IN_ROOM(ch)].sector_type == SECT_WATER_SWIM) || (world[IN_ROOM(ch)].sector_type == SECT_WATER_NOSWIM) || (world[IN_ROOM(ch)].sector_type == SECT_UNDERWATER) || (world[IN_ROOM(ch)].sector_type == SECT_FLYING)) { /* display the messages if available */ if(msgs[world[IN_ROOM(ch)].sector_type][0] != NULL) send_to_char(msgs[world[IN_ROOM(ch)].sector_type][0], ch); if(msgs[world[IN_ROOM(ch)].sector_type][1] != NULL) act(msgs[world[IN_ROOM(ch)].sector_type][1], TRUE, ch, NULL, NULL, TO_ROOM); return; } /* set a wait state */ WAIT_STATE(ch, 10 RL_SEC); if(msgs[world[IN_ROOM(ch)].sector_type][0] != NULL) send_to_char(msgs[world[IN_ROOM(ch)].sector_type][0], ch); if(msgs[world[IN_ROOM(ch)].sector_type][1] != NULL) act(msgs[world[IN_ROOM(ch)].sector_type][1], TRUE, ch, NULL, NULL, TO_ROOM); act("You bury $a $o here.\r\n", TRUE, ch, obj, NULL, TO_CHAR); act("$n buries $a $o here.\r\n", TRUE, ch, obj, NULL, TO_ROOM); obj_from_char(obj); SET_BIT(GET_OBJ_EXTRA(obj), ITEM_BURIED); obj_to_room(obj, IN_ROOM(ch)); }; #pragma argsused ACMD(do_dig) { struct obj_data *obj; int found_item = 0; /* ** find the sector types that you don't want people ** to be able to dig or bury in. */ if((world[IN_ROOM(ch)].sector_type == SECT_WATER_SWIM) || (world[IN_ROOM(ch)].sector_type == SECT_WATER_NOSWIM) || (world[IN_ROOM(ch)].sector_type == SECT_UNDERWATER) || (world[IN_ROOM(ch)].sector_type == SECT_FLYING)) { /* display the messages if available */ if(msgs[world[IN_ROOM(ch)].sector_type][0] != NULL) send_to_char(msgs[world[IN_ROOM(ch)].sector_type][0], ch); if(msgs[world[IN_ROOM(ch)].sector_type][1] != NULL) act(msgs[world[IN_ROOM(ch)].sector_type][1], TRUE, ch, NULL, NULL, TO_ROOM); return; } /* set a wait state */ WAIT_STATE(ch, 10 RL_SEC); /* ** Now that we have established that we can dig lets go ** ahead and do it! */ if(msgs[world[IN_ROOM(ch)].sector_type][0] != NULL) send_to_char(msgs[world[IN_ROOM(ch)].sector_type][0], ch); if(msgs[world[IN_ROOM(ch)].sector_type][1] != NULL) act(msgs[world[IN_ROOM(ch)].sector_type][1], TRUE, ch, NULL, NULL, TO_ROOM); /* ** search for an object in the room that has a ITEM_BURIED flag */ obj = world[IN_ROOM(ch)].contents; while(obj != NULL) { if(IS_BURIED(obj)) { /* Remove the buried bit so the player can see it. */ REMOVE_BIT(GET_OBJ_EXTRA(obj), ITEM_BURIED); if(CAN_SEE_OBJ(ch, obj)) { found_item = 1; /* player found something */ act("You found $a $o buried here.\r\n", TRUE, ch, obj, NULL, TO_CHAR); act("$n has found $a $o buried here.\r\n", TRUE, ch, obj, NULL, TO_ROOM); obj_from_room(obj); obj_to_char(obj, ch); } else { /* add the bit back becuase the player can't unbury what ** what he can't find... */ SET_BIT(GET_OBJ_EXTRA(obj), ITEM_BURIED); } } /* go to the next obj */ obj = obj->next; } if(!found_item) /* if the player didn't find anything */ send_to_char("Sorry! You didn't find anything.\r\n", ch); } <End Snip> <Snip><Utils.h> #define IS_BURIED(obj) (IS_SET(GET_OBJ_EXTRA(obj), ITEM_BURIED)) // changed CAN_SEE_OBJ to use IS_BURIED #define CAN_SEE_OBJ(sub, obj) \ ((MORT_CAN_SEE_OBJ(sub, obj) && !IS_BURIED(obj)) || PRF_FLAGGED((sub), PRF_HOLYLIGHT)) <End snip> <Snip><Structs.h> #define ITEM_BURIED (1 << 17) /* item is buried */ <end snip> Then you just need to add the other related stuff for the commands. One prob with this command is that Immorts can see the obj even when it is buried if they are using holylight but i feel this is a responsiblility of the immorts and imps to take of... I makes for a cool joke though, just give a mort a buried item and he'll go crazy trying to find a way to see what it is. ;) Chris drizzt@visi.net +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/07/00 PST