Page 4 of 7

Posted: Thu Sep 24, 2009 7:23 am
by CaptKev
How about just increasing the precision of the number in the array?

This is the code I'm using, which includes 30 planet textures and some of Griff's stuff.

Code: Select all

this.name = "System Redux 1.1 beta";
this.author	= "CaptKev and Kaks";
this.description = "Texture the home planet, add a planet/moon combination to each system.";
this.version = "1.1";
this.copyright = "This work is hereby placed in the public domain.";

// Set the required number of moons and planets here (from 0 to 4)
this.max_moons = 2;
this.max_planets = 4;
this.sun_multiple = 2;

this.startUp = function()
{
	this.Log("Initialising OXP " + this.name);

	this.system_info = new Array(
		0, 0x021A5, 0x12100, 0x01118, 0x08181, 0x03168, 0x0D110, 0x02105, 0x00735, 0x0C103, 0x07110, 0x0B110, 0x0F120, 0x00100, 0x071A2, 0x0414A, 0x06180, 0x021A5, 0x04116, 0x0D102, 0x0A125, 0x05180, 0x08122, 0x071C1, 0x0B142, 0x1018A, 0x0F141, 0x0010A, 0x06123, 0x01140, 0x00145, 0x0A14C, 0x06100, 0x0D121, 0x08112, 0x0B110, 0x04140, 0x01113, 0x00102, 0x04128, 0x02181, 0x08100, 0x06122, 0x05100, 0x0F163, 0x0B108, 0x0C149, 0x00103, 0x0E100, 0x06145, 0x02168, 0x00180, 0x01185, 0x11100, 0x0D10D, 0x07190, 0x02131, 0x011A0, 0x0C142, 0x0F100, 0x0312B, 0x10108, 0x06100, 0x001C0, 0x0A194, 0x08115, 0x03100, 0x01100, 0x00106, 0x0E144, 0x0F142, 0x01182, 0x06120, 0x05151, 0x0C100, 0x00114, 0x0F141, 0x13181, 0x01112, 0x11102, 0x03190, 0x0C170, 0x00100, 0x0311E, 0x07107, 0x08100, 0x02144, 0x0D194, 0x01145, 0x0C109, 0x0E100, 0x00100, 0x071B2, 0x0213C, 0x01114, 0x0A101, 0x10180, 0x0C120, 0x0F144, 0x07120, 0x00100, 0x01108, 0x03100, 0x0F18C, 0x04181, 0x01101, 0x0C1A8, 0x05115, 0x0311E, 0x0D138, 0x02108, 0x08108, 0x00120, 0x07104, 0x041C0, 0x0C160, 0x10100, 0x08184, 0x02104, 0x111C0, 0x0E101, 0x05180, 0x06124, 0x01101, 0x0E10A, 0x00188, 0x01103, 0x02142, 0x0310C, 0x04180, 0x05180, 0x06114, 0x071D6, 0x08153, 0x0A180, 0x0C100, 0x0D134, 0x0E140, 0x0F157, 0x00128, 0x1212C, 0x07105, 0x08151, 0x02106, 0x06159, 0x05182, 0x01128, 0x00105, 0x07138, 0x02120, 0x08108, 0x0C120, 0x0D142, 0x09104, 0x0F102, 0x0612A, 0x00106, 0x021C0, 0x01169, 0x05104, 0x09100, 0x01100, 0x00100, 0x08188, 0x13106, 0x01190, 0x0E100, 0x051A8, 0x06159, 0x00101, 0x0A180, 0x0219B, 0x11100, 0x0F10A, 0x10104, 0x01102, 0x0810A, 0x02115, 0x0E154, 0x0A1A0, 0x05120, 0x06147, 0x00195, 0x08100, 0x01190, 0x0D100, 0x00102, 0x10100, 0x051D8, 0x0C120, 0x061B0, 0x01120, 0x02100, 0x03140, 0x04120, 0x0F140, 0x0A100, 0x11140, 0x0514D, 0x06140, 0x0C155, 0x0112B, 0x00154, 0x03180, 0x0D100, 0x07180, 0x12100, 0x011C1, 0x001BC, 0x02125, 0x0D104, 0x03101, 0x08106, 0x00180, 0x0211C, 0x04101, 0x10110, 0x0D10B, 0x041A0, 0x0E141, 0x05125, 0x06100, 0x01130, 0x0010C, 0x0A100, 0x0415A, 0x0711C, 0x0814E, 0x11109, 0x0D102, 0x10119, 0x01144, 0x0C1E8, 0x0F104, 0x05180, 0x13140, 0x03140, 0x01104, 0x0211A, 0x0E107, 0x0A18C, 0x00172, 0x0110D, 0x04141, 0x06120, 0x0C109, 0x02105, 0x00100, 0x0B108, 0x08182, 0x0412E, 0x10184, 0x07104, 0x0C12A, 0x01111, 0x06104, 0x00115,
		0, 0x0C1A0, 0x02138, 0x00148, 0x01108, 0x01102, 0x06108, 0x011A0, 0x0A1A0, 0x071F3, 0x04101, 0x03180, 0x00152, 0x05101, 0x02123, 0x0B112, 0x01100, 0x0F184, 0x0D164, 0x041E1, 0x02167, 0x031C0, 0x04142, 0x05136, 0x0A10A, 0x051D6, 0x05109, 0x021C1, 0x05180, 0x031A0, 0x0A100, 0x06126, 0x02102, 0x0F184, 0x04114, 0x0010B, 0x02142, 0x07108, 0x02118, 0x02111, 0x0F10A, 0x00104, 0x01185, 0x0A131, 0x00120, 0x09190, 0x0410A, 0x021A0, 0x01110, 0x01104, 0x061D1, 0x0F188, 0x05181, 0x02104, 0x051A0, 0x0814A, 0x0E184, 0x0E100, 0x01140, 0x0C106, 0x00100, 0x0F124, 0x01128, 0x01130, 0x02108, 0x03109, 0x04150, 0x0510C, 0x06100, 0x07182, 0x081D5, 0x09111, 0x0A100, 0x0B100, 0x0C181, 0x0D124, 0x0E140, 0x0F114, 0x0110A, 0x02108, 0x03122, 0x04111, 0x00100, 0x05166, 0x07114, 0x04100, 0x00111, 0x021A2, 0x0A166, 0x06120, 0x071D0, 0x05104, 0x00180, 0x02188, 0x04179, 0x0C100, 0x0D181, 0x09141, 0x00144, 0x0A106, 0x03100, 0x07124, 0x0816C, 0x00116, 0x01107, 0x0C142, 0x0A109, 0x01180, 0x02100, 0x05170, 0x06117, 0x06104, 0x09100, 0x0C128, 0x0A146, 0x02188, 0x06143, 0x0B109, 0x04108, 0x0310B, 0x011DA, 0x04184, 0x011C6, 0x06110, 0x0C160, 0x02186, 0x08105, 0x0E1C4, 0x04101, 0x0A100, 0x05114, 0x06144, 0x00106, 0x01100, 0x021A5, 0x03104, 0x04188, 0x05176, 0x06102, 0x07100, 0x08117, 0x0916B, 0x0A100, 0x0B180, 0x0C1AC, 0x0D111, 0x0E100, 0x0F180, 0x0015E, 0x01101, 0x02130, 0x031A0, 0x01104, 0x02110, 0x03108, 0x04100, 0x05110, 0x06140, 0x07183, 0x0F120, 0x0E1A0, 0x0D190, 0x0C180, 0x0B102, 0x0A180, 0x09145, 0x0A104, 0x09106, 0x08148, 0x0011D, 0x07111, 0x01102, 0x00100, 0x08198, 0x05142, 0x02109, 0x0C1C1, 0x05140, 0x01112, 0x0B127, 0x0F102, 0x02188, 0x0D130, 0x01103, 0x031C5, 0x04121, 0x091C5, 0x05162, 0x06100, 0x07140, 0x0A188, 0x0F182, 0x02108, 0x00102, 0x0E17A, 0x0B105, 0x0C182, 0x04128, 0x01161, 0x0C109, 0x02100, 0x05102, 0x0F10A, 0x00184, 0x02100, 0x05100, 0x08194, 0x0E100, 0x0A110, 0x01131, 0x05132, 0x07110, 0x01120, 0x07102, 0x00130, 0x01112, 0x0E168, 0x05101, 0x01115, 0x0210A, 0x03108, 0x04166, 0x05180, 0x061CC, 0x0711A, 0x081C0, 0x09140, 0x0A102, 0x0B104, 0x0C181, 0x0D140, 0x0E144, 0x0F18E, 0x0D1A2, 0x01128, 0x00108, 0x05196, 0x0C101, 0x0112F, 0x04140, 0x0810A, 0x02113, 0x0010A, 0x04101, 0x03152, 0x07182, 0x091D0, 0x0C102, 0x0F1C4, 0x01180, 0x001F5, 0x081B4, 0x0C160, 0x09172, 0x0512A, 0x07120, 0x06122,
		0, 0x02100, 0x07161, 0x07144, 0x06109, 0x00194, 0x081A2, 0x02144, 0x0B180, 0x02199, 0x02153, 0x07165, 0x05104, 0x09150, 0x08109, 0x04150, 0x07108, 0x08102, 0x0310C, 0x00122, 0x0114D, 0x021AB, 0x0112A, 0x04140, 0x0B132, 0x02100, 0x02144, 0x0810C, 0x011E0, 0x081AE, 0x02104, 0x0F138, 0x06142, 0x0E1C4, 0x0214E, 0x01101, 0x01100, 0x031E3, 0x0D111, 0x00190, 0x0E109, 0x07120, 0x02102, 0x0B185, 0x031A1, 0x0218A, 0x05108, 0x04168, 0x00100, 0x05104, 0x09171, 0x081A0, 0x02142, 0x07119, 0x0110C, 0x02100, 0x0B131, 0x04108, 0x04148, 0x03198, 0x021AA, 0x0E180, 0x05182, 0x0F130, 0x0E110, 0x0D187, 0x0C18A, 0x0B100, 0x0A1A2, 0x09100, 0x081C0, 0x0710D, 0x06119, 0x05100, 0x04100, 0x03188, 0x02153, 0x01100, 0x00140, 0x0A120, 0x0F136, 0x01100, 0x051A3, 0x08160, 0x01152, 0x07144, 0x09122, 0x071CA, 0x00100, 0x0118C, 0x02161, 0x0310A, 0x04120, 0x05105, 0x06105, 0x07180, 0x08101, 0x09140, 0x0A104, 0x0B174, 0x0C1C7, 0x0D115, 0x05108, 0x011D0, 0x041C8, 0x0B142, 0x0F145, 0x0F110, 0x02117, 0x00113, 0x05169, 0x03100, 0x05100, 0x00101, 0x001AA, 0x07160, 0x0A104, 0x051C1, 0x0C120, 0x00101, 0x02108, 0x06100, 0x02105, 0x0714C, 0x0D140, 0x03143, 0x09180, 0x0F113, 0x05122, 0x0B120, 0x04102, 0x07182, 0x011CF, 0x06104, 0x07104, 0x08100, 0x09136, 0x0A195, 0x0B126, 0x0C100, 0x0D1B8, 0x00133, 0x0E10D, 0x0F155, 0x00118, 0x01100, 0x021A2, 0x03111, 0x04188, 0x05161, 0x061CE, 0x07158, 0x02110, 0x04189, 0x05108, 0x0A118, 0x0B112, 0x00160, 0x02110, 0x09180, 0x0C10A, 0x01140, 0x03110, 0x05106, 0x07100, 0x09145, 0x0B180, 0x0D154, 0x01148, 0x02108, 0x05100, 0x08118, 0x02150, 0x0012C, 0x031C0, 0x0B100, 0x03108, 0x06182, 0x021B5, 0x01190, 0x03122, 0x00124, 0x02120, 0x00149, 0x09101, 0x05110, 0x03109, 0x04140, 0x08126, 0x0E1C1, 0x02102, 0x01124, 0x0011C, 0x0D146, 0x01144, 0x04109, 0x05122, 0x06122, 0x09112, 0x05104, 0x001A8, 0x01140, 0x03190, 0x0610A, 0x0C148, 0x0D122, 0x021A1, 0x07180, 0x02101, 0x0F1E1, 0x01109, 0x0414C, 0x08105, 0x02173, 0x09101, 0x0F101, 0x06102, 0x06121, 0x05100, 0x06190, 0x07199, 0x08124, 0x091C0, 0x0A113, 0x0B146, 0x0C142, 0x0D100, 0x0E106, 0x0F122, 0x0013A, 0x01100, 0x02110, 0x031C8, 0x091A1, 0x0714A, 0x01134, 0x0A140, 0x0C128, 0x02108, 0x05146, 0x09102, 0x03157, 0x0B1B4, 0x06104, 0x02138, 0x00148, 0x07188, 0x0E1C0, 0x0113A, 0x0D10A, 0x0515B, 0x03178, 0x02100, 0x01110, 0x09180, 0x0310A, 0x01148,
		0, 0x05180, 0x05103, 0x02142, 0x04122, 0x02116, 0x031C0, 0x03102, 0x0C193, 0x00108, 0x01120, 0x0A100, 0x01101, 0x02118, 0x04181, 0x0C14C, 0x021C3, 0x01144, 0x09102, 0x02100, 0x00101, 0x0D1B4, 0x00141, 0x03140, 0x0C101, 0x07132, 0x09133, 0x0A100, 0x06104, 0x0C152, 0x06110, 0x0C133, 0x09148, 0x0D162, 0x08108, 0x0512A, 0x06142, 0x0C104, 0x07191, 0x05181, 0x02181, 0x08100, 0x03101, 0x05142, 0x05111, 0x0A10F, 0x06194, 0x06144, 0x02140, 0x0A144, 0x01120, 0x02104, 0x08128, 0x06120, 0x02142, 0x05142, 0x0A150, 0x05100, 0x0D1A4, 0x04113, 0x07194, 0x0D120, 0x06130, 0x07112, 0x03101, 0x01190, 0x00141, 0x01184, 0x02106, 0x00128, 0x01180, 0x02186, 0x03104, 0x04124, 0x05104, 0x061BA, 0x07110, 0x08145, 0x09148, 0x0A101, 0x0B13D, 0x0C120, 0x0D1A2, 0x0E140, 0x00188, 0x08100, 0x0D11B, 0x011A0, 0x0E128, 0x0F168, 0x00100, 0x01128, 0x02180, 0x03170, 0x04194, 0x05101, 0x06149, 0x07104, 0x08100, 0x0910A, 0x0A110, 0x0B142, 0x0014E, 0x04140, 0x02192, 0x06123, 0x06111, 0x00170, 0x0E100, 0x0316A, 0x00120, 0x01150, 0x00120, 0x02106, 0x0810C, 0x09118, 0x05192, 0x00170, 0x0412A, 0x0D181, 0x03171, 0x07100, 0x00130, 0x08101, 0x0E188, 0x04195, 0x0A1BD, 0x00100, 0x06144, 0x0C101, 0x03109, 0x08152, 0x0F118, 0x0F102, 0x0E101, 0x0D10A, 0x0C188, 0x0B120, 0x0A134, 0x09121, 0x08190, 0x07151, 0x06110, 0x05102, 0x041A2, 0x03142, 0x02116, 0x01101, 0x00140, 0x0F13D, 0x0E14F, 0x0D16E, 0x05104, 0x031B2, 0x06140, 0x01189, 0x0214C, 0x01108, 0x05121, 0x03184, 0x0D100, 0x02163, 0x041A1, 0x06108, 0x08198, 0x0A188, 0x0C190, 0x0E164, 0x02108, 0x03160, 0x09100, 0x00118, 0x06198, 0x0311C, 0x0A102, 0x00181, 0x071F8, 0x02122, 0x03144, 0x05112, 0x081C5, 0x08102, 0x07141, 0x0E105, 0x01120, 0x0812B, 0x0E188, 0x0D198, 0x0C10C, 0x0B140, 0x0A102, 0x09122, 0x08104, 0x07100, 0x06108, 0x05100, 0x04132, 0x03180, 0x021C8, 0x01108, 0x0A160, 0x08125, 0x0A1B1, 0x02108, 0x04110, 0x00128, 0x02121, 0x08190, 0x0E108, 0x03156, 0x07178, 0x03104, 0x02186, 0x05124, 0x08109, 0x0318C, 0x03104, 0x03128, 0x0F114, 0x0E105, 0x0D118, 0x0C125, 0x0B102, 0x0A145, 0x09100, 0x0810E, 0x07112, 0x06103, 0x05100, 0x04141, 0x0313C, 0x02104, 0x01101, 0x0C100, 0x0B101, 0x00101, 0x051AA, 0x07100, 0x09145, 0x0D108, 0x05122, 0x0912C, 0x02167, 0x01181, 0x0C120, 0x0818C, 0x0010A, 0x01188, 0x03182, 0x0D112, 0x05120, 0x06180, 0x0B151, 0x09148, 0x0A192, 0x02108, 0x03107,
		0, 0x00161, 0x0212D, 0x08120, 0x0A108, 0x0C144, 0x0A181, 0x04105, 0x0D140, 0x02124, 0x09100, 0x0C110, 0x06115, 0x0E141, 0x0A140, 0x01110, 0x00123, 0x09101, 0x0C161, 0x071C0, 0x0A10A, 0x071BB, 0x01104, 0x02142, 0x0D102, 0x03150, 0x0D121, 0x0917C, 0x09104, 0x07107, 0x02190, 0x05180, 0x03112, 0x0C102, 0x03180, 0x02196, 0x03151, 0x0A100, 0x09144, 0x06106, 0x06106, 0x09143, 0x04191, 0x06155, 0x0A1AD, 0x0E140, 0x07181, 0x07199, 0x061C8, 0x0F105, 0x0A180, 0x0D153, 0x0F140, 0x04180, 0x0C128, 0x07100, 0x02140, 0x0C195, 0x09107, 0x07105, 0x0810D, 0x0C189, 0x0110C, 0x001E4, 0x0A180, 0x02140, 0x03100, 0x07100, 0x0C10C, 0x0F121, 0x0E183, 0x0D152, 0x0C100, 0x0B141, 0x0A181, 0x09126, 0x08100, 0x0718E, 0x06110, 0x051B0, 0x04114, 0x03100, 0x02181, 0x0110C, 0x02130, 0x09102, 0x02120, 0x05180, 0x0010D, 0x03114, 0x01159, 0x02131, 0x061A0, 0x09103, 0x05191, 0x0A146, 0x0C168, 0x0F101, 0x05114, 0x071E4, 0x0810C, 0x0B1E1, 0x02180, 0x0514C, 0x00101, 0x08141, 0x03180, 0x00155, 0x00120, 0x0D100, 0x0412D, 0x081A7, 0x00100, 0x09108, 0x08104, 0x00102, 0x04108, 0x00120, 0x0510D, 0x03181, 0x0E150, 0x08104, 0x03124, 0x0912A, 0x0F101, 0x05100, 0x0B195, 0x01113, 0x07103, 0x0D182, 0x02101, 0x091C4, 0x0E105, 0x00102, 0x03158, 0x06188, 0x09141, 0x0C118, 0x0F104, 0x02130, 0x05114, 0x08181, 0x0B15C, 0x0E188, 0x01128, 0x041EA, 0x07109, 0x0A10A, 0x0D165, 0x001A2, 0x03120, 0x06129, 0x00102, 0x08193, 0x05105, 0x0014B, 0x0D122, 0x001C0, 0x00146, 0x0510A, 0x08170, 0x081A4, 0x06198, 0x001A0, 0x00180, 0x02190, 0x08189, 0x00120, 0x0018A, 0x0A100, 0x02105, 0x03101, 0x04102, 0x091B4, 0x041B8, 0x03115, 0x02112, 0x00100, 0x04129, 0x02181, 0x0D140, 0x03145, 0x04100, 0x0A181, 0x0218C, 0x091AC, 0x0210E, 0x08180, 0x05100, 0x081C7, 0x0C130, 0x02146, 0x00164, 0x0A1CA, 0x0010C, 0x0F1C0, 0x0E149, 0x04160, 0x05102, 0x07102, 0x02119, 0x07104, 0x00102, 0x0118A, 0x07142, 0x08103, 0x01180, 0x0A142, 0x0B10A, 0x0C100, 0x021A1, 0x0918D, 0x04110, 0x07130, 0x0E142, 0x05145, 0x07186, 0x08174, 0x00143, 0x05108, 0x09110, 0x01180, 0x07180, 0x02110, 0x0A140, 0x0F130, 0x0C110, 0x05116, 0x0B10A, 0x0316A, 0x07109, 0x08100, 0x09109, 0x0411E, 0x0F148, 0x00108, 0x041A3, 0x00101, 0x061C1, 0x09102, 0x00122, 0x03160, 0x0F11D, 0x05110, 0x001B0, 0x0710D, 0x0A125, 0x0710D, 0x06104, 0x05101, 0x04151, 0x03100, 0x021E1, 0x01110, 0x00129, 0x0D1B0, 0x0A180,
		0, 0x01130, 0x0F108, 0x05100, 0x00142, 0x031C0, 0x01104, 0x05104, 0x0E100, 0x08141, 0x05102, 0x09100, 0x041CC, 0x031C0, 0x04100, 0x00118, 0x0B100, 0x05120, 0x02180, 0x05189, 0x00160, 0x01128, 0x0D120, 0x01144, 0x0E150, 0x01188, 0x04143, 0x01191, 0x0C101, 0x041E0, 0x01114, 0x09120, 0x04102, 0x0B107, 0x01145, 0x0B150, 0x08122, 0x06143, 0x02111, 0x0A100, 0x041C2, 0x03107, 0x051E9, 0x0C140, 0x04103, 0x03130, 0x08159, 0x08110, 0x07120, 0x02100, 0x09109, 0x01148, 0x091A5, 0x00109, 0x0D140, 0x0A100, 0x08173, 0x061B6, 0x00151, 0x08118, 0x09100, 0x0B183, 0x00100, 0x011C8, 0x05120, 0x05164, 0x0A180, 0x08100, 0x00104, 0x05102, 0x07110, 0x09130, 0x0A1F0, 0x0C122, 0x0F148, 0x0610A, 0x081B8, 0x0A140, 0x00153, 0x02116, 0x04102, 0x0612C, 0x08182, 0x01103, 0x05100, 0x0A100, 0x0C101, 0x0F191, 0x011C2, 0x00120, 0x03170, 0x05100, 0x06182, 0x08158, 0x04110, 0x0A178, 0x001AA, 0x0D100, 0x01101, 0x02106, 0x09142, 0x0110C, 0x0A195, 0x07101, 0x0F104, 0x03174, 0x05104, 0x00154, 0x00100, 0x00122, 0x0C10E, 0x05104, 0x0A100, 0x0712A, 0x0110C, 0x01190, 0x03120, 0x001AA, 0x0A180, 0x0118A, 0x02128, 0x0F124, 0x0414C, 0x0A144, 0x00186, 0x06104, 0x0C116, 0x021C8, 0x081CA, 0x0E1CC, 0x01100, 0x0A144, 0x0D109, 0x011C2, 0x04190, 0x07101, 0x0A181, 0x0D180, 0x00180, 0x03144, 0x06180, 0x09104, 0x0C141, 0x0F161, 0x02104, 0x051A2, 0x08186, 0x0B10A, 0x0E128, 0x01142, 0x04104, 0x07185, 0x01102, 0x02116, 0x00122, 0x06110, 0x04114, 0x02160, 0x0A108, 0x0D121, 0x00100, 0x05134, 0x02190, 0x001B2, 0x0110C, 0x0D1C1, 0x021A1, 0x09150, 0x05100, 0x0B180, 0x01161, 0x00101, 0x08110, 0x0A188, 0x0B120, 0x0910C, 0x0D168, 0x0B144, 0x071ED, 0x0914E, 0x001C3, 0x0410D, 0x08100, 0x03118, 0x03101, 0x0A105, 0x00114, 0x00100, 0x01100, 0x00105, 0x0210A, 0x0C1A0, 0x03128, 0x0A151, 0x0D141, 0x00104, 0x03100, 0x00109, 0x04106, 0x01190, 0x03110, 0x06104, 0x0E165, 0x001A3, 0x0C100, 0x05100, 0x07104, 0x09100, 0x0F129, 0x02148, 0x0819A, 0x0D100, 0x0A110, 0x08170, 0x0D181, 0x09110, 0x0C12C, 0x01111, 0x05102, 0x0211C, 0x06110, 0x09182, 0x0D100, 0x011B0, 0x0A1B4, 0x04142, 0x07141, 0x03111, 0x08110, 0x0510A, 0x04188, 0x0F180, 0x0D181, 0x01104, 0x021C0, 0x00103, 0x00109, 0x03100, 0x0A105, 0x01102, 0x04166, 0x01108, 0x06112, 0x07118, 0x00110, 0x05152, 0x0317D, 0x0E126, 0x0A100, 0x08108, 0x02100, 0x00100, 0x01124, 0x0511A, 0x07104, 0x0910D, 0x00105,
		0, 0x0E173, 0x03150, 0x02148, 0x091B8, 0x01102, 0x00111, 0x06180, 0x0F108, 0x09108, 0x01113, 0x02100, 0x0212C, 0x0A100, 0x02141, 0x01145, 0x0E167, 0x04141, 0x08190, 0x06122, 0x0B108, 0x0E190, 0x02102, 0x00100, 0x0F102, 0x07140, 0x0E142, 0x02106, 0x011E0, 0x0D1B1, 0x00130, 0x04101, 0x0A124, 0x0711C, 0x04185, 0x0C12C, 0x091E0, 0x05140, 0x00182, 0x01108, 0x00102, 0x08180, 0x06142, 0x0D11A, 0x02184, 0x0C108, 0x09145, 0x0918D, 0x0C121, 0x03100, 0x081AE, 0x05108, 0x0A143, 0x0318C, 0x06108, 0x00134, 0x01182, 0x07142, 0x01115, 0x02128, 0x0A100, 0x07142, 0x03110, 0x02111, 0x08106, 0x09148, 0x0C110, 0x00101, 0x02151, 0x041A1, 0x05140, 0x02100, 0x01104, 0x00150, 0x0A160, 0x0C149, 0x0F100, 0x0E164, 0x05194, 0x06122, 0x071DC, 0x00134, 0x01126, 0x05150, 0x031E4, 0x00108, 0x0A101, 0x02144, 0x02128, 0x01181, 0x05100, 0x03104, 0x07100, 0x09100, 0x021A2, 0x0F100, 0x0C102, 0x0A100, 0x00108, 0x07145, 0x05138, 0x00120, 0x07100, 0x02152, 0x0D118, 0x01103, 0x0A11D, 0x001A0, 0x00155, 0x001D4, 0x00182, 0x0B14A, 0x06104, 0x00108, 0x00120, 0x07140, 0x02193, 0x00109, 0x03141, 0x07104, 0x04104, 0x01118, 0x05180, 0x0B15B, 0x01108, 0x07188, 0x0D123, 0x03180, 0x09120, 0x0F103, 0x00110, 0x0B118, 0x0C115, 0x02106, 0x0513C, 0x08102, 0x0B101, 0x0E141, 0x01144, 0x04190, 0x07132, 0x0A111, 0x0D131, 0x00101, 0x03183, 0x0618B, 0x09101, 0x0C140, 0x0F100, 0x021A0, 0x05197, 0x081F2, 0x0C180, 0x00144, 0x0C140, 0x07124, 0x08111, 0x001C2, 0x0E131, 0x0F161, 0x04108, 0x00181, 0x01122, 0x0C1C2, 0x0F140, 0x07106, 0x08162, 0x00102, 0x00154, 0x0C119, 0x0B100, 0x07101, 0x01180, 0x0F161, 0x04129, 0x05124, 0x06120, 0x0410E, 0x08126, 0x0A108, 0x05141, 0x0D105, 0x05117, 0x02164, 0x041A0, 0x0B122, 0x01102, 0x0718A, 0x001AD, 0x04168, 0x06188, 0x0F101, 0x08133, 0x05102, 0x07140, 0x0B112, 0x06124, 0x01100, 0x00102, 0x04144, 0x09142, 0x0B180, 0x02151, 0x041C8, 0x0D180, 0x03110, 0x05130, 0x08108, 0x00121, 0x01191, 0x0310A, 0x05148, 0x0311B, 0x00122, 0x01190, 0x07108, 0x02122, 0x0F102, 0x001F0, 0x041C2, 0x0A100, 0x00121, 0x0C108, 0x00108, 0x05102, 0x06140, 0x0E188, 0x00114, 0x07104, 0x0010C, 0x03164, 0x00158, 0x02109, 0x00160, 0x0810F, 0x00100, 0x08105, 0x0512C, 0x0E101, 0x02134, 0x00148, 0x00152, 0x09180, 0x0B154, 0x07180, 0x00114, 0x03100, 0x05102, 0x00158, 0x02109, 0x0E100, 0x0C160, 0x01154, 0x00144, 0x03108, 0x05130, 0x0D126,
		0, 0x04116, 0x0D102, 0x0A125, 0x05180, 0x00111, 0x06180, 0x0F108, 0x01120, 0x0A100, 0x01101, 0x02118, 0x0A100, 0x02141, 0x01145, 0x0E167, 0x04141, 0x0A108, 0x0C144, 0x0A181, 0x04105, 0x02102, 0x0A100, 0x09144, 0x06106, 0x06106, 0x02100, 0x02144, 0x0810C, 0x011E0, 0x081AE, 0x0A124, 0x0711C, 0x08122, 0x071C1, 0x0B142, 0x0B18A, 0x00182, 0x01108, 0x00102, 0x08180, 0x06142, 0x0D11A, 0x02184, 0x0C108, 0x09145, 0x01120, 0x02104, 0x08128, 0x06120, 0x05108, 0x0A143, 0x06120, 0x02142, 0x05142, 0x0A150, 0x07120, 0x02100, 0x09109, 0x01148, 0x07142, 0x03110, 0x02111, 0x061B6, 0x00151, 0x08118, 0x09100, 0x0E140, 0x00188, 0x08100, 0x0D11B, 0x01104, 0x06110, 0x051B0, 0x04114, 0x03100, 0x0E164, 0x02106, 0x00128, 0x01180, 0x02186, 0x01126, 0x00101, 0x02151, 0x041A1, 0x05140, 0x0A195, 0x07101, 0x0F104, 0x03174, 0x02144, 0x0D194, 0x01145, 0x0C109, 0x0F100, 0x0C102, 0x0A100, 0x00108, 0x0010D, 0x03114, 0x01159, 0x02131, 0x0A100, 0x00108, 0x07145, 0x05138, 0x001A0, 0x00120, 0x02106, 0x0810C, 0x09118, 0x06104, 0x0414C, 0x0A144, 0x00186, 0x06104, 0x0F1C0, 0x0E101, 0x05180, 0x06124, 0x01118, 0x05180, 0x0B15B, 0x02117, 0x00113, 0x05169, 0x03100, 0x09120, 0x0B120, 0x0A134, 0x09121, 0x08190, 0x07101, 0x0A181, 0x0D180, 0x0B15C, 0x0E188, 0x01128, 0x041EA, 0x07132, 0x0A111, 0x0D131, 0x0F118, 0x0F102, 0x0E101, 0x0D10A, 0x0C140, 0x02116, 0x00122, 0x06110, 0x04114, 0x0C180, 0x00146, 0x0510A, 0x08170, 0x081A4, 0x001C2, 0x0E131, 0x0F161, 0x04108, 0x0F13D, 0x0E14F, 0x0D16E, 0x05104, 0x06159, 0x00101, 0x0A180, 0x0219B, 0x0C119, 0x0B100, 0x08198, 0x0A188, 0x0C190, 0x0E164, 0x05124, 0x01190, 0x0E100, 0x051A8, 0x06159, 0x05141, 0x021A1, 0x09150, 0x05100, 0x0B180, 0x0B122, 0x0C130, 0x02146, 0x00164, 0x0A1CA, 0x06188, 0x0F101, 0x08133, 0x05102, 0x091AC, 0x0210E, 0x08180, 0x05100, 0x00102, 0x04144, 0x09142, 0x0B180, 0x02151, 0x041C8, 0x0D180, 0x03110, 0x01110, 0x0D10B, 0x041A0, 0x0E141, 0x0310A, 0x08194, 0x0E100, 0x0A110, 0x01131, 0x07108, 0x05124, 0x08109, 0x0318C, 0x03104, 0x0A100, 0x01180, 0x0A142, 0x0B10A, 0x0C100, 0x06140, 0x0E188, 0x00114, 0x06103, 0x05100, 0x04141, 0x041A3, 0x00101, 0x061C1, 0x09102, 0x00100, 0x08105, 0x0F130, 0x0C110, 0x05116, 0x0B10A, 0x05120, 0x06180, 0x0B151, 0x09148, 0x03111, 0x03100, 0x05102, 0x00158, 0x02109, 0x0E100, 0x0C160, 0x01154, 0x0317D, 0x001B0, 0x0710D, 0x0A125, 0x0710D
	);

	var excl = new Array();

	if (missionVariables.famous_planets) {
		excl.push(8, 130, 40, 125, 247, 101, 56, 155, 149, 142);
	}	

	for (var i = 0; i < excl.length; i++) this.system_info[excl[i]] = 0;
}

this.Log = function(str)
{
	if (log) log(str);
	else Log(str);
}

this.reset = function()
{
	this.systemDone = false;
}

this.moveSun = function()
{
	// keep the sun close for oolite-nova
	if (galaxyNumber == 3 && !missionVariables.nova && player.hasEquipment("EQ_GAL_DRIVE") && missionVariables.novacount && missionVariables.novacount > 2) return;

	let s = system.sun;
	if(s) s.setPosition(s.position.add(s.position.subtract(system.mainPlanet.position).multiply(this.sun_multiple)));
}

this.shipWillLaunchFromStation  =  function()
{
	this.populate();
}

this.shipWillExitWitchspace = function()
{
	this.systemDone = false;
	this.populate();
}

this.populate = function()
{
	if (this.systemDone || !system.sun || system.isInterstellarSpace) return;

	this.addMoons();
	this.addPlanets();
	this.addGriffExtra();
	this.homePlanet();
	this.moveSun();
	this.systemDone = true;
}

this.addMoons = function()
{
	var sys_info = this.system_info[galaxyNumber * 256 + system.ID + 1] & (0x0F >> (4 - this.max_moons));

	if (sys_info & 0x01) {
		system.addMoon("moon1");
	}
	if (sys_info & 0x02) {
		system.addMoon("moon2");
	}
	if (sys_info & 0x04) {
		system.addMoon("moon3");
	}
	if (sys_info & 0x08) {
		system.addMoon("moon4");
	}
}

this.addPlanets = function()
{
	var sys_info = this.system_info[galaxyNumber * 256 + system.ID + 1] & (0xF0 >> (4 - this.max_planets));

	if (sys_info & 0x10) {
		system.addPlanet("planet1");
	}
	if (sys_info & 0x20) {
		system.addPlanet("planet2");
	}
	if (sys_info & 0x40) {
		system.addPlanet("planet3");
	}
	if (sys_info & 0x80) {
		system.addPlanet("planet4");
	}
}

this.homePlanet = function()
{
	if (!this.system_info[galaxyNumber * 256 + system.ID + 1]) return;

	system.mainPlanet.setTexture('home_planet' + (((this.system_info[galaxyNumber * 256 + system.ID + 1] & 0xFF000) >> 12) + 1) + '.png');
}

this.addGriffExtra = function()
{
	var planet = galaxyNumber * 256 + system.ID;

	if (this.system_info[planet] & 0x100) {

		// Space Bar
		system.legacy_addSystemShips("griff_spacebar", 1, 1.2);
	}
	if (this.system_info[planet] & 0x200) {

		// Busy Ports
		system.legacy_addShips("griff_freighter", 2);
		system.legacy_addShipsAtPrecisely("griffoutpost", 1, "pwm", -104637.88, -71408.84, 552582.81);
		system.legacy_addShipsAtPrecisely("griff_buoy", 1, "pwm", -99710.28, -68559.51, 550078.50);
		system.legacy_addShipsAtPrecisely("loader_cargo", 6, "pwm", -91231.71, -69790.37, 548172.31);
	}
	if (this.system_info[planet] & 0x400) {

		// Mining Equipment
		system.legacy_addShipsWithinRadius("autominer", 2, "wpm", 1000, 1000, 1000, 8000);
		system.legacy_addShipsWithinRadius("asteroid", 5, "wpm", 1000, 1000, 1000, 4000);
		system.legacy_addShipsWithinRadius("boulder", 8, "wpm", 1000, 1000, 1000, 4000);
		system.legacy_addShipsWithinRadius("mining_hopper", 1, "wpm", 1000, 1000, 1000, 4000);
		system.legacy_addShipsWithinRadius("hopper_home", 1, "wpm", 1000, 1000, 1000, 100);
	}
	if (this.system_info[planet] & 0x800) {
	}
}

Posted: Thu Sep 24, 2009 7:44 am
by Commander McLane
Cmd. Cheyd wrote:
But I will say, aside from the raw art-work end of this project, the creation of those algorithms (especially the main-planet texture one) was by far the hardest part of this project to date.
I fully appreciate that. And yes, if you like, you can send me a copy to commander_mclane squiggle planet point ms.

Just one correction: System_Redux v1 has a different random number for every system in every galaxy, which sets the texture and allows for the adding of up to four moons and up to four extra planets. The first two decals of the hexadecimal random number determine the main planet texture. The last two determine the extra moons and planets. CaptKev and Kaks will be able to explain it in more detail. But the bottom line is that planets #63 in each galaxy are different from each other.

EDIT: I see that CaptKev has beaten me and already posted their script.

I also have no brilliant idea out of my head on how to deal with sudden changes in a system's stats. It's just that it will happen.

Posted: Thu Sep 24, 2009 3:39 pm
by Micha
Discussing with Cmd_Cheyd, a solution might be to expose the original system stats to JS as well as the current system stats (which may or may not be the same, depending on mission variables or installed OXPs). The idea being that anything which should be immutable (such as planet textures) use the immutable original stats.

Posted: Thu Sep 24, 2009 3:52 pm
by Thargoid
Although just as a thought, why should the texture be immutable? Thinking here for example of an OXP which could inflict massive planetary damage or something (e.g. a nova'd system) where the appearance of the planet might justifiably change linked to for example population or government (or lack thereof) or directly to system nova status.

Indeed having the planetary appearance get really changed by a nova could be a nice side-feature for System Redux 2, or even in trunk.

The proposition of making the "original" stats available as well as the current ones is a good one, then let the scripter decide which to use.

Posted: Thu Sep 24, 2009 4:02 pm
by Cmd. Cheyd
Thargoid-
I think Micha just means I could base SysRed2 off the immutable stats so that other OXP's changing system.info.foo wouldn't cause mine to pick a varying number of moons or pick different textures. Not that EVERY texture should have to be immutable.

As for your idea, I LOVE it. I may have to see if I can make a massively charred texture. Or is planets ever get shader-support... ;)

Posted: Thu Sep 24, 2009 7:32 pm
by JensAyton
As I see it, System Redux planets should change to match the actual properties of a system. It seems much more in keeping with the Oolite ethos than trying to stick to “original” values. Remember, changes can be static as well as dynamic, and a dynamically altered planet’s default tech level might not be the original Oolite value.

On the other hand, scripts don't live in a vacuum. System Redux could very well provide a function for other OXPs to use to override the system info values, so that mission OXPs can choose to integrate with it.

(Note to other coders: I’ve already implemented access to the original numerical properties, but chosen not to check it in yet.)

Posted: Sun Sep 27, 2009 4:28 pm
by PhantorGorth
@Cmd. Cheyd: You still needing to fix that pseudo-random array code?

I have looked at it and would you say you are trying to create a fixed list of pseudo-random numbers which are all unique? Currently you do this by creating each in turn from the previous and then check to see if the number is already in the list. If it is then use a different formula with an incrementing input argument which you use until you obtain an unused value. This is then repeated for each entry until the list is complete.

The problem must be the way you have to search for a unique value. Now long it takes will be dependent on the initial seed value input to the function but in an unpredictable way.

A more sensible algorithm would be to have your badseed array replaced by a binary tree and to have the next seed value to be build from the existing seed plus a pseudo-random interval. Using intSeed, intLower, intUpper and inSize the algorithm would described like this:

Code: Select all

generatePseudoArray function( intSeed, intLower, intUpper, intSize):
{
	Initialise List
	intialNode = Address of single initialised tree node. //consists of variables: Value (int), Lower (pointer), Higher (pointer)
								and CountBelow (int) all initialised as 0
	newSeed = intSeed
	count = 0
	Repeat 
	{
		skipbase = newSeed
		newSeed = (newSeed - intLower + [pseudo-random number that is not system(planet) 
			specification based e.g. (large random prime * newSeed + other random prime)]) 
			MOD (intUpper-intLower+1) + intLower
		trynewSeed = newSeed
		if count > 0 then
		{
			Repeat 
			{
				tryoldSeed = trynewSeed
				trynewSeed = newSeed + CountSeedsBelow(trynewSeed, intialNode) - CountSeedsBelow(skipbase -1, intialNode)
				If trynewSeed > intUpper  // To deal with wrapping
				{
					newSeed = (trynewSeed - intLower) MOD (intUpper-intLower+1) + intLower
					trynewSeed = newSeed
					skipbase = intLower
				}
			} Until trynewSeed = tryoldSeed
			newSeed = trynewSeed
		}
		Add newSeed to List
		AddSeedToTree(newSeed, intialNode)
		count++
	} Until count = intSize
	Deallocate Tree
	Return List
}

AddSeedToTree Procedure(inValue, NodeRef):
{
	If (NodeRef.Lower = 0 and NodeRef.Higher = 0)
	{
		NodeRef.Value = inValue
		Return
	}
	If NodeRef.Value < inValue
	{
		NodeRef.CountBelow = NodeRef.CountBelow + 1
		If NodeRef.Lower = 0
		{
			Create and Intialise New NodeRef
			NodeRef.Lower = New NodeRef address
		}
		AddSeedToTree(inValue, NodeRef.Lower)
	}
	else if NodeRef.Value > inValue
	{
		If NodeRef.Higher = 0
		{
			Create and Intialise New NodeRef
			NodeRef.Higher = New NodeRef address
		}
		AddSeedToTree(inValue, NodeRef.Higher)		
	}
	else
	{
		Return //Shouldn't happen as no two values in tree should be the same
	}
	Return			
}

CountSeedsBelow Function(inValue, NodeRef):
{
	if NodeRef.Value = inValue
	{
		Return NodeRef.CountBelow + 1
	}
	if NodeRef.Value < inValue
	{
		if NodeRef.Lower = 0
		{
			Return 0
		}
		else
		{
			Return CountSeedsBelow(inValue, NodeRef.Lower)
		}
	if NodeRef.Value > inValue
	{
		if NodeRef.Higher = 0
		{
			Return NodeRef.CountBelow + 1
		}
		else
		{
			Return NodeRef.CountBelow + 1 + CountSeedsBelow(inValue, NodeRef.Higher)
		}
	}
}
Please note the above is not code but a pseudo-code description of the algorithm.

To describe what is going on in the above algorithm in simple words, a random amount is counted upwards from the last number and each number previously used in the list is skipped. Also wrapping around from intUpper to intLower occurs when count upwards. Use of a binary tree to sort the used numbers and counts below is to speed up the finding of numbers to skip. The repeated checking of skipped numbers is done because the count of skipped numbers could push the proposed number higher than some additional used numbers that therefore should be skipped. The skipbase is the previous number initially during skip checking so that the used numbers below that previous number can be ignored. As so as the number wraps round it is set to intLower so that it has no effect.

For a simple example of this algorithm in action lets start with intLower of 0, an intUpper of 19, intSeed of 1 and we use the pseudo-random generator to be 7 * current seed + 3:

The first number we get is (1 + (7 * 1 + 3)) mod (19 - 0 + 1) + 0 which is 11. This just gets entered into the List and the Tree.

Next is (11 + (7 * 11 + 3) mod 20 which is also 11. So the new seed is 11. The number tried is therefore also 11 but this time, though, it checks for existings number used below or equal to this 11 using the CountSeedsBelow function. As there is only one node and that is equal to the value of 11 it returns 1 which is it's CountBelow value (zero) plus one. The CountSeedsBelow for the skipbase - 1 (10) is 0. So the total count below is (1 - 0) = 1 and therefore the output number is new seed + count below which is 12. This not the same as the tried number of 11 and so the process is repeated for a tried number of 12. Again the numbers used below 12 is 1 so the output number (new seed + count below) is also 12. These match so 12 is added to the List and to the tree. The new Tree node is added along the "Higher" branch and so gets a CountBelow value of 0.

Next is (12 + (7 * 12 + 3)) mod 20 which is 19. The CountSeedsBelow function this time returns 2 so the output number is greater than the intUpper (19) and so the "new seed" and output number becomes (19 + 2) mod 20 which is 1. This not the same as the tried number (19) so this is repeated with a tried number of 1 and a new "new seed" number of 1 and new skipbase of zero. Now the count below is 0 and therefore the output is 1 which is the same as the tried number 1. 1 is therefore added to the List and the Tree.

This goes on until the list is intSize in size.

I haven't tested this algorithm but it should be quicker.

I hope this is useful.

Posted: Tue Sep 29, 2009 4:51 pm
by Cmd. Cheyd
Two things today:
I would like to display the first truly finished texture of this OXP. Others are all WiP. This one, I'm REALLY happy with how this turned out and the techniques used to make it will be recycled into many of the upcoming textures. This is Average Agricultural #4.
Image

Secondly:
Due to the completely justified concerns of Commander McLane, I would like to announce the addition of the SystemRedux2API (DRAFT VERSION) to this project. The base code from this was created by Ahruman, and I have expanded it with help from _ds_, Kaks, and several others. The purpose of this API to to allow inter-operability between System Redux 2 and any other OXP that wishes to leverage it.

The core concepts are that the API will allow other OXP authors to pass information (via javascript) to System Redux and tell it how to behave. They can pass or retrieve values to System Redux 2 such as government, economy, techLevel, and other things that their OXP may adjust that System Redux 2 also uses in it's algorithms. They can lock such values into System Redux 2, so even if they are changed mid-play by their own OXP, System Redux 2 will not alter it's choices in textures or additional bodies. If an OXP wishes to set it's own textures, moon, planets, or other things that System Redux 2 normally does, they can pass information to System Redux telling it exactly what, if any, parts of the system it is to touch. I hope this lays out a good framework, and if any other OXP authors see a bug in the API or a feature they wish it included, please let me know. I will do my best to incorporate it.

Below is the current (Sept. 29, 2009) code in the API script. All can be reached via it's worldscript entry also demonstrated shown below.

Code: Select all

worldScripts["SystemRedux2API"].setParametersForSystem(0,7,0,7,1,0,4000);
/*Sets custom parameters for Lave:
	Government: Anarchy
	Economy: Poor Agricultural
	techLevel: 1
	Population: 0
	Radius: 4000
*/
When set, System Redux will ignore the actual values in System.info, and use the above values (stored in as Mission Variables for consistency) for it's calculations.
In the code below, method "this.excludeSystem" - Setting any of the passed parameters (TextureMP, AddPlanets, AddMoons, TxtPlanets, TxtMoons, ReduSun) as 'true' will cause System Redux 2 to bypass that portion of it's code in the given system. These values are not stored in Mission Variables, and will be reloaded upon every jump.

Code: Select all

this.name = "SystemRedux2API";
this.author	= "Blake Deakins - a.k.a. Cmd. Cheyd";
this.description = "Provide a programmatic interface for other OXP's to control System Redux 2.0 behavior.";
this.description2 = "Portions of this code provided Ahruman";
this.version = "2.0.0";
this.copyright = "© Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported";

var excludedSystems =[[],[],[],[],[],[],[],[]];

this.setParametersForSystem = function(galaxyID, systemID, government, economy, techLevel, population, radius)
{
	// Note: prefixing a variable with + converts it to a number.
	var key = "SYSTEM_REDUX_2_DATA_" + +galaxyID + "_" +systemID;
	var data = "" + +government + "," + +economy  + "," + +techLevel + "," + +population + "," + +radius;
	
	missionVariables[key] = data;
}


this.parametersForSystem = function(galaxyID, systemID)
{
	// Look for a saved override.
	var key = "SYSTEM_REDUX_2_DATA_" + +galaxyID + "_" +systemID;
	var data = missionVariables[key];
	
	if (data)
	{
		var items = data.split(",", 5);
		if (items.length == 5)
		{
			return {
				government: items[0],
				economy: items[1],
				techLevel: items[2],
				population: items[3],
				radius: items[4]
			};
		}
	}
	
	// If we got here, there's no valid override.
	var info = System.infoForSystem(galaxyID, systemID);
	return {
		government: info.government,
		economy: info.economy,
		techLevel: info.techlevel,	// Note annoying case weirdness.
		population: info.population,
		radius: info.radius
	};
}


this.parametersForThisSystem = function()
{
	return this.parametersForSystem(galaxyNumber, system.ID);
}


this.freezeParametersForSystem = function(galaxyID, systemID)
{
	var params = this.parametersForSystem(galaxyID, systemID);
	this.setParametersForSystem(galaxyID, systemID, params.government, params.economy, params.techLevel, params.population, params.radius);
}

this.excludeSystem = function(galaxyID, systemID, TextureMP, AddPlanets, AddMoons, TxtPlanets, TxtMoons, ReduSun)
{
	var Exclusion = +systemID + "," + +TextureMP + "," + +AddPlanets + "," + +AddMoons + "," + +TxtPlanets + "," + +TxtMoons + "," + +ReduSun;
	excludedSystems[galaxyID].push(Exclusion);
}

this.excludeThisSystem = function(TextureMP, AddPlanets, AddMoons, TxtPlanets, TxtMoons, ReduSun)
{
	this.excludeSystem(galaxyNumber, system.ID, TextureMP, AddPlanets, AddMoons, TxtPlanets, TxtMoons, ReduSun);
}

this.isSystemExcluded = function(galaxyID, systemID) {
	var i,details,sysFound;
	sysFound = false;
	for (var i = 0; i<excludedSystems[galaxyID].length; i++) {
		details = excludedSystems[galaxyID][i].split(",", 7);
		if (details.length == 7 && systemID == details[0]) sysFound = true;
	}
	if (sysFound == false) return false;
	else return true;
}

this.isThisSystemExcluded = function()
{
	this.isSystemExcluded(galaxyNumber, system.ID);
}

this.getExclusionDetails = function(galaxyID, systemID) {
	var i,details;
	for (var i = 0; i<excludedSystems[galaxyID].length; i++) {
		details = excludedSystems[galaxyID][i].split(",", 7);
		if (details.length == 7 && systemID == details[0]) {
			return {
				SysID: details[0],
				TxMP: details[1],
				AddP: details[2],
				AddM: details[3],
				TxAP: details[4],
				TxAM: details[5],
				ReduxSun: details[6]
			};
		}
	}
	return {
		TxMP: false,
		AddP: false,
		AddM: false,
		TxAP: false,
		TxAM: false,
		ReduxSun: false
	};
}

Feedback is VERY welcome!

Posted: Tue Sep 29, 2009 5:01 pm
by another_commander
Minor nitpick: In the function below

Code: Select all

this.isSystemExcluded = function(galaxyID, systemID) { 
   var i,details,sysFound; 
   sysFound = false; 
   for (var i = 0; i<excludedSystems[galaxyID].length; i++) { 
      details = excludedSystems[galaxyID][i].split(",", 7); 
      if (details.length == 7 && systemID == details[0]) sysFound = true; 
   } 
   if (sysFound == false) return false; 
   else return true; 
}
I would change the last two lines to simply

Code: Select all

retrun sysFound;
just because it looks cleaner. Other than that, nice concept.

Posted: Tue Sep 29, 2009 5:09 pm
by Cmd. Cheyd
Thanks a_c. Change made.
Writing some of this at work while supposed to be doing DR prep, and writing the rest at home at 11:30 at night does seem to have had it's effect on a few areas of code. :P

Posted: Tue Sep 29, 2009 5:38 pm
by _ds_
sysFound isn't needed at all:

Code: Select all

this.isSystemExcluded = function(galaxyID, systemID) {
   for (var i = 0; i < excludedSystems[galaxyID].length; i++)
   {
      var details = excludedSystems[galaxyID][i].split(",", 7);
      if (details.length == 7 && systemID == details[0])
         return true;
   } 
   return false;
};

Posted: Tue Sep 29, 2009 9:49 pm
by Cody
Can't help with any code, Cmd. Cheyd, but that planet is excellent.

Posted: Tue Sep 29, 2009 11:24 pm
by pagroove
El Viejo wrote:
Can't help with any code, Cmd. Cheyd, but that planet is excellent.
I agree, Its beautiful. Good work!

Posted: Wed Sep 30, 2009 8:31 am
by Commander McLane
Good work! I am very pleased. :D

Posted: Wed Sep 30, 2009 11:02 am
by Kaks
One thing I just noticed:

Code: Select all

this.isSystemExcluded = function(galaxyID, systemID) {
   var i,details,sysFound;
   sysFound = false;
   for (var i = 0; i<excludedSystems[galaxyID].length; i++) { 
you don't need to declare i a second time:

Code: Select all

   for (i = 0; i<excludedSystems[galaxyID].length; i++) {