Example #1
0
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);
}
Example #2
0
void meltSnowAndIce(MAP * map, int x, int y, int depth, int emit,
    int makeSteam)
{
    int data = 0;
    int layers = 0, oldLayers = 0;
    int snowDone = 0;
    int steamLength = 0;

    if (!map)
	return;

    if (depth <= 0)
	return;

    oldLayers = GetHexLayers(map, x, y);
    layers = oldLayers;
    data = GetHexLayerData(map, x, y);

    if ((layers & HEXLAYER_SNOW) || (layers & HEXLAYER_DEEP_SNOW)) {
	data = MAX(0, data - depth);
	steamLength = abs(data - GetHexLayerData(map, x, y));

	if (data == 0)
	    layers &= ~(HEXLAYER_SNOW | HEXLAYER_DEEP_SNOW);
	else if (data <= 1000) {
	    layers |= HEXLAYER_SNOW;
	    layers &= ~HEXLAYER_DEEP_SNOW;
	} else {
	    layers |= HEXLAYER_DEEP_SNOW;
	    layers &= ~HEXLAYER_SNOW;
	}

	SetHexLayers(map, x, y, layers);
	SetHexLayerData(map, x, y, data);

	if (emit) {
	    if (layers & HEXLAYER_DEEP_SNOW)
		snowDone = 1;

	    if (!snowDone && !((layers & HEXLAYER_SNOW) ||
		    (layers & HEXLAYER_DEEP_SNOW))) {
		HexLOSBroadcast(map, x, y,
		    "%ch%cgThe snow in $h melts to nothingness!%cn");
		snowDone = 1;
	    }

	    if (!snowDone && ((oldLayers & HEXLAYER_DEEP_SNOW) &&
		    (!(layers & HEXLAYER_DEEP_SNOW)))) {
		HexLOSBroadcast(map, x, y,
		    "%ch%cgThe snow in $h visibly melts!%cn");
		snowDone = 1;
	    }
	}
    }

    if (IsIceHex(map, x, y)) {
	if (depth >= (Elevation(map, x, y) * 200)) {
	    if (emit)
		HexLOSBroadcast(map, x, y, "The ice at $h breaks apart!");

	    breakIceAndSplashUnits(map, NULL, x, y,
		"goes swimming as ice breaks!");
	    steamLength = (Elevation(map, x, y) * 200);
	}
    }

    if ((steamLength > 0) && makeSteam) {
	if (steamLength > 90)
	    steamLength = 90 + Number(0, steamLength / 20);

	add_decoration(map, x, y, TYPE_SMOKE, SMOKE, steamLength);
    }
}