Exemplo n.º 1
0
static int Leave_DS_Bay(MAP * map, MECH * ds, MECH * mech, dbref frombay)
{
	MECH *car = NULL;

	StopBSuitSwarmers(FindObjectsData(mech->mapindex), mech, 1);
	MechLOSBroadcast(mech, "has left the bay.");
	/* We escape confines of the bay to open air/land! */
	mech_Rsetmapindex(GOD, (void *) mech, tprintf("%d", ds->mapindex));
	if(MechCarrying(mech) > 0)
		car = getMech(MechCarrying(mech));
	if(car)
		mech_Rsetmapindex(GOD, (void *) car, tprintf("%d", ds->mapindex));
	DOCHECKMA0(mech->mapindex == map->mynum,
			   "Fatal error: Unable to find the map 'ship is on.");
	loud_teleport(mech->mynum, mech->mapindex);
	if(car)
		loud_teleport(car->mynum, mech->mapindex);
	mech_notify(mech, MECHALL, "You have left the bay.");
	DS_Place(ds, mech, frombay);
	if(car)
		MirrorPosition(mech, car, 0);
	MechLOSBroadcasti(mech, ds, "has left %s's bay.");
	mech_notify(ds, MECHALL, tprintf("%s has left the bay.",
									 GetMechID(mech)));
	ContinueFlying(mech);
	if(In_Character(mech->mynum) && Location(MechPilot(mech)) != mech->mynum) {
		mech_notify(mech, MECHALL,
					"%ch%cr%cf%ciINTRUDER ALERT! INTRUDER ALERT!%c");
		mech_notify(mech, MECHALL,
					"%ch%cr%cfAutomatic self-destruct sequence initiated.%c");
		mech_shutdown(GOD, (void *) mech, "");
	}
	return 1;
}
Exemplo n.º 2
0
void sendNetworkMessage(dbref player, MECH * mech, char *msg, int tIsC3)
{
	int i;
	MECH *otherMech;
	const char *c = GetMechID(mech);
	char buf[LBUF_SIZE];
	int networkSize;
	dbref myNetwork[C3_NETWORK_SIZE];

	buildTempNetwork(mech, myNetwork, &networkSize, 1, 1, 1, tIsC3);

	for(i = 0; i < networkSize; i++) {
		otherMech = getMechInTempNetwork(i, myNetwork, networkSize);

		if(!otherMech)
			continue;

		if(!Good_obj(otherMech->mynum))
			continue;

		sprintf(buf, "%%ch%s/%s: %s%%cn", (tIsC3 ? "C3" : "C3i"), c, msg);
		mech_notify(otherMech, MECHALL, buf);
	}

	sprintf(buf, "%%ch%s/You: %s%%cn", (tIsC3 ? "C3" : "C3i"), msg);
	mech_notify(mech, MECHALL, buf);
}
Exemplo n.º 3
0
static void mech_enterbay_event(MUXEVENT * e)
{
	MECH *mech = (MECH *) e->data, *ds, *tmpm = NULL;
	long ref = (long) e->data2;
	long bayn;
	int x = 5, y = 5;
	MAP *tmpmap;

	if(!Started(mech) || Uncon(mech) || Jumping(mech) ||
	   (MechType(mech) == CLASS_MECH && (Fallen(mech) || Standing(mech))) ||
	   OODing(mech) || (fabs(MechSpeed(mech)) * 5 >= MMaxSpeed(mech) &&
						fabs(MMaxSpeed(mech)) >= MP1)
	   || (MechType(mech) == CLASS_VTOL && AeroFuel(mech) <= 0))
		return;
	tmpmap = getMap(ref);
	if(!(ds = getMech(tmpmap->onmap)))
		return;
	if(!Find_DS_Bay_In_MechHex(mech, ds, &bayn))
		return;
	/* whee */
	ref = AeroBay(ds, bayn);
	StopBSuitSwarmers(FindObjectsData(mech->mapindex), mech, 1);
	mech_notify(mech, MECHALL, "You enter the bay.");
	MechLOSBroadcast(mech, tprintf("has entered %s at %d,%d.",
								   GetMechID(ds), MechX(mech), MechY(mech)));
	MarkForLOSUpdate(mech);
	if(MechType(mech) == CLASS_MW && !In_Character(ref)) {
		enter_mw_bay(mech, ref);
		return;
	}
	if(MechCarrying(mech) > 0)
		tmpm = getMech(MechCarrying(mech));
	mech_Rsetmapindex(GOD, (void *) mech, tprintf("%d", ref));
	mech_Rsetxy(GOD, (void *) mech, tprintf("%d %d", x, y));
	MechLOSBroadcast(mech, "has entered the bay.");
	loud_teleport(mech->mynum, ref);
	if(tmpm) {
		mech_Rsetmapindex(GOD, (void *) tmpm, tprintf("%d", ref));
		mech_Rsetxy(GOD, (void *) tmpm, tprintf("%d %d", x, y));
		loud_teleport(tmpm->mynum, ref);
	}
}
Exemplo n.º 4
0
void prerun_event(EVENT * e)
{
#if 1
    static char buf[LBUF_SIZE];
    MECH *mech = (MECH *) e->data;

    /* Magic 2-hour uptime means that we are 'supposedly' stable
       [ read: crashy as hell, but.. :> you never know ] */
    if (event_tick <= 7200) {
	if (event_mech_event[(int) e->type])
	    sprintf(buf, "< %s event for #%d[%s] driven by #%d[%s] >",
		event_names[(int) e->type], mech->mynum, GetMechID(mech),
		MechPilot(mech),
		Good_obj(MechPilot(mech)) ? Name(MechPilot(mech)) :
		"Nobody");
	else
	    sprintf(buf, "< %s event >", event_names[(int) e->type]);
	mudstate.debug_cmd = buf;
    }
#endif
}
Exemplo n.º 5
0
void show_mechs_damage(dbref player, void *data, char *buffer)
{
    MECH *mech = data;
    coolmenu *c = NULL;
    int i, j, v1, v2;
    char buf[MBUF_SIZE];
    char buf2[MBUF_SIZE];
    int isds;

    TECHCOMMANDD;
    if (unit_is_fixable(mech))
	make_damage_table(mech);
    else
	make_scrap_table(mech);
    DOCHECK(!damage_last &&
	MechType(mech) == CLASS_MECH,
	"The 'mech is in pristine condition!");
    DOCHECK(!damage_last, "It's in pristine condition!");
    addline();
    cent(tprintf("Damage for %s", GetMechID(mech)));
    addline();
    for (i = 0; i < damage_last; i++) {
	v1 = damage_table[i][1];
	v2 = damage_table[i][2];
	switch (damage_table[i][0]) {
	case REATTACH:
	case DETACH:
	case RESEAL:
	case REPLACESUIT:
	    strcpy(buf, repair_need_msgs[(int) damage_table[i][0]]);
	    break;
	case REPAIRP:
	case REPAIRP_T:
	case REPAIRG:
	case ENHCRIT_MISC:
	case ENHCRIT_FOCUS:
	case ENHCRIT_CRYSTAL:
	case ENHCRIT_BARREL:
	case ENHCRIT_AMMOB:
	case ENHCRIT_RANGING:
	case ENHCRIT_AMMOM:
	case SCRAPP:
	case SCRAPG:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2));
	    break;
	case RELOAD:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2), FullAmmo(mech, v1,
		    v2) - GetPartData(mech, v1, v2));
	    break;
	case UNLOAD:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2), GetPartData(mech, v1, v2));
	    break;
	case FIXARMOR:
	case FIXARMOR_R:
	case FIXINTERNAL:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		damage_table[i][2]);
	    break;
	}
	j = is_under_repair(mech, i);
	sprintf(buf2, "%%ch%s%-2d:%s %%cn%s%s", j ? "%cg" : "%cy", i + 1,
	    ShortArmorSectionString(MechType(mech), MechMove(mech), v1),
	    buf, j ? " (*)" : "");
	vsi(buf2);
    }
    addline();
    vsi("(*) / %ch%cgGreen%cn = Job already done. %ch%cyYellow%cn = To be done.");
    addline();
    ShowCoolMenu(player, c);
    KillCoolMenu(c);
}