Skip to content
Snippets Groups Projects
Commit d353ca21 authored by Arkerthan's avatar Arkerthan
Browse files

create new building at storyInit

parent 6981ea70
No related branches found
No related tags found
No related merge requests found
...@@ -7,25 +7,33 @@ App.Arcology.getCellLink = function(path, message) { ...@@ -7,25 +7,33 @@ App.Arcology.getCellLink = function(path, message) {
return App.UI.DOM.passageLink(message, "Cell", () => { V.cellPath = path; }); return App.UI.DOM.passageLink(message, "Cell", () => { V.cellPath = path; });
}; };
App.Arcology.newBuilding = function() { /**
* @returns {App.Arcology.Building}
*/
App.Arcology.defaultBuilding = function() {
const sections = []; const sections = [];
sections.push(new App.Arcology.Section("s1", [[new App.Arcology.Cell.Penthouse()]])); sections.push(new App.Arcology.Section("penthouse", [[new App.Arcology.Cell.Penthouse()]]));
sections.push(new App.Arcology.Section("s2", [[new App.Arcology.Cell.Apartment(1, 2), new App.Arcology.Cell.Apartment(1, 3)]])); sections.push(new App.Arcology.Section("shops", [[new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1)]]));
sections.push(new App.Arcology.Section("s3", sections.push(new App.Arcology.Section("apartments",
[ [
[new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1)], [new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1)],
[new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Apartment(1, 1)], [new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1)],
[new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1), new App.Arcology.Cell.Shop(1)] [new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1), new App.Arcology.Cell.Apartment(1)],
] ]
)); ));
sections.push(new App.Arcology.Section("s4", [[new App.Arcology.Cell.Market(1), new App.Arcology.Cell.Market(1)]])); sections.push(new App.Arcology.Section("markets", [[new App.Arcology.Cell.Market(1), new App.Arcology.Cell.Market(1), new App.Arcology.Cell.Market(1), new App.Arcology.Cell.Market(1), new App.Arcology.Cell.Market(1)]]));
sections.push(new App.Arcology.Section("s5", [[new App.Arcology.Cell.Manufacturing(1), new App.Arcology.Cell.Manufacturing(1)]])); sections.push(new App.Arcology.Section("manufacturing", [[new App.Arcology.Cell.Manufacturing(1), new App.Arcology.Cell.Manufacturing(1), new App.Arcology.Cell.Manufacturing(1), new App.Arcology.Cell.Manufacturing(1), new App.Arcology.Cell.Manufacturing(1)]]));
return new App.Arcology.Building(sections); return new App.Arcology.Building(sections);
}; };
App.Arcology.sectionOrder = ["spire", "s1", "s2", "s3", "s4", "s5", "s6", "s7"]; /**
* Order of the building sections. All possible sections have to be added here.
*
* @type {string[]}
*/
App.Arcology.sectionOrder = ["penthouse", "spire", "shops", "apartments", "markets", "manufacturing"];
App.Arcology.Section = class { App.Arcology.Section = class {
/** /**
......
...@@ -1116,47 +1116,10 @@ You should have received a copy of the GNU General Public License along with thi ...@@ -1116,47 +1116,10 @@ You should have received a copy of the GNU General Public License along with thi
<<set $revealFoodEffects = 0>> <<set $revealFoodEffects = 0>>
<<set $rations = 0>> <<set $rations = 0>>
<<set $sectors = [ <<set $building = App.Arcology.defaultBuilding()>>
{type: "Penthouse", ownership: 1}, <<set _sellable = $building.findCells(cell => cell.canBeSold())>>
{type: "Empty", ownership: 0}, <<set _random12 = jsRandomMany(_sellable, 12)>>
{type: "Empty", ownership: 0}, <<run _random12.forEach(cell => {cell.owner = 0})>>
{type: "Empty", ownership: 0},
{type: "Empty", ownership: 0},
{type: "Shops", ownership: 1},
{type: "Shops", ownership: 1},
{type: "Shops", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Apartments", ownership: 1},
{type: "Markets", ownership: 1},
{type: "Markets", ownership: 1},
{type: "Markets", ownership: 1},
{type: "Markets", ownership: 1},
{type: "Markets", ownership: 1},
{type: "Manufacturing", ownership: 1},
{type: "Manufacturing", ownership: 1},
{type: "Manufacturing", ownership: 1},
{type: "Manufacturing", ownership: 1},
{type: "Manufacturing", ownership: 1}
]>>
<<for _i = 0; _i < 12; _i++>>
<<set _j = random(5,28)>>
<<if $sectors[_j].ownership == 1>>
<<set $sectors[_j].ownership = 0>>
<<else>>
<<set _i-->>
<</if>>
<</for>>
<<set $menials = 0>> <<set $menials = 0>>
<<set $fuckdolls = 0>> <<set $fuckdolls = 0>>
......
...@@ -69,10 +69,6 @@ ...@@ -69,10 +69,6 @@
<<set _SL = $slaves.length>> <<set _SL = $slaves.length>>
<<if $newModelUI == 1>> <<if $newModelUI == 1>>
<<link "reset" "Main">>
<<set $building = App.Arcology.newBuilding()>>
<</link>>
<span id="building"></span> <span id="building"></span>
<<script>> <<script>>
$(document).one(':passageend', () => { $(document).one(':passageend', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment