public GlobalStructureInfo(map_id unitTypeID, int researchTopic, string unitName, string codeName, int hitPoints, int armor, int oreCost, int rareOreCost, int buildTime, int sightRange, string produceListName, int sizeX, int sizeY, BuildingFlags buildingFlags, int resourcePriority, int rareRubble, int rubble, int edenDockPos, int plymDockPos, int powerRequired, int workersRequired, int scientistsRequired, int storageCapacity, int productionCapacity, int numStorageBays, int explosionSize ) : base(unitTypeID, researchTopic, unitName, codeName, hitPoints, armor, oreCost, rareOreCost, buildTime, sightRange) { ProduceListName = produceListName; SizeX = sizeX; SizeY = sizeY; BuildingFlags = buildingFlags; ResourcePriority = resourcePriority; RareRubble = rareRubble; Rubble = rubble; EdenDockPos = edenDockPos; PlymDockPos = plymDockPos; PowerRequired = powerRequired; WorkersRequired = workersRequired; ScientistsRequired = scientistsRequired; StorageCapacity = storageCapacity; ProductionCapacity = productionCapacity; NumStorageBays = numStorageBays; ExplosionSize = explosionSize; }
/// <summary> /// /// </summary> /// <param name="plot"></param> private void doBuilding() { // Construct a random building and place it into the buildings list. CityBuilding building; BuildingType type = BuildingType.BUILDING_CIVIL | BuildingType.BUILDING_GENERAL; BuildingFlags flags = BuildingFlags.BUILDING_FLAG_ACOND | BuildingFlags.BUILDING_FLAG_LIGHTS | BuildingFlags.BUILDING_FLAG_LOGO | BuildingFlags.BUILDING_FLAG_TRIM; BuildingPlot plot = new BuildingPlot(); plot.xpos = randomValue(256) / 4; plot.ypos = randomValue(256) / 4; plot.width = (byte)randomValue(10); plot.depth = (byte)randomValue(10); plot.plotFlags = PlotClaimType.CLAIM_BUILDING | PlotClaimType.CLAIM_COMPLEX; building = new CityBuilding(type, plot, flags, UUID.Zero, cityMap.centralRegions[0], "Building"); }
/// <summary> /// Construct the building class instance from the given properties. /// </summary> /// <param name="type" type="BuildingType">type</param> /// <param name="plot">The plot of land this building stands on, note it might be bigger than the /// actual buildings footprint, for example if it is part of a larger complex, limit the size of /// buildings to have a footprint of no more than 100 square meters.</param> /// <param name="flags"></param> /// <param name="owner">The owner of the building either a user, or company (group of companies) own buildings.</param> /// <param name="seed"></param> /// <param name="height">The height in floors of the building, not each floor is approximately 3 meters in size /// and thus buildings are limited to a maximum height of 100 floors.</param> public CityBuilding( BuildingType type, BuildingPlot plot, BuildingFlags flags, UUID owner, IScene scene, string name ):base(owner,new Vector3(plot.xpos,21,plot.ypos), Quaternion.Identity, PrimitiveBaseShape.CreateBox(), name, scene) { // Start the process of constructing a building given the parameters specified. For // truly random buildings change the following value (6) too another number, this is // used to allow for the buildings to be fairly fixed during research and development. buildingSeed = 6; // TODO FIX ACCESS TO THE CityModule.randomValue(n) code. buildingType = type; buildingPlot = plot; buildingFlags = flags; // Has a valid owner been specified, if not use the default library owner (i think) of the zero uuid. if (!owner.Equals(UUID.Zero)) buildingOwner = owner; else buildingOwner = UUID.Zero; // Generate a unique value for this building and it's own group if it's part of a complex, // otherwise use the zero uuid for group (perhaps it should inherit from the city?) buildingUUID = UUID.Random(); buildingGUID = UUID.Random(); buildingCenter = new Vector3((plot.xpos + plot.width / 2), 21, (plot.ypos + plot.depth) / 2); if (name.Length > 0) buildingName = name; else buildingName = "Building" + type.ToString(); // Now that internal variables that are used by other methods have been set construct // the building based on the type, plot, flags and seed given in the parameters. switch (type) { case BuildingType.BUILDING_GENERAL: OpenSim.Framework.MainConsole.Instance.Output("Building Type GENERAL", log4net.Core.Level.Info); createBlocky(); break; case BuildingType.BUILDING_LOCALE: /* switch ( CityModule.randomValue(8) ) { case 0: OpenSim.Framework.MainConsole.Instance.Output("Locale general.", log4net.Core.Level.Info); createSimple(); break; case 1: OpenSim.Framework.MainConsole.Instance.Output("locale 1", log4net.Core.Level.Info); createBlocky(); break; } */ break; case BuildingType.BUILDING_CIVIL: createTower(); break; case BuildingType.BUILDING_MILITARY: break; case BuildingType.BUILDING_HEALTHCARE: break; case BuildingType.BUILDING_SPORTS: break; case BuildingType.BUILDING_ENTERTAINMENT: break; case BuildingType.BUILDING_EDUCATION: break; case BuildingType.BUILDING_RELIGIOUS: break; case BuildingType.BUILDING_MUSEUM: break; case BuildingType.BUILDING_POWERSTATION: break; case BuildingType.BUILDING_MINEOILGAS: break; case BuildingType.BUILDING_ZOOLOGICAL: break; case BuildingType.BUILDING_CEMETARY: break; case BuildingType.BUILDING_PRISON: break; case BuildingType.BUILDING_AGRICULTURAL: break; case BuildingType.BUILDING_RECREATION: break; default: createSimple(); break; } }
/// <summary> /// Construct the building class instance from the given properties. /// </summary> /// <param name="type" type="BuildingType">type</param> /// <param name="plot">The plot of land this building stands on, note it might be bigger than the /// actual buildings footprint, for example if it is part of a larger complex, limit the size of /// buildings to have a footprint of no more than 100 square meters.</param> /// <param name="flags"></param> /// <param name="owner">The owner of the building either a user, or company (group of companies) own buildings.</param> /// <param name="seed"></param> /// <param name="height">The height in floors of the building, not each floor is approximately 3 meters in size /// and thus buildings are limited to a maximum height of 100 floors.</param> public ICityBuilding(BuildingType type, BuildingPlot plot, BuildingFlags flags, UUID owner, IScene scene, string name) : base(owner, new Vector3(plot.XPos, 21, plot.YPos), Quaternion.Identity, PrimitiveBaseShape.CreateBox(), name, scene) { // Start the process of constructing a building given the parameters specified. For // truly random buildings change the following value (6) too another number, this is // used to allow for the buildings to be fairly fixed during research and development. BuildingSeed = 6; // TODO FIX ACCESS TO THE CityModule.randomValue(n) code. BuildingType = type; BuildingPlot = plot; BuildingFlags = flags; // Has a valid owner been specified, if not use the default library owner (i think) of the zero uuid. if (!owner.Equals(UUID.Zero)) { BuildingOwner = owner; } else { BuildingOwner = UUID.Zero; } // Generate a unique value for this building and it's own group if it's part of a complex, // otherwise use the zero uuid for group (perhaps it should inherit from the city?) BuildingUUID = UUID.Random(); BuildingGUID = UUID.Random(); BuildingCenter = new Vector3((plot.XPos + plot.Width / 2), 21, (plot.YPos + plot.Depth) / 2); if (name.Length > 0) { BuildingName = name; } else { BuildingName = "Building" + type.ToString(); } // Now that internal variables that are used by other methods have been set construct // the building based on the type, plot, flags and seed given in the parameters. switch (type) { case BuildingType.BUILDING_GENERAL: OpenSim.Framework.MainConsole.Instance.Output("Building Type GENERAL", log4net.Core.Level.Info); //createBlocky(); break; case BuildingType.BUILDING_LOCALE: /* * switch ( CityModule.randomValue(8) ) * { * case 0: * OpenSim.Framework.MainConsole.Instance.Output("Locale general.", log4net.Core.Level.Info); * createSimple(); * break; * case 1: * OpenSim.Framework.MainConsole.Instance.Output("locale 1", log4net.Core.Level.Info); * createBlocky(); * break; * } */ break; case BuildingType.BUILDING_CIVIL: //createTower(); break; case BuildingType.BUILDING_MILITARY: break; case BuildingType.BUILDING_HEALTHCARE: break; case BuildingType.BUILDING_SPORTS: break; case BuildingType.BUILDING_ENTERTAINMENT: break; case BuildingType.BUILDING_EDUCATION: break; case BuildingType.BUILDING_RELIGIOUS: break; case BuildingType.BUILDING_MUSEUM: break; case BuildingType.BUILDING_POWERSTATION: break; case BuildingType.BUILDING_MINEOILGAS: break; case BuildingType.BUILDING_ZOOLOGICAL: break; case BuildingType.BUILDING_CEMETARY: break; case BuildingType.BUILDING_PRISON: break; case BuildingType.BUILDING_AGRICULTURAL: break; case BuildingType.BUILDING_RECREATION: break; default: //createSimple(); break; } }
/// <summary> /// Read building sheet. /// </summary> public static Dictionary <map_id, GlobalStructureInfo> ReadBuildingSheet() { string[][] buildingSheet = ReadSheet("building.txt"); if (buildingSheet == null) { return(null); } Dictionary <map_id, GlobalStructureInfo> infoRecords = new Dictionary <map_id, GlobalStructureInfo>(buildingSheet.GetLength(0)); // Read rows for (int i = 0; i < buildingSheet.GetLength(0); ++i) { string[] row = buildingSheet[i]; // Skip rows that don't contain enough data (probably empty line) if (row.Length < 32) { continue; } string codeName = row[0]; // Code_Name string produceName = row[1]; // Produce List Name string buildingName = row[2]; // Building Name int sizeX = ReadInt(row[3]); // X-size int sizeY = ReadInt(row[4]); // y-size ColonyType owner = ReadOwner(row[5]); // Owner [P/E/B] int hitPoints = ReadInt(row[6]); // Hit Points int armorClass = ReadInt(row[7]); // Armor Class bool border = ReadBool(row[8]); // Border [Y/N] int commonOreCost = ReadInt(row[9]); // Common Ore Cost int rareOreCost = ReadInt(row[10]); // Rare Ore Cost bool structureKit = ReadBool(row[11]); // Structure Kit [Y/N] int buildingPoints = ReadInt(row[12]); // Building Points int commonRubble = ReadInt(row[13]); // Normal Rubble (tile count) int rareRubble = ReadInt(row[14]); // Rare Rubble (tile count) int powerRequired = ReadInt(row[15]); // Power Required int workersRequired = ReadInt(row[16]); // Workers Required int scientistsRequired = ReadInt(row[17]); // Scientists Required int sightRange = ReadInt(row[18]); // Sight Range bool dockingAll = ReadBool(row[19]); // Docking All [Y/N] bool dockingTruck = ReadBool(row[20]); // Docking Truck [Y/N] bool dockingConvec = ReadBool(row[21]); // Docking Convec [Y/N] bool dockingEvac = ReadBool(row[22]); // Docking Evac [Y/N] int dockingLocationE = ReadInt(row[23]); // Docking Loc E int dockingLocationP = ReadInt(row[24]); // Docking Loc P int storageCapacity = ReadInt(row[25]); // Storage Capacity int productionCapacity = ReadInt(row[26]); // Production Capacity int storageBays = ReadInt(row[27]); // Storage bays bool autoTargeted = ReadBool(row[28]); // Can be autotargeted [Y/N] int explosionSize = ReadInt(row[29]); // Explosion size int resourcePriority = ReadInt(row[30]); // Resource priority int researchTopic = ReadInt(row[31]); // Research topic (leading zero, tech ID) map_id unitTypeId = GetMapIdFromCodeName(codeName); BuildingFlags buildingFlags = 0; if (structureKit) { buildingFlags |= BuildingFlags.StructureKit; } if (dockingAll) { buildingFlags |= BuildingFlags.DockingAll; } if (dockingTruck) { buildingFlags |= BuildingFlags.DockingTruck; } if (dockingConvec) { buildingFlags |= BuildingFlags.DockingConvec; } if (dockingEvac) { buildingFlags |= BuildingFlags.DockingEvac; } if (autoTargeted) { buildingFlags |= BuildingFlags.CanBeAutoTargeted; } infoRecords[unitTypeId] = new GlobalStructureInfo(unitTypeId, researchTopic, buildingName, codeName, hitPoints, armorClass, commonOreCost, rareOreCost, buildingPoints, sightRange, produceName, sizeX, sizeY, buildingFlags, resourcePriority, rareRubble, commonRubble, dockingLocationE, dockingLocationP, powerRequired, workersRequired, scientistsRequired, storageCapacity, productionCapacity, storageBays, explosionSize); } return(infoRecords); }