src/hcode/btech/p.mech.startup.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void mech_startup (dbref player, void *data, char *buffer)
void mech_shutdown (dbref player, void *data, char *buffer)


Function Documentation

void mech_shutdown ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 272 of file mech.startup.c.

References CheckData(), CLASS_BSUIT, CLASS_MECH, CLASS_MW, CLASS_VEH_NAVAL, DOCHECK, domino_space(), EVENT_FALL, FALL_TICK, is_aero, IsDS, Jumping, Landed, mech_fall_event(), mech_notify(), mech_printf(), MECHALL, MechCritStatus, MECHEVENT, MechFalls(), MechLOSBroadcast(), MechMove, MechPilot, MechSpeed, MECHSTARTED, MechStatus, MechStatus2, MechType, MechUpperElevation, MechZ, MOVE_HOVER, MOVE_NONE, MOVE_TRACK, MOVE_VTOL, MOVE_WHEEL, MP1, ORBIT_Z, Shutdown, SLITE_LIT, SLITE_ON, Started, Starting, StopStartup, TORSO_LEFT, TORSO_RIGHT, and Wiz.

Referenced by auto_command_shutdown(), auto_radio_command_shutdown(), CheckEdgeOfMap(), common_checks(), FailureComputerShutdown(), Leave_DS_Bay(), Leave_Hangar(), move_mech(), and ShutDownMap().

00273 {
00274         MECH *mech = (MECH *) data;
00275 
00276         if(!CheckData(player, mech))
00277                 return;
00278         DOCHECK((!Started(mech) && !Starting(mech)),
00279                         "The 'mech hasn't been started yet!");
00280         DOCHECK(MechType(mech) == CLASS_MW,
00281                         "You snore for a while.. and then _start_ yourself back up.");
00282         DOCHECK(IsDS(mech) && !Landed(mech) && !Wiz(player),
00283                         "No shutdowns in mid-air! Are you suicidal?");
00284         if(MechPilot(mech) == -1)
00285                 return;
00286         if(Starting(mech)) {
00287                 mech_notify(mech, MECHALL, "The startup sequence has been aborted.");
00288                 StopStartup(mech);
00289                 MechPilot(mech) = -1;
00290                 return;
00291         }
00292         mech_printf(mech, MECHALL, "%s has been shutdown!",
00293                                 IsDS(mech) ? "Dropship" : is_aero(mech) ? "Fighter" :
00294                                 MechType(mech) == CLASS_BSUIT ? "Suit" : ((MechMove(mech) ==
00295                                                                                                                    MOVE_HOVER)
00296                                                                                                                   || (MechMove(mech)
00297                                                                                                                           == MOVE_TRACK)
00298                                                                                                                   || (MechMove(mech)
00299                                                                                                                           ==
00300                                                                                                                           MOVE_WHEEL)) ?
00301                                 "Vehicle" : MechMove(mech) == MOVE_VTOL ? "VTOL" : "Mech");
00302 
00303         /*
00304          * Fixed by Kipsta so searchlights shutoff when the mech shuts down
00305          */
00306 
00307         if(MechStatus2(mech) & SLITE_ON) {
00308                 mech_notify(mech, MECHALL, "Your searchlight shuts off.");
00309                 MechStatus2(mech) &= ~SLITE_ON;
00310                 MechCritStatus(mech) &= ~SLITE_LIT;
00311         }
00312 
00313         if(MechStatus(mech) & TORSO_RIGHT) {
00314                 mech_notify(mech, MECHSTARTED,
00315                                         "Torso rotated back to center for shutdown");
00316                 MechStatus(mech) &= ~TORSO_RIGHT;
00317         }
00318         if(MechStatus(mech) & TORSO_LEFT) {
00319                 mech_notify(mech, MECHSTARTED,
00320                                         "Torso rotated back to center for shutdown");
00321                 MechStatus(mech) &= ~TORSO_LEFT;
00322         }
00323         if(MechMove(mech) != MOVE_NONE && MechType(mech) != CLASS_VEH_NAVAL &&
00324            ((MechType(mech) == CLASS_MECH && Jumping(mech)) ||
00325                 (MechType(mech) != CLASS_MECH &&
00326                  MechZ(mech) > MechUpperElevation(mech) && MechZ(mech) < ORBIT_Z))) {
00327                 mech_notify(mech, MECHALL, "You start free-fall.. Enjoy the ride!");
00328                 MECHEVENT(mech, EVENT_FALL, mech_fall_event, FALL_TICK, -1);
00329         } else if(MechSpeed(mech) > MP1) {
00330                 mech_notify(mech, MECHALL, "Your systems stop in mid-motion!");
00331                 if(MechType(mech) == CLASS_MECH)
00332                         MechLOSBroadcast(mech, "stops in mid-motion, and falls!");
00333                 else {
00334                         mech_notify(mech, MECHALL,
00335                                                 "You tumble end over end and come to a crashing halt!");
00336                         MechLOSBroadcast(mech,
00337                                                          "tumbles end over end and comes to a crashing halt!");
00338                 }
00339                 MechFalls(mech, 1, 0);
00340                 domino_space(mech, 2);
00341         }
00342         Shutdown(mech);
00343 }

void mech_startup ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 222 of file mech.startup.c.

References A_PILOTNUM, Alive, BOOTCOUNT, cch, char_lookupplayer(), CLASS_MW, Destroyed, DOCHECK, EVENT_STARTUP, Extinguishing, figure_latest_tech_event(), fix_pilotdamage(), GOD, Good_obj, Hardcode, In_Character, isRobot, LARM, LLEG, LTORSO, MECH::mapindex, MECH_CONSISTENT, MECH_MAP, mech_notify(), MECH_PILOT_CON, mech_startup_event(), MECHALL, MECHEVENT, MechHeat, MechPilot, MechSections, MechType, MECH::mynum, RARM, RLEG, RTORSO, silly_atr_get(), skipws, SSLEN, Started, Starting, Towed, Wiz, and WizP.

Referenced by auto_command_startup(), and auto_radio_command_startup().

00223 {
00224         MECH *mech = (MECH *) data;
00225         int n;
00226 
00227         cch(MECH_CONSISTENT | MECH_MAP | MECH_PILOT_CON);
00228         skipws(buffer);
00229         DOCHECK(!(Good_obj(player) && (Alive(player) || isRobot(player) ||
00230                                                                    Hardcode(player))),
00231                         "That is not a valid player!");
00232         DOCHECK(MechType(mech) == CLASS_MW
00233                         && Started(mech), "You're up and about already!");
00234         DOCHECK(Towed(mech),
00235                         "You're being towed! Wait for drop-off before starting again!");
00236         DOCHECK(mech->mapindex < 0, "You are not on any map!");
00237         DOCHECK(Destroyed(mech), "This 'Mech is destroyed!");
00238         DOCHECK(Started(mech), "This 'Mech is already started!");
00239         DOCHECK(Starting(mech), "This 'Mech is already starting!");
00240         DOCHECK(Extinguishing(mech), "You're way too busy putting out fires!");
00241         n = figure_latest_tech_event(mech);
00242         DOCHECK(n,
00243                         "This 'Mech is still under repairs (see checkstatus for more info)");
00244         DOCHECK(MechHeat(mech) > 30., "This 'Mech is too hot to start back up!");
00245         DOCHECK(In_Character(mech->mynum) && !Wiz(player) &&
00246                         (char_lookupplayer(GOD, GOD, 0, silly_atr_get(mech->mynum,
00247                                                                                                                   A_PILOTNUM)) !=
00248                          player), "This isn't your mech!");
00249         n = 0;
00250         if(*buffer && !strncasecmp(buffer, "override", strlen(buffer))) {
00251                 DOCHECK(!WizP(player), "Insufficient access!");
00252                 n = BOOTCOUNT - 1;
00253         }
00254         MechPilot(mech) = player;
00255 
00256 /*   if (In_Character(mech->mynum)) */
00257         /* Initialize the PilotDamage from the new pilot */
00258         fix_pilotdamage(mech, player);
00259         mech_notify(mech, MECHALL, "Startup Cycle commencing...");
00260         MechSections(mech)[RLEG].recycle = 0;
00261         MechSections(mech)[LLEG].recycle = 0;
00262         MechSections(mech)[RARM].recycle = 0;
00263         MechSections(mech)[LARM].recycle = 0;
00264         MechSections(mech)[RTORSO].recycle = 0;
00265         MechSections(mech)[LTORSO].recycle = 0;
00266         MECHEVENT(mech, EVENT_STARTUP, mech_startup_event, (n ||
00267                                                                                                                 MechType(mech) ==
00268                                                                                                                 CLASS_MW) ? 1 : SSLEN,
00269                           MechType(mech) == CLASS_MW ? BOOTCOUNT - 1 : n);
00270 }


Generated on Mon May 28 04:25:42 2007 for BattletechMUX by  doxygen 1.4.7