bay.txt
snippets · 1.8 KB · 2010-03-30
Small fix for ship launch (do_launch in space.c) for space MUDs.
Download « Back to the snippets list
Just add this, it seems to be all you need to do, the rest of the code is already done.
Gendi.
snippet provided by William McSchmeiter.
** in space.c **
Add to do_launch
At start
SHIP_DATA *onship
if ( ( onship = ship_from_hanger( ship->lastdoc ) ) != NULL && ! onship->bayopen )
{
send_to_char("&RThe hanger is closed!\n\r",ch);
return;
}
void do_openbay( CHAR_DATA *ch, char *argument )
{
SHIP_DATA *ship;
int chance;
if ( (ship = ship_from_cockpit(ch->in_room->vnum)) == NULL )
{
send_to_char("&RYou must be in the cockpit of a ship to do that!\n\r",ch);
return;
}
if ( ship->class > SHIP_PLATFORM )
{
send_to_char("&RThis isn't a spacecraft!\n\r",ch);
return;
}
if ( ship->class == SHIP_PLATFORM )
{
send_to_char("&RPlatforms don't have Bay Doors!\n\r",ch);
return;
}
if ( (ship = ship_from_pilotseat(ch->in_room->vnum)) == NULL )
{
send_to_char("&RYou aren't in the pilots chair!\n\r",ch);
return;
}
/* I have removed this because I don't think it is right to use
but put it back in if you want
if ( autofly(ship) )
{
send_to_char("&RYou'll have to turn off the ships autopilot
first....\n\r",ch);
return;
}
*/
chance = IS_NPC(ch) ? ch->top_level
: (int) (ch->pcdata->learned[gsn_shipsystems]) ;
if ( number_percent( ) > chance )
{
send_to_char("&RYour notsure which switch to flip.\n\r",ch);
learn_from_failure( ch, gsn_shipsystems );
return;
}
act( AT_PLAIN, "$n flips a switch on the control panel.", ch,
NULL, argument , TO_ROOM );
if (ship->bayopen)
{
ship->bayopen = FALSE;
echo_to_cockpit( AT_YELLOW , ship, "Closing bay doors.");
}
else
{
ship->bayopen = TRUE;
echo_to_cockpit( AT_YELLOW , ship, "Opening Bay Doors.");
}
learn_from_success( ch, gsn_shipsystems );
}