#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/file.h>
#include "mech.h"
#include "mech.events.h"
#include "autopilot.h"
#include "p.btechstats.h"
#include "p.mech.utils.h"
#include "p.econ_cmds.h"
#include "p.mech.tech.h"
#include "p.mech.build.h"
#include "p.mech.update.h"
#include "p.mech.pickup.h"
#include "p.mech.tag.h"
#include "p.bsuit.h"
#include "p.mech.combat.misc.h"
Include dependency graph for mech.startup.c:
Go to the source code of this file.
Defines | |
#define | BOOTCOUNT 6 |
#define | SSLEN MechType(mech) == CLASS_BSUIT ? 1 : (STARTUP_TIME / BOOTCOUNT) |
Functions | |
static void | mech_startup_event (MUXEVENT *e) |
void | mech_startup (dbref player, void *data, char *buffer) |
void | mech_shutdown (dbref player, void *data, char *buffer) |
Variables | |
char * | bsuit_bootmsgs [BOOTCOUNT] |
char * | aero_bootmsgs [BOOTCOUNT] |
char * | bootmsgs [BOOTCOUNT] |
char * | hover_bootmsgs [BOOTCOUNT] |
char * | track_bootmsgs [BOOTCOUNT] |
char * | wheel_bootmsgs [BOOTCOUNT] |
char * | vtol_bootmsgs [BOOTCOUNT] |
char * | naval_bootmsgs [BOOTCOUNT] |
#define BOOTCOUNT 6 |
Definition at line 38 of file mech.startup.c.
Referenced by mech_startup(), and mech_startup_event().
#define SSLEN MechType(mech) == CLASS_BSUIT ? 1 : (STARTUP_TIME / BOOTCOUNT) |
Definition at line 112 of file mech.startup.c.
Referenced by mech_startup(), and mech_startup_event().
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 }
static void mech_startup_event | ( | MUXEVENT * | e | ) | [static] |
Definition at line 114 of file mech.startup.c.
References aero_bootmsgs, BOOTCOUNT, bootmsgs, bsuit_bootmsgs, char_getskilltarget(), char_getvalue(), CLASS_AERO, CLASS_BSUIT, CLASS_DS, CLASS_VEH_GROUND, CLASS_VTOL, my_event_type::data, my_event_type::data2, DEFAULT_COMM, DestroyMech(), EvalBit, EVENT_STARTUP, MAP::first_free, FlyingT, getMap(), hover_bootmsgs, initialize_pc(), InWater, is_aero, isPlayer, Landed, LANDED, MAP::LOSinfo, MECH::mapindex, MECH::mapnumber, MarkForLOSUpdate(), MaybeMove, mech_notify(), mech_printf(), MECHALL, MechComm, MechCommLast, MechDesiredAngle, MechDesiredSpeed, MechElevation, MECHEVENT, MechLastStartup, MechLOSBroadcast(), MechMaxSpeed, MechMove, MechPer, MechPilot, MechSpecials, MechSpecials2, MechStartFX, MechStartFY, MechStartFZ, MechStatus, MechType, MechVerticalSpeed, MechZ, MOVE_BIPED, MOVE_FOIL, MOVE_HOVER, MOVE_HULL, MOVE_SUB, MOVE_TRACK, MOVE_VTOL, MOVE_WHEEL, mudstate, naval_bootmsgs, statedata::now, Quiet, SetCargoWeight(), SS_ABILITY, SSLEN, Startup, track_bootmsgs, UnSetMechPKiller, UnZombifyMech, vtol_bootmsgs, WATERPROOF_TECH, and wheel_bootmsgs.
Referenced by mech_startup().
00115 { 00116 MECH *mech = (MECH *) e->data; 00117 int timer = (int) e->data2; 00118 MAP *mech_map; 00119 int i; 00120 00121 if(is_aero(mech)) { 00122 mech_printf(mech, MECHALL, aero_bootmsgs[timer]); 00123 } else if(MechType(mech) == CLASS_BSUIT) { 00124 mech_printf(mech, MECHALL, bsuit_bootmsgs[timer]); 00125 } else 00126 switch (MechMove(mech)) { 00127 case MOVE_HOVER: 00128 mech_printf(mech, MECHALL, hover_bootmsgs[timer]); 00129 break; 00130 case MOVE_TRACK: 00131 mech_printf(mech, MECHALL, track_bootmsgs[timer]); 00132 break; 00133 case MOVE_WHEEL: 00134 mech_printf(mech, MECHALL, wheel_bootmsgs[timer]); 00135 break; 00136 case MOVE_VTOL: 00137 mech_printf(mech, MECHALL, vtol_bootmsgs[timer]); 00138 break; 00139 case MOVE_BIPED: 00140 mech_printf(mech, MECHALL, bootmsgs[timer]); 00141 break; 00142 case MOVE_HULL: 00143 case MOVE_FOIL: 00144 case MOVE_SUB: 00145 mech_printf(mech, MECHALL, naval_bootmsgs[timer]); 00146 break; 00147 default: 00148 mech_printf(mech, MECHALL, bootmsgs[timer]); 00149 break; 00150 } 00151 timer++; 00152 00153 /* Check if the unit is in water and if it should die */ 00154 /* Make sure it checks pretty early in the startup */ 00155 if(timer >= 2) { 00156 00157 if(InWater(mech) && (MechType(mech) == CLASS_VEH_GROUND || 00158 MechType(mech) == CLASS_VTOL || 00159 MechType(mech) == CLASS_BSUIT || 00160 MechType(mech) == CLASS_AERO || 00161 MechType(mech) == CLASS_DS) && 00162 !(MechSpecials2(mech) & WATERPROOF_TECH)) { 00163 00164 mech_notify(mech, MECHALL, 00165 "Water floods your engine and your unit " 00166 "becomes inoperable."); 00167 if(MechType(mech) == CLASS_BSUIT) 00168 MechLOSBroadcast(mech,"emits some bubbles and flails their arms around as they sink to the bottom."); 00169 else 00170 MechLOSBroadcast(mech,"emits some bubbles as its engines are flooded."); 00171 DestroyMech(mech, mech, 0); 00172 return; 00173 00174 } 00175 } 00176 00177 if(timer < BOOTCOUNT) { 00178 MECHEVENT(mech, EVENT_STARTUP, mech_startup_event, SSLEN, timer); 00179 return; 00180 } 00181 if((mech_map = getMap(mech->mapindex))) 00182 for(i = 0; i < mech_map->first_free; i++) 00183 mech_map->LOSinfo[mech->mapnumber][i] = 0; 00184 initialize_pc(MechPilot(mech), mech); 00185 Startup(mech); 00186 MarkForLOSUpdate(mech); 00187 SetCargoWeight(mech); 00188 UnSetMechPKiller(mech); 00189 MechLOSBroadcast(mech, "powers up!"); 00190 MechVerticalSpeed(mech) = 0; 00191 EvalBit(MechSpecials(mech), SS_ABILITY, ((MechPilot(mech) > 0 && 00192 isPlayer(MechPilot(mech))) ? 00193 char_getvalue(MechPilot(mech), 00194 "Sixth_Sense") : 00195 0)); 00196 if(FlyingT(mech)) { 00197 if(MechZ(mech) <= MechElevation(mech)) 00198 MechStatus(mech) |= LANDED; 00199 } 00200 MechComm(mech) = DEFAULT_COMM; 00201 if(isPlayer(MechPilot(mech)) && !Quiet(mech->mynum)) { 00202 MechComm(mech) = 00203 char_getskilltarget(MechPilot(mech), "Comm-Conventional", 0); 00204 MechPer(mech) = char_getskilltarget(MechPilot(mech), "Perception", 0); 00205 } else { 00206 MechComm(mech) = 6; 00207 MechPer(mech) = 6; 00208 } 00209 MechCommLast(mech) = 0; 00210 MechLastStartup(mech) = mudstate.now; 00211 if(is_aero(mech) && !Landed(mech)) { 00212 MechDesiredAngle(mech) = -90; 00213 MechStartFX(mech) = 0.0; 00214 MechStartFY(mech) = 0.0; 00215 MechStartFZ(mech) = 0.0; 00216 MechDesiredSpeed(mech) = MechMaxSpeed(mech); 00217 MaybeMove(mech); 00218 } 00219 UnZombifyMech(mech); 00220 }
char* aero_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Main reactor is now online <-%%c", "%%cg-> Thrusters online <-%%c", "%%cg-> Main computer system is now online <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems go!%%c %%cr<= %%cg-%%c" }
Definition at line 49 of file mech.startup.c.
Referenced by mech_startup_event().
char* bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Main reactor is now online <-%%c", "%%cg-> Gyros are now stable <-%%c", "%%cg-> Main computer system is now online <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 58 of file mech.startup.c.
Referenced by mech_startup_event().
char* bsuit_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Initializing powerpack <-%%c", "%%cg-> Powerpack operational <-%%c", "%%cg-> Suit sealed <-%%c", "%%cg-> Computer system is now operational <-%%c", "%%cg-> Air pressure steady <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems go!%%c %%cr<= %%cg-%%c" }
Definition at line 40 of file mech.startup.c.
Referenced by mech_startup_event().
char* hover_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Powerplant initialized and online <-%%c", "%%cg-> Checking plenum chamber status <-%%c", "%%cg-> Verifying fan status <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 67 of file mech.startup.c.
Referenced by mech_startup_event().
char* naval_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Main reactor is now online <-%%c", "%%cg-> Main computer system is now online <-%%c", "%%cg-> Hull integrity monitoring online <-%%c", "%%cg-> Ballast and propulsion are nominal <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 103 of file mech.startup.c.
Referenced by mech_startup_event().
char* track_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Powerplant initialized and online <-%%c", "%%cg-> Auto-aligning drive wheels <-%%c", "%%cg-> Adjusting track tension <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 76 of file mech.startup.c.
Referenced by mech_startup_event().
char* vtol_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Initializing main powerplant <-%%c", "%%cg-> Main turbine online and operational <-%%c", "%%cg-> Rotor transmission engaged <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 94 of file mech.startup.c.
Referenced by mech_startup_event().
char* wheel_bootmsgs[BOOTCOUNT] |
Initial value:
{ "%%cg-> Powerplant initialized and online <-%%c", "%%cg-> Performing steering system checks <-%%c", "%%cg-> Checking wheel status <-%%c", "%%cg-> Scanners are now operational <-%%c", "%%cg-> Targeting system is now operational <-%%c", " %%cg- %%cr-=>%%ch%%cw All systems operational!%%c %%cr<=- %%cg-%%c" }
Definition at line 85 of file mech.startup.c.
Referenced by mech_startup_event().