Description:
Add water tiles.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r604:38d0da2a8d6d -

@@ -66,6 +66,7
66 Leisure:
66 Leisure:
67 - Add way to mark off area for leisure @milestone(7: Leisure)
67 - Add way to mark off area for leisure @milestone(7: Leisure)
68 Maybe add leisure items instead?
68 Maybe add leisure items instead?
69 Or both?
69 - Add paths @milestone(7: Leisure)
70 - Add paths @milestone(7: Leisure)
70 - Basic satisfaction @milestone(7: Leisure)
71 - Basic satisfaction @milestone(7: Leisure)
71 - Set
72 - Set
@@ -164,7 +164,7
164 yield return this.cells[x - 1][y+1];
164 yield return this.cells[x - 1][y+1];
165 }
165 }
166 }
166 }
167
167
168 public System.Collections.Generic.IEnumerable<(int, int)> iterate_neighbor_cell_locations(int x, int y)
168 public System.Collections.Generic.IEnumerable<(int, int)> iterate_neighbor_cell_locations(int x, int y)
169
169
170 {
170 {
@@ -271,7 +271,8
271 public enum CellStatus {
271 public enum CellStatus {
272 Clear,
272 Clear,
273 LivingTree,
273 LivingTree,
274 DeadTree
274 DeadTree,
275 Water
275 }
276 }
276
277
277 public enum TreeType {
278 public enum TreeType {
@@ -321,6 +322,10
321 this.Type = type;
322 this.Type = type;
322 }
323 }
323
324
325 public void AddWater() {
326 this.Status = CellStatus.Water;
327 }
328
324 public void RemoveTree() {
329 public void RemoveTree() {
325 this.Status = CellStatus.Clear;
330 this.Status = CellStatus.Clear;
326 }
331 }
@@ -103,7 +103,7
103 object1: "#object#"
103 object1: "#object#"
104 object2: "#object#"
104 object2: "#object#"
105 object3: "#object#"
105 object3: "#object#"
106 - hed: "How the people of #subject_area.capitalize# are fighting #subject_problem.capitalize#"
106 - hed: "How the people of #subject_area.capitalize# are fighting #subject_problem#"
107 contents: "#femaleCodedName# #surname#, an #occupation#, stares out at the wilderness of #subject_area#.
107 contents: "#femaleCodedName# #surname#, an #occupation#, stares out at the wilderness of #subject_area#.
108
108
109 Like many places, it has not been spared by #subject_problem#."
109 Like many places, it has not been spared by #subject_problem#."
@@ -132,9 +132,27
132 - hed: "Are Comets Real?"
132 - hed: "Are Comets Real?"
133 contents: ""
133 contents: ""
134 source: "True"
134 source: "True"
135 - hed: "Scientists Attached an Ear to the Back of a Mouse?? What the Hell???"
136 contents: ""
137 source: "True"
138 - hed: "EDITOR'S NOTE: Mole People are Just Like Us"
139 contents: "Many independent journalists report breathlessly on moleperson sightings. Take The Weekly Wolrd News. Despite uncovering such important stories as the Batboy and raising merfolk awareness, they also have perpetuated stigma against the moleperson community.
140
141 This is wrong. And for the 129 stories, anonymous poem and three unsigned letters, sensationalizing the molepeople I filled while an intern, I apologize.
142
143 In fact one of my best friends is a mole person. #moleperson_first_name# #moleperson_surname# was born underground to a loving mole family, who even took me in when my dad worked nights at the #object# factory.
144
145 While there are definite cultural differences between my normal, All-American family and his abnormal, All-Mole family, like their affinity for dirt and snouts instead of noses, we're all just people. Kumbyah, right?"
146 source: "True"
147 variables:
148 moleperson_first_name: "#maleCodedName#"
149 moleperson_surname: "#surname#"
150 - hed: "MYSTERY: Can Guys and Girls Just Be Friends?"
151 contents: ""
152 source: "True"
135 - hed: "Protester Struck After Bullet Emerges From Gun Held by Police Officer"
153 - hed: "Protester Struck After Bullet Emerges From Gun Held by Police Officer"
136 contents: "Local #protestor_first_name# #protestor_surname# was protesting when they were struck by a bullet
154 contents: "Local #protestor_first_name# #protestor_surname# was protesting when they were struck by a bullet
137 that came from a gun held by a police officer. They died later at #town# Memorial Hospital.
155 that emerged from a gun held by a police officer. They died later at #town# Memorial Hospital.
138
156
139 #protestor_surname#'s family insists the police take responsibility.
157 #protestor_surname#'s family insists the police take responsibility.
140
158
@@ -41,13 +41,65
41 protected override void Spawn(in SpawnGameMessage message)
41 protected override void Spawn(in SpawnGameMessage message)
42 {
42 {
43
43
44 #region generate_water
45
46 /*
47 * Differs from code in ContractSpawner in a few ways:
48 * —Not concerned with existing tiles—this is one of the first things we're doing to the new map
49 * —Doesn't keep track of attempts (should be few and far betweet.)
50 * —No logging (not sure what logging is necessary here)
51 *
52 * These notes are mostly for myself in the future if I decide to unify these implementations.
53 */
54 for (int i = 0; i < Simulation.NUM_WATER_FEATURES; i++) {
55 var water_x = this.random_generator.Next(0, this.simulation.map.MapWidth);
56 var water_y = this.random_generator.Next(0, this.simulation.map.MapHeight);
57
58
59 var water_squares = new List<Vector2>(new[] { new Vector2(water_x, water_y) });
60 var squares_to_add = new HashSet<Vector2>();
61 var odds = 0.50;
62
63 while (water_squares.Count < 50) {
64 foreach (var square in water_squares)
65 {
66 foreach (var new_square in new[] {new Vector2(square.X + 1, square.Y),
67 new Vector2(square.X, square.Y + 1),
68 new Vector2(square.X - 1, square.Y),
69 new Vector2(square.X, square.Y - 1)
70 })
71 {
72 if (random_generator.NextDouble() < odds
73 && !water_squares.Contains(new_square)
74 && MathUtils.Between(new_square.X, 0, this.simulation.map.MapWidth)
75 && MathUtils.Between(new_square.Y, 0, this.simulation.map.MapHeight)
76 )
77 {
78 squares_to_add.Add(new_square);
79 }
80 }
81 }
82 water_squares.AddRange(squares_to_add);
83 squares_to_add.Clear();
84 }
85
86 foreach (var square in water_squares) {
87 this.simulation.map.cells[(int)square.X][(int)square.Y].AddWater();
88
89 }
90 }
91
92
93
94 #endregion
44 #region generate_trees
95 #region generate_trees
45
96
46 foreach (List<Cell> row in this.simulation.map.cells)
97 foreach (List<Cell> row in this.simulation.map.cells)
47 {
98 {
48 foreach (Cell cell in row)
99 foreach (Cell cell in row)
49 {
100 {
50 if (this.random_generator.NextDouble() > 0.75)
101 var next = this.random_generator.NextDouble();
102 if (next > 0.75)
51 {
103 {
52 int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR);
104 int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR);
53 int random_month = random_generator.Next(1, 13);
105 int random_month = random_generator.Next(1, 13);
@@ -57,6 +109,9
57
109
58 cell.AddTree(random_date, (TreeType)random_type);
110 cell.AddTree(random_date, (TreeType)random_type);
59 }
111 }
112 // else if (next > 0.625) {
113 // cell.AddWater();
114 // }
60 }
115 }
61 }
116 }
62 #endregion
117 #endregion
@@ -602,6 +602,73
602 drawTileAt(x, y, tileIndex, height, Color.White);
602 drawTileAt(x, y, tileIndex, height, Color.White);
603 }
603 }
604
604
605 protected void drawWaterTileAt(int x, int y, int height) {
606 var tile_index = 85;
607 var cells = this.simulation.map.cells;
608
609
610 //Unfortunately this is tileset dependent and pretty awkward to type out :(
611 var northwest = cells[x-1][y].Status == CellStatus.Water;
612 var northeast = cells[x][y-1].Status == CellStatus.Water;
613 var southwest = cells[x][y+1].Status == CellStatus.Water;
614 var southeast = cells[x+1][y].Status == CellStatus.Water;
615
616
617 if (northwest && northeast && southwest && southeast) {
618 tile_index = 85;
619 }
620 else if (northwest && northeast && southwest && !southeast) {
621 tile_index = 82;
622 }
623 else if (northwest && northeast && !southwest && southeast) {
624 tile_index = 81;
625 }
626 else if (northwest && northeast && !southwest && !southeast) {
627 tile_index = 80;
628 }
629 else if (northwest && !northeast && southwest && southeast) {
630 tile_index = 88;
631 }
632 else if (northwest && !northeast && southwest && !southeast) {
633 tile_index = 86;
634 }
635 else if (northwest && !northeast && !southwest && southeast) {
636 tile_index = 91;
637 }
638 else if (northwest && !northeast && !southwest && !southeast) {
639 tile_index = 90; //Not really correct
640 }
641 else if (!northwest && northeast && southwest && southeast) {
642 tile_index = 87;
643 }
644 else if (!northwest && northeast && southwest && !southeast) {
645 tile_index = 92;
646 }
647 else if (!northwest && northeast && !southwest && southeast) {
648 tile_index = 94;
649 }
650 else if (!northwest && northeast && !southwest && !southeast) {
651 tile_index = 95; //not really correct
652 }
653 else if (!northwest && !northeast && southwest && southeast) {
654 tile_index = 89;
655 }
656 else if (!northwest && !northeast && southwest && !southeast) {
657 tile_index = 95;
658 }
659 else if (!northwest && !northeast && !southwest && southeast) {
660 tile_index = 95;
661 }
662 //Shouldn't really exist:
663 else if (!northwest && !northeast && !southwest && !southeast) {
664 tile_index = 101;
665 }
666
667
668
669 drawTileAt(x, y, tile_index, height, Color.White);
670 }
671
605
672
606 protected override void Draw(GameTime gameTime)
673 protected override void Draw(GameTime gameTime)
607 {
674 {
@@ -836,6 +903,9
836 drawTileAt(i, j, 141, 2);
903 drawTileAt(i, j, 141, 2);
837 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
904 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
838 }
905 }
906 else if (this.simulation.map.cells[i][j].Status == CellStatus.Water) {
907 drawWaterTileAt(i, j, 1);
908 }
839 }
909 }
840 }
910 }
841 }
911 }
@@ -73,6 +73,8
73
73
74 public const decimal STARTING_FUNDS = 100_000M;
74 public const decimal STARTING_FUNDS = 100_000M;
75
75
76 public const int NUM_WATER_FEATURES = 5;
77
76 public SimulationBridgeEngine BridgeEngine { get; private set; }
78 public SimulationBridgeEngine BridgeEngine { get; private set; }
77
79
78 public decimal Subsidy {
80 public decimal Subsidy {
You need to be logged in to leave comments. Login now