예제 #1
0
/*
 * Alerts any space-object that is in range of the inbound or outbound border crossing
 */
void alert_border_cross (int x, int a, int way)
{
	register int i;

	if (sdb[x].move.out != 0.0)
		for (i = MIN_SPACE_OBJECTS; i <= max_space_objects; ++i)
			if (sdb[i].status.active)
				 if (sdb[i].space == sdb[x].space)
					if (sdb[i].move.empire == a)
						if (i != x)
							if (sdb2range(x, i) < MAX_NOTIFICATION_DISTANCE) {
								if (way) {
									console_message(i, "helm science security",
									  ansi_warn(tprintf("Inbound border crossing reported at %.3f %.3f %.3f",
									  su2pc(sdb[x].coords.x - sdb[i].coords.xo),
									  su2pc(sdb[x].coords.y - sdb[i].coords.yo),
									  su2pc(sdb[x].coords.z - sdb[i].coords.zo))));
								} else
									console_message(i, "helm science security",
									  ansi_warn(tprintf("Outbound border crossing reported at %.3f %.3f %.3f",
									  su2pc(sdb[x].coords.x - sdb[i].coords.xo),
									  su2pc(sdb[x].coords.y - sdb[i].coords.yo),
									  su2pc(sdb[x].coords.z - sdb[i].coords.zo))));
							}
	return;
}
예제 #2
0
void damage_main (int x, double damage)
{
	if (!sdb[x].main.exist || sdb[x].main.damage == -1.0)
		return;
	if (sdb[x].power.main != 0.0
	  && sdb[x].main.damage > 0.0
  	  && (sdb[x].main.damage - damage / sdb[x].main.gw <= 0.0)) {
		alert_main_overload(x);
	}
	sdb[x].main.damage -= damage / sdb[x].main.gw;
	if (sdb[x].main.damage < -1.0) {
		sdb[x].main.damage = -1.0;
		if (sdb[x].power.main != 0.0) {
			do_all_console_notify(x, tprintf(ansi_warn("%s core breach."), system_name[8]));
			damage_structure(x, sdb[x].power.main * (get_random_long(0,100) + 1.0));
		}
	}
	do_console_notify(x, console_engineering, console_damage, 0,
	  ansi_alert(tprintf("%s%s%s: %s %s",
	  ANSI_CYAN, system_name[8], ANSI_WHITE,
	  unparse_percent(sdb[x].main.damage),
	  unparse_damage(sdb[x].main.damage))));
	return;
}
예제 #3
0
void damage_structure (int x, double damage)
{
	register int i;
	double s = sdb[x].structure.superstructure;

	if (sdb[x].structure.superstructure == -sdb[x].structure.max_structure)
		return;
	sdb[x].structure.superstructure -= damage;
	if (sdb[x].structure.superstructure < -sdb[x].structure.max_structure)
		sdb[x].structure.superstructure = -sdb[x].structure.max_structure;
	do_console_notify(x, console_engineering, console_damage, 0,
	  ansi_alert(tprintf("%s%s%s: %s %s",
	  ANSI_CYAN, system_name[0], ANSI_WHITE,
	  unparse_percent(sdb[x].structure.superstructure / sdb[x].structure.max_structure),
	  unparse_damage(sdb[x].structure.superstructure / sdb[x].structure.max_structure))));
	if ((sdb[x].structure.superstructure <= -sdb[x].structure.max_structure) &&
	  (s > -sdb[x].structure.max_structure)) {
		/* Mordak Aspace v1.0.0p1 - Removed Silly KayBye! */
		do_ship_notify(x, tprintf("%s%s%s%s explodes into white hot vapor.%s%s",
		  ANSI_HILITE, ANSI_INVERSE, ANSI_RED, Name(sdb[x].object), ANSI_WHITE, ANSI_NORMAL));
		/* End Aspace v1.0.0p1*/
		do_space_notify_one(x, console_helm, console_tactical, console_science,
		  "has been destroyed");
		write_spacelog(sdb[x].object, sdb[x].object, tprintf("LOG: Destroyed, Shields %.6f GHz",
		  sdb[x].shield.freq));
		sdb[x].space = -1;
		sdb[x].status.active = 0;
		sdb[x].status.crippled = 2;
		for (i = MIN_SPACE_OBJECTS ; i <= max_space_objects ; ++i)
			if (sdb[i].location == x)
				if (sdb[i].structure.type) {
					do_ship_notify(i, tprintf("%s%s%s%s explodes into white hot vapor. Goodbye!%s%s",
					  ANSI_HILITE, ANSI_INVERSE, ANSI_RED, Name(sdb[i].object), ANSI_WHITE, ANSI_NORMAL));
					write_spacelog(sdb[x].object, sdb[x].object, tprintf("LOG: Destroyed, Shields %.6f GHz",
					  sdb[x].shield.freq));
					sdb[i].space = -1;
					sdb[i].status.active = 0;
					sdb[i].status.crippled = 2;
				}
	} else if ((sdb[x].structure.superstructure <= 0.0) && (s > 0.0)) {
		do_all_console_notify(x, ansi_warn("Excessive damage. All systems shutting down"));
		do_ship_notify(x, tprintf("%s experiences total systems failure.",Name(sdb[x].object)));
		sdb[x].status.crippled = 1;
		do_space_notify_one(x, console_helm, console_tactical, console_science,
			"has been disabled");
		write_spacelog(sdb[x].object, sdb[x].object, tprintf("LOG: Disabled, Shields %.6f GHz",
		  sdb[x].shield.freq));
	}
	if (((sdb[x].structure.superstructure <= 0.0) && (s > 0.0)) ||
	  ((sdb[x].structure.superstructure <= -sdb[x].structure.max_structure) &&
	  (s > -sdb[x].structure.max_structure))) {
	  	if (sdb[x].main.damage > 0.0)
			sdb[x].main.in = 0.0;
	  	if (sdb[x].aux.damage > 0.0)
			sdb[x].aux.in = 0.0;
		for (i = 0; i < MAX_SHIELD_NAME; ++i)
			sdb[x].shield.active[i] = 0;
		sdb[x].beam.in = 0.0;
		sdb[x].beam.out = 0.0;
		for (i = 0; i < sdb[x].beam.banks; ++i) {
			sdb[x].blist.lock[i] = 0;
			sdb[x].blist.active[i] = 0;
		}
		sdb[x].missile.in = 0.0;
		sdb[x].missile.out = 0.0;
		for (i = 0; i < sdb[x].missile.tubes; ++i) {
			sdb[x].mlist.lock[i] = 0;
			sdb[x].mlist.active[i] = 0;
		}
		sdb[x].batt.in = 0.0;
		sdb[x].batt.out = 0.0;
		sdb[x].move.in = 0.0;
		sdb[x].move.out = 0.0;
		sdb[x].move.v = 0.0;
		sdb[x].engine.warp_max = 0.0;
		sdb[x].engine.impulse_max = 0.0;
		sdb[x].power.batt = 0.0;
		sdb[x].sensor.lrs_active = 0;
		sdb[x].sensor.srs_active = 0;
		sdb[x].sensor.ew_active = 0;
		sdb[x].cloak.active = 0;
		sdb[x].trans.active = 0;
		sdb[x].trans.d_lock = 0;
		sdb[x].trans.s_lock = 0;
		sdb[x].tract.active = 0;
		sdb[x].tract.lock = 0;
		if (GoodSDB(sdb[x].status.tractoring)) {
			sdb[sdb[x].status.tractoring].status.tractored = 0;
			sdb[x].status.tractoring = 0;
		}
		up_cochranes();
		up_empire();
		up_quadrant();
		up_vectors();
		up_resolution();
		up_signature(x);
		up_visibility();
		debug_space(x);
	}
	return;
}
예제 #4
0
/* Alerts the ship when it has entered an empires space */
void alert_enter_empire (int x)
{
	console_message(x, "helm", 	ansi_warn(tprintf("Entering %s space", unparse_empire(x))));
	return;
}