void mech_enterbay(dbref player, void *data, char *buffer) { char *args[3]; int argc; dbref ref = -1, bayn = -1; MECH *mech = data, *ds; MAP *map; cch(MECH_USUAL); DOCHECK(MechType(mech) == CLASS_VTOL && AeroFuel(mech) <= 0, "You lack fuel to maneuver in!"); DOCHECK(Jumping(mech), "While in mid-jump? No way."); DOCHECK(MechType(mech) == CLASS_MECH && (Fallen(mech) || Standing(mech)), "Crawl inside? I think not. Stand first."); DOCHECK(OODing(mech), "While in mid-flight? No way."); DOCHECK((argc = mech_parseattributes(buffer, args, 2)) == 2, "Hmm, invalid number of arguments?"); if(argc > 0) DOCHECK((ref = FindTargetDBREFFromMapNumber(mech, args[0])) <= 0, "Invalid target!"); if(ref < 0) { DOCHECK(!Find_Single_DS_In_MechHex(mech, &ref, &bayn), "No DS bay found in your hex!"); DOCHECK(ref < 0, "Multiple enterable things found ; use the id for specifying which you want."); DOCHECK(!(ds = getMech(ref)), "You sense wrongness in fabric of space."); } else { DOCHECK(!(ds = getMech(ref)), "You sense wrongness in fabric of space."); DOCHECK(!Find_DS_Bay_In_MechHex(mech, ds, &bayn), "You see no bays in your hex."); } DOCHECK(IsDS(mech) && !(MechSpecials2(mech) & CARRIER_TECH), "Your craft can't enter bays."); DOCHECK(!DS_Bay_Is_Open(mech, ds, AeroBay(ds, bayn)), "The door has been jammed!"); DOCHECK(IsDS(mech), "Your unit is a bit too large to fit in there."); DOCHECK((fabs((float) (MechSpeed(mech) - MechSpeed(ds)))) > MP1, "Speed difference's too large to enter!"); DOCHECK(MechZ(ds) != MechZ(mech), "Get to same elevation before thinking about entering!"); DOCHECK(abs(MechVerticalSpeed(mech) - MechVerticalSpeed(ds)) > 10, "Vertical speed difference is too great to enter safely!"); DOCHECK(MechType(mech) == CLASS_MECH && !MechIsQuad(mech) && (IsMechLegLess(mech)), "Without legs? Are you kidding?"); ref = AeroBay(ds, bayn); map = getMap(ref); DOCHECK(!map, "You sense wrongness in fabric of space."); DOCHECK(EnteringHangar(mech), "You are already entering the hangar!"); if(!can_pass_lock(mech->mynum, ref, A_LENTER)) { char *msg = silly_atr_get(ref, A_FAIL); if(!msg || !*msg) msg = "You are unable to enter the bay!"; notify(player, msg); return; } DOCHECK(!DS_Bay_Is_EnterOK(mech, ds, AeroBay(ds, bayn)), "Someone else is using the door at the moment."); DOCHECK(!(map = getMap(mech->mapindex)), "You sense a wrongness in fabric of space."); HexLOSBroadcast(map, MechX(mech), MechY(mech), "The bay doors at $h start to open.."); MECHEVENT(mech, EVENT_ENTER_HANGAR, mech_enterbay_event, 12, ref); }
void mech_c3i_join_leave(dbref player, void *data, char *buffer) { MECH *mech = (MECH *) data, *target; MAP *objMap; char *args[2]; dbref refTarget; int LOS = 1; float range = 0.0; cch(MECH_USUALO); DOCHECK(mech_parseattributes(buffer, args, 2) != 1, "Invalid number of arguments to function!"); DOCHECK(!HasC3i(mech), "This unit is not equipped with C3i!"); DOCHECK(C3iDestroyed(mech), "Your C3i system is destroyed!"); DOCHECK(AnyECMDisturbed(mech), "Your C3i system is not currently operational!"); validateC3iNetwork(mech); /* Clear our C3i Network */ if (!strcmp(args[0], "-")) { if (MechC3iNetworkSize(mech) <= 0) { mech_notify(mech, MECHALL, "You are not connected to a C3i network!"); return; } clearC3iNetwork(mech, 1); mech_notify(mech, MECHALL, "You disconnect from the C3i network."); return; } /* Well, if we're here then we wanna connect to a network */ /* Let's check to see if we're already in one... can't be in two at the same time */ DOCHECK(MechC3iNetworkSize(mech) > 0, "You are already in a C3i network!"); objMap = getMap(mech->mapindex); /* Find who we're trying to connect to */ refTarget = FindTargetDBREFFromMapNumber(mech, args[0]); target = getMech(refTarget); if (target) { LOS = InLineOfSight(mech, target, MechX(target), MechY(target), range); } else refTarget = 0; DOCHECK((refTarget < 1) || !LOS, "That is not a valid targetID. Try again."); DOCHECK(MechTeam(mech) != MechTeam(target), "You can't use the C3i network of unfriendly units!"); DOCHECK(mech == target, "You can't connect to yourself!"); DOCHECK(Destroyed(target), "That unit is destroyed!"); DOCHECK(!Started(target), "That unit is not started!"); DOCHECK(!HasC3i(target), "That unit does not appear to be equipped with C3i!"); /* validate the network of our target */ validateC3iNetwork(target); DOCHECK(MechC3iNetworkSize(target) >= C3I_NETWORK_SIZE, "That unit's C3i network is operating at maximum capacity!"); /* Connect us up */ mech_notify(mech, MECHALL, tprintf("You connect to %s's C3i network.", GetMechToMechID(mech, target))); addMechToC3iNetwork(target, mech); }