Example #1
0
void mech_createbays(dbref player, void *data, char *buffer)
{
	char *args[NUM_BAYS + 1];
	int argc;
	dbref it;
	int i;
	MECH *ds = (MECH *) data;
	MAP *map;

	DOCHECK((argc =
			 mech_parseattributes(buffer, args,
								  NUM_BAYS + 1)) == (NUM_BAYS + 1),
			"Invalid number of arguments!");
	for(i = 0; i < argc; i++) {
		it = match_thing(player, args[i]);
		DOCHECK(it == NOTHING, tprintf("Argument %d is invalid.", i + 1));
		DOCHECK(!IsMap(it), tprintf("Argument %d is not a map.", i + 1));
		map = FindObjectsData(it);
		AeroBay(ds, i) = it;
		map->onmap = ds->mynum;
	}
	for(i = argc; i < NUM_BAYS; i++)
		AeroBay(ds, i) = -1;
	notify_printf(player, "%d bay(s) set up!", argc);
}
Example #2
0
File: debug.c Project: chazu/btmux
void debug_shutdown(dbref player, void *data, char *buffer)
{
	char *args[3];
	int argc;

	argc = mech_parseattributes(buffer, args, 3);
	if(argc > 0)
		ShutDownMap(player, atoi(args[0]));
}
Example #3
0
File: debug.c Project: chazu/btmux
void debug_list(dbref player, void *data, char *buffer)
{
	char *args[3];
	int argc;

	argc = mech_parseattributes(buffer, args, 3);
	if(argc == 0)
		return;
	else if(args[0][0] == 'M' || args[0][0] == 'm')
		if(args[0][1] == 'E' || args[0][1] == 'e')
			DumpMechs(player);
	if(args[0][1] == 'A' || args[0][1] == 'a')
		DumpMaps(player);
}
Example #4
0
File: debug.c Project: chazu/btmux
void debug_setwbv(dbref player, void *data, char *buffer)
{
	char *args[3];
	int bv;
	int id, brand;

	DOCHECK(mech_parseattributes(buffer, args, 3) != 2, "Invalid arguments!");
	DOCHECK(Readnum(bv, args[1]), "Invalid value!");
	DOCHECK(bv <0, "BV needs to be >=0");
	DOCHECK(!find_matching_vlong_part(args[0], NULL, &id, &brand),
			"That is no weapon!");
	DOCHECK(!IsWeapon(id), "That is no weapon!");
	MechWeapons[Weapon2I(id)].battlevalue = bv;
	notify_printf(player, "BV for %s set to %d.",
				  MechWeapons[Weapon2I(id)].name, bv);
}
Example #5
0
int tech_parsepart_advanced(MECH * mech, char *buffer, int *loc, int *pos,
							int *extra, int allowrear)
{
	char *args[5];
	int l, argc, isrear = 0;

	if(!(argc = mech_parseattributes(buffer, args, 4)))
		return -1;
	if(argc > (2 + (extra != NULL)))
		return -1;
	if(!allowrear) {
		if((!extra && argc != (1 + (pos != NULL))) || (extra &&
													   (argc <
														(1 + (pos != NULL))
														|| argc >
														(2 + (pos != NULL)))))
			return -1;
	} else {
		if(argc == 2) {
			if(toupper(args[1][0]) != 'R')
				return -1;
			isrear = 8;
		}
	}
	if((*loc =
		ArmorSectionFromString(MechType(mech), MechMove(mech), args[0])) < 0)
		return -1;
	if(allowrear)
		*loc += isrear;
	if(pos) {
		l = atoi(args[1]) - 1;
		if(l < 0 || l >= CritsInLoc(mech, *loc))
			return -2;
		*pos = l;
	}
	if(extra) {
		if(argc > 2)
			*extra = args[2][0];
		else
			*extra = 0;
	}
	return 0;
}
Example #6
0
File: debug.c Project: chazu/btmux
void debug_setvrt(dbref player, void *data, char *buffer)
{
	char *args[3];
	int vrt;
	int id, brand;

	DOCHECK(mech_parseattributes(buffer, args, 3) != 2, "Invalid arguments!");
	DOCHECK(Readnum(vrt, args[1]), "Invalid value!");
	DOCHECK(vrt <= 0, "VRT needs to be >0");
	DOCHECK(vrt > 127, "VRT can be at max 127");
	DOCHECK(!find_matching_vlong_part(args[0], NULL, &id, &brand),
			"That is no weapon!");
	DOCHECK(!IsWeapon(id), "That is no weapon!");
	MechWeapons[Weapon2I(id)].vrt = vrt;
	notify_printf(player, "VRT for %s set to %d.",
				  MechWeapons[Weapon2I(id)].name, vrt);
    log_error(LOG_WIZARD, "WIZ", "CHANGE", "VRT for %s set to %d by #%d", 
						 MechWeapons[Weapon2I(id)].name, vrt, player);
}
Example #7
0
int tech_parsegun(MECH * mech, char *buffer, int *loc, int *pos, int *brand)
{
	char *args[3];
	int l, argc, t, c = 0, pi, pb;

	argc = mech_parseattributes(buffer, args, 3);
	if(argc < 1 || argc > (2 + (brand != NULL)))
		return -1;
	if(argc == (2 + (brand != NULL)) || (brand && argc == 2 && atoi(args[1]))) {
		if((*loc =
			ArmorSectionFromString(MechType(mech), MechMove(mech),
								   args[0])) < 0)
			return -1;
		l = atoi(args[1]);
		if(l <= 0 || l > CritsInLoc(mech, *loc))
			return -4;
		*pos = l - 1;
	} else {
		/* Check if it's a number */
		if(args[0][0] < '0' || args[0][0] > '9')
			return -1;
		l = atoi(args[0]);
		if(l < 0)
			return -1;
		if((t = FindWeaponNumberOnMech(mech, l, loc, pos)) == -1)
			return -1;
	}
	t = GetPartType(mech, *loc, *pos);
	if(brand != NULL && argc > 1 && !atoi(args[argc - 1])) {
		if(!find_matching_long_part(args[argc - 1], &c, &pi, &pb))
			return -2;
		if(pi != t)
			return -3;
		*brand = pb;
	} else if(brand != NULL)
		*brand = GetPartBrand(mech, *loc, *pos);
	return 0;
}
Example #8
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 #9
0
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);
}